Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
#include <mysql.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <string.h>
|
|
int main(int argc, char **argv) |
{
|
unsigned int port= 3306; |
if (argc > 1) |
sscanf(argv[1], "%d", &port); |
|
MYSQL *con = mysql_init(NULL);
|
|
if (mysql_real_connect(con, "127.0.0.1", "root", "", "test", port, NULL, 0) == NULL) |
{
|
fprintf(stderr,"Can't connect: %s\n",mysql_error(con)); |
exit(1); |
}
|
|
mysql_query(con,"drop procedure if exists sp"); |
mysql_query(con,"create procedure sp() select 1"); |
|
MYSQL_STMT *stmt = mysql_stmt_init(con);
|
unsigned long cursor = CURSOR_TYPE_READ_ONLY; |
const char* query= "call sp()"; |
|
if (mysql_stmt_prepare(stmt,query,strlen(query))) |
{
|
fprintf(stderr,"Couldn't prepare: %s\n", mysql_error(con)); |
mysql_close(con);
|
exit(1); |
}
|
|
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, &cursor);
|
|
if (mysql_stmt_execute(stmt)) |
fprintf(stderr,"Got error: %s\n", mysql_stmt_error(stmt)); |
|
mysql_stmt_close(stmt);
|
mysql_close(con);
|
exit(0); |
}
|
With libmariadb from recent 10.2-10.6, it fails with
10.2 ceb40ef4 |
Got error: Commands out of sync; you can't run this command now
|
With libmysqlclient from 10.1 or from MySQL 5.7, it works.
Attachments
Issue Links
- blocks
-
MXS-3818 Upgrade to Connector-C 3.1.15
- Closed