C + + call stored procedure failed! The following error occurred: MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given context
which
XMDK is the database name,
Query_all_plan is the name of the stored procedure written by himself;
Error reason: connection to the database may be incorrect.
The database connection method that caused the error:
C + + Code
1 2 3 4 5 6 7 8 9 10 11 |
|
if(mysql_real_connect(M_mysql, Server_ip.c_str (), User_name. C_str (), User_password. C_str (), Mysql_dbname. C_str (), 0, NULL, 0) == NULL) { Debug_trace_error (wstr("Serverconnect_2,eer:mysql (%s) connection failed.,%s:%d"), Connectstr. C_str (), __wfunction__, __line__); return -1; } |
Modify to the correct connection mode:
C + + Code
1 2 3 4 5 6 7 8 9 10 11 |
|
if(mysql_real_connect(M_mysql, Server_ip.c_str (), User_name. C_str (), User_password. C_str (), Mysql_dbname. C_str (), 0, NULL, client_multi_statements) == NULL) { Debug_trace_error (wstr("Serverconnect_2,eer:mysql (%s) connection failed.,%s:%d"), Connectstr. C_str (), __wfunction__, __line__); return -1; } |
Sure enough, by modifying the connection parameters (client_multi_statements) connected to the database, it's OK!
With client_multi_statements, You can execute multiple statements at once, and execute a stored procedure (many statements).
MySQL error:procedure Xmdk.query_all_plan can ' t return a result set in the given context