Error "-- is not a valid table name for a Subform"

Questions related to using nuBuilder Forte.

Error "-- is not a valid table name for a Subform"

Postby TNSAlex » Fri Jan 03, 2020 8:57 am

Hello,

I am new to nuBuilder. Trying to create my first project but all database update actions cause an error like "XXXXX is not a valid table name for a Subform"

For example: when I try to "Save" modified a time zone I am getting the "zzzzsys_setup is not a valid table name for a Subform" error, or attempt to create an access level results: "zzzzsys_access is not a valid table name for a Subform" etc.

I've traced the problem to the function nuUpdateDatabase() in nudata.php where we get $cts = nuGetJSONData('clientTableSchema'). If I uderstad correct, the clientTableSchema refers to the JASON stored in field "sss_access" of "zzzzsys_session" table for my session.

I've checked the content of clientTableSchema and it is empty:
Code: Select all
"clientTableSchema":{"":{"names":[],"types":[],"primary_key":[],"valid":1}}


What is wrong and how I can fix it?

The same issue described in other threads, but no solution:
viewtopic.php?f=19&t=9702
viewtopic.php?f=19&t=9874

I've tried various versions of nuBuilder from GitHub and SourceForge - the same result. Currently have this version installed https://github.com/steven-copley/nubuilder4 which appears to be the latest one.
TNSAlex
 
Posts: 2
Joined: Fri Jan 03, 2020 8:28 am

Re: Error "-- is not a valid table name for a Subform"

Postby TNSAlex » Fri Jan 03, 2020 12:54 pm

Problem solved:

If you use MySQL Server 8 then your INFORMATION_SCHEMA database has all tables and fields names written in CAPS, including INFORMATION_SCHEMA.TABLES which is used in nuBuildTableSchema function. SO, you have to modify the code in your nucommon.php, replace $tn = $r->table_name; with $tn = $r->TABLE_NAME; see bellow:
Code: Select all
function nuBuildTableSchema(){

   $a            = array();
   $t            = nuRunQuery("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE()");

   while($r = db_fetch_object($t)){
      
      //$tn         = $r->table_name;
      $tn         = $r->TABLE_NAME;
      $a[$tn]    = array('names' => db_field_names($tn), 'types' => db_field_types($tn), 'primary_key' => db_primary_key($tn), 'valid' => 1);
      
   }
   
   return $a;

}
TNSAlex
 
Posts: 2
Joined: Fri Jan 03, 2020 8:28 am

Re: Error "-- is not a valid table name for a Subform"

Postby admin » Sun Jan 12, 2020 9:04 am

.
admin
Site Admin
 
Posts: 3234
Joined: Mon Jun 15, 2009 9:53 am


Return to General



cron