after a lot of test and controlling log file i ve this situation.
PHP:
header (“Content-Type: text / html; charset = utf-8”);
require(“…/codebase/connector/grid_connector.php”);
$res= new PDO(“mysql:dbname=my_mbo;host=localhost”,“root”,“”);
$conn = new GridConnector($res,“PDO”);
$conn->enable_live_update(‘actions_table’);
$conn->event->attach(“beforeinsert”,“myInsert”);
$conn->enable_log(“temp.log”);
if ($conn->is_select_mode()){
$conn->render_sql(“select magazzino.*,saldi.quantita,saldi.quantita - saldi.qta_prenotata - saldi.qta_fuori AS qta_disponibile,saldi.qta_prenotata,saldi.qta_fuori,magazzino.nota AS nota2 from magazzino left join saldi on magazzino.codice = saldi.codice where magazzino.codice <> ‘’”,“magazzino.id”,“codice,descrizione,categoria,um,ubicazione,nota,quantita,qta_disponibile, qta_prenotata,qta_fuori, nota2”);
} else {
$conn->render_table(“magazzino”,“id”,“codice,descrizione,categoria,um,ubicazione,nota,bloccato”);
}
function myInsert($action){
if($action->get_value(“codice”)==“”)
$action->set_value(“codice”,null);
}
?>
and this are the query that appears in log file:
- for select and is correct.
====================================
Log started, 23/05/2024 04:37:01
Editing = Updating =
Editing = Updating =
SELECT magazzino.*,saldi.quantita,saldi.quantita - saldi.qta_prenotata - saldi.qta_fuori AS qta_disponibile,saldi.qta_prenotata,saldi.qta_fuori,magazzino.nota AS nota2 FROM magazzino left join saldi on magazzino.codice = saldi.codice WHERE ( magazzino.codice <> ‘’)
SELECT MAX(id) as VERSION FROM actions_table
Done in 0.0014209747314453s
FOR UPDATE AND THIS IS WRONG
====================================
Log started, 23/05/2024 04:37:03
Editing = Updating = 1
Editing = Updating = 1
SELECT magazzino left join saldi on magazzino.codice = saldi.codice.*, actions_table.id, actions_table.dataId, actions_table.type as action_table_type, actions_table.user FROM actions_table LEFT OUTER JOIN magazzino left join saldi on magazzino.codice = saldi.codice ON actions_table.DATAID = magazzino left join saldi on magazzino.codice = saldi.codice.magazzino.id WHERE ( magazzino.codice <> ‘’) AND ( actions_table.ID > ‘71’ AND actions_table.USER <> ‘1716475021133’)
!!!Uncaught Exception
Code: 42000
Message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘left join saldi on magazzino.codice = saldi.codice.*, actions_table.id, actio…’ at line 1
I’ dont understand why CONNECTOR try to create the query for UPDATE operation with the sql insided in the RENDER_SQL command instead the sql insided in the RENDER_TABLE command.
Please help me it’s a critical part of application.
Thanks