This is a small snipet, as thanos' test, ODBC works for me too and not the direct connection.
(Change 'Use' line and 'OpenDatabase' line to test the two version)
Code: Select all
UseMySQLDatabase()
; UseODBCDatabase()
Procedure CheckDatabaseUpdate(Database, Query$)
Protected Result
Result = DatabaseUpdate(Database, Query$)
Debug "Query : " + Query$
Debug "Rows : " + AffectedDatabaseRows(Database)
If Result = 0
Debug "ERROR : >>> " + DatabaseError() + " <<<"
End
EndIf
Debug ""
ProcedureReturn Result
EndProcedure
; Direct: 'Commands out of sync; you can't run this command now'
hDatabase = OpenDatabase(#PB_Any, "host=localhost port=3306 dbname=PB_Test", "test", "test")
; ODBC (MariaDB ODBC 3.1)
; https://downloads.mariadb.com/Connectors/odbc/connector-odbc-3.1.11/
; hDatabase = OpenDatabase(#PB_Any, "PB_test", "test", "test")
If (hDatabase)
Debug "Connected to MySQL"+ #CRLF$
CheckDatabaseUpdate(hDatabase, "SET autocommit = OFF;")
CheckDatabaseUpdate(hDatabase, "BEGIN;")
; ForEach Values2Insert()
; CheckDatabaseUpdate(hDatabase, Values2Insert())
; i+1
; Next
CheckDatabaseUpdate(hDatabase, "COMMIT;")
CloseDatabase(hDatabase)
EndIf
Code: Select all
Connected to MySQL
Query : SET autocommit = OFF;
Rows : 0
Query : BEGIN;
Rows : 0
Query : COMMIT;
Rows : 0
Code: Select all
Connected to MySQL
Query : SET autocommit = OFF;
Rows : 0
Query : BEGIN;
Rows : 0
ERROR : >>> Commands out of sync; you can't run this command now <<<
I tried to use AffectedDatabaseRows(Database) to try to clear the buffer, but it has no effect.
According to several opinions it is the DLL that has a problem.
I'll keep on looking (even if I don't use MySQL anymore, but PostgreSQL)