Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

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

Questions related to using nuBuilder Forte.
Post Reply
TNSAlex
Posts: 2
Joined: Thu Jan 02, 2020 11:58 pm

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

Unread post by TNSAlex »

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:
https://forums.nubuilder.cloud/viewtopic.php?f=19&t=9702
https://forums.nubuilder.cloud/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: Thu Jan 02, 2020 11:58 pm

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

Unread post by TNSAlex »

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;

}
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

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

Unread post by admin »

.
Post Reply