I have a PHP script with the following lines:
require_once 'meekrodb.2.1.class.php';
DB::$user = 'usr';
DB::$password = 'pwd';
DB::$dbName = 'db';
DB::$encoding = 'utf8';
$results = DB::queryFirstField("
CALL getSequence('time_id', %i); // ***** Stored procedure call *****
", TENANT_ID);
DB::insert('timeentry', array(
'tenant_id' => TENANT_ID,
'time_id' => $results,
'timestart' => DB::sqleval("now()"),
'assig_id' => $assig_id
));
I am getting the following error:
QUERY: INSERT INTO
timeentry
(tenant_id
,time_id
,timestart
,assig_id
) VALUES (1, '42', now(), '1')ERROR: Commands out of sync; you can't run this command now
If I replace the call to the stored procedure with a SELECT statement, everything works fine.
$results = DB::queryFirstField("
SELECT 45; // ***** SELECT statement *****
");
DB::insert('timeentry', array(
'tenant_id' => TENANT_ID,
'time_id' => $results,
'timestart' => DB::sqleval("now()"),
'assig_id' => $assig_id
));
I have not analyzed the internals of the MeekroDB Library (http://www.meekro.com).
I tried wrapping each statement in a transaction but I get the same error when COMMIT is executed right after the call to the stored procedure.
Any help is greatly appreciated.