In data giovedì 11 aprile 2019 14:29:22 CEST, Simone Lazzaris ha scritto:
Apr 11 14:21:31 ERROR: db_mysql [km_dbase.c:127]: db_mysql_submit_query(): driver error on query: Commands out of sync; you can't run this command now (2014) Apr 11 14:21:31 ERROR: <core> [db_query.c:132]: db_do_query_internal(): error while submitting query
Replying to myself:
I've found that the issue is in some stored procedures on the database that my code invokes.
To fix this, I have to replace this code
sql_query( "database", "CALL reg_start('$au','$ua','$si')", "result");
with the stored procedure content:
sql_query( "database", "SET @next_seq_id=0;SELECT (@next_seq_id:=((seq_id+1)%32)) AS next_seq_id FROM reg_history WHERE auth_username='$au' ORDER BY start DESC LIMIT 1;INSERT INTO reg_history SET auth_username='$au', seq_id=@next_seq_id, user_agent='$ua', remote_ip='$si' ON DUPLICATE KEY UPDATE start=NOW(), stop=0, user_agent='$ua', remote_ip='$si';" );