Page 2 of 2

Re: my FastForm builder seems to be dropping tables...

Posted: Wed Jan 05, 2022 12:30 am
by lxnunes
please disregard the last comment about the DATABASE() function. It seems to be a no-issue based on lack of caffeine :|

FYI, this query (and a variation using upper case) seems to exist also in these locations of nucommon.php

Code: Select all

Line 1192: $t	= nuRunQuery("SELECT table_name as TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE()");
Line 1210: $t	= nuRunQuery("SELECT table_name as TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'VIEW' AND table_schema = DATABASE()");
Line 1256: $t	= nuRunQuery("SELECT table_name FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = DATABASE()");
And I see another error in nuDebug (low impact), probably because MySQL does not accept casts as INTs, just as UNSIGNED. MariaDB reportedly has no issues with this syntax:

Code: Select all

===PDO MESSAGE=== 

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INT)) + 1
		FROM `zzzzsys_form` 
			WHERE `sfo_code` LIKE 'FF%'
			AND SUBSTRING' at line 2

===SQL=========== 
		SELECT 
			MAX(CAST(SUBSTRING(`sfo_code`, 3) as INT)) + 1
		FROM `zzzzsys_form` 
			WHERE `sfo_code` LIKE 'FF%'
			AND SUBSTRING(`sfo_code`, 3) REGEXP '^-?[0-9]+$'

===BACK TRACE====
/var/www/html/TestDB/core/nubuilders.php - line 116 (nuRunQuery)
/var/www/html/TestDB/core/nubuilders.php - line 26 (nuFFNumber)
/var/www/html/TestDB/core/nucommon.php(1349) : eval()'d code - line 1 (nuBuildFastForm)
/var/www/html/TestDB/core/nucommon.php - line 1349 (eval)
/var/www/html/TestDB/core/nucommon.php - line 437 (nuEval)
/var/www/html/TestDB/core/nuapi.php - line 81 (nuRunPHPHidden)

Re: my FastForm builder seems to be dropping tables...

Posted: Wed Jan 05, 2022 6:04 am
by kev1n
I'm wondering what MySQL version you running?

The SQL with the INT cast works just fine newer mySQL/MariaDB Versions
Eventually I tested it on MySQL 5.7 where I could replicate the "Syntax error or access violation".
Casting to UNSIGNED instead of INT fixed it for me.

Can you try it with this new version (Just replace your local nubuilders.php with the one from Github)
https://github.com/nuBuilder/nuBuilder- ... ilders.php

Re: my FastForm builder seems to be dropping tables...

Posted: Wed Jan 05, 2022 10:23 am
by lxnunes
kev1n, I cannot thank you enough for your help, that version works as expected.
I am running

Code: Select all

Ver 8.0.27-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu))

Re: my FastForm builder seems to be dropping tables...

Posted: Wed Jan 05, 2022 10:47 am
by kev1n
I am glad to hear that everything is working now :D

What MySQL version is returned if you run this command in phpMyAdmin?

Code: Select all

SELECT VERSION();

Re: my FastForm builder seems to be dropping tables...

Posted: Wed Jan 05, 2022 11:35 am
by lxnunes
fortunately, the same

Code: Select all

+-------------------------+
| VERSION()               |
+-------------------------+
| 8.0.27-0ubuntu0.20.04.1 |
+-------------------------+