You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using cppdb and trying to call a stored procedure on my mysql database like so
cppdb::result res = session << "call my_stored_proc()"
This works on the first call, but if I try to call again (after having called res.clear() or stepping through res.next()) I get a cppdb::mysql_backend::cppdb_myerror exception with the message
what(): cppdb::mysql::Commands out of sync; you can't run this command now.
I have no problem calling the stored procedure multiple times from the mysql prompt, or using queries. After searching the web my best guess is that this might have to do with called procedures returning two result sets, one being a status code, which then is perhaps left dangling (not processed)? I would like to avoid the workaround of closing and reopening the connection, which I suppose hurt performance since that cause cached statements to be cleared.
The text was updated successfully, but these errors were encountered:
If you have a table called 'tab' you can store the SELECT * FROM tab query as a procedure by putting the following in a file and then sourcing that from the mysql prompt. Then test it by doing doing call my_stored_proc();.
DROP procedure IF EXISTS `my_stored_proc`;
DELIMITER //
CREATE PROCEDURE my_stored_proc()
BEGIN
SELECT * FROM tab;
END //
DELIMITER ;
I'm using cppdb and trying to call a stored procedure on my mysql database like so
cppdb::result res = session << "call my_stored_proc()"
This works on the first call, but if I try to call again (after having called
res.clear()
or stepping throughres.next()
) I get acppdb::mysql_backend::cppdb_myerror
exception with the messagewhat(): cppdb::mysql::Commands out of sync; you can't run this command now
.I have no problem calling the stored procedure multiple times from the mysql prompt, or using queries. After searching the web my best guess is that this might have to do with called procedures returning two result sets, one being a status code, which then is perhaps left dangling (not processed)? I would like to avoid the workaround of closing and reopening the connection, which I suppose hurt performance since that cause cached statements to be cleared.
The text was updated successfully, but these errors were encountered: