Page 1 of 1

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

Posted: Fri Jan 03, 2020 12:27 am
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.

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

Posted: Fri Jan 03, 2020 4:24 am
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;

}

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

Posted: Sun Jan 12, 2020 12:34 am
by admin
.