- summary: columns names are not quoted --> v5.11 - columns names are not quoted
hello
when using AutoExecute to Update a table containing certain columns names being reserved words, query falls in error :
(mysql): UPDATE sc_routes SET ROUTE='admin/articles/index.html', MAP='', CONTROLLER='admin_articles', ACTION='index', GROUP='admin' WHERE id_route = 4 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 'GROUP='admin' WHERE id_route = 4' at line 1
ADOConnection._Execute(UPDATE sc_routes SET ROUTE='admin/articles/index.html', MAP='', CONTROLLER='admin_articles', ACTION='index', GROUP='admin' WHERE..., false) % line 1047, file: adodb.inc.php
ADOConnection.Execute(UPDATE sc_routes SET ROUTE='admin/articles/index.html', MAP='', CONTROLLER='admin_articles', ACTION='index', GROUP='admin' WHERE...) % line 1932, file: adodb.inc.php
ADOConnection.AutoExecute(sc_routes, Array[6], UPDATE, id_route = 4) % line 328, file: Models.php
Core\Models.update(Array[6]) % line 66, file: admin_routes.php
Sc\controllers\admin_routes.doEdit() % line 0, file:
I found an error about global variable $ADODB_QUOTE_FIELDNAMES into adodb-lib.inc.php :
into functions _adodb_getupdatesql() and _adodb_getinsertsql(), it is used into a test then used for a switch(), but into the switch it is missing the $ !!
...
646. if ((strpos($upperfname,' ') !== false) || ($ADODB_QUOTE_FIELDNAMES)) {
647. switch (ADODB_QUOTE_FIELDNAMES) {
...
...
818. if ((strpos($upperfname,' ') !== false) || ($ADODB_QUOTE_FIELDNAMES)) {
819. switch (ADODB_QUOTE_FIELDNAMES) {
...
after fixing the $ problem and setting this global variable properly, query has columns names correctly quoted.
but is there a better way to define this variable instead of using global variable ?
hope this will help (or am I missing something ?)