Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
None
-
Ubuntu 12.04LTS (though not limited to environment)
Description
I have an application which has been tested against the MySQL 5.0, 5.1, and 5.5 client libraries. Last year, we started testing the MariaDB client for C, and were on revision 42 and the application worked properly there too. Trying to replicate testing on the current revision 109, mysql_stmt_fetch() fails with error code 1421 with the message: "The statement (3) has no open cursor"
After further research, the issue appears to have been introduced in revision 62, as up to revision 61 works fine.
I have not yet produced a minimal test case for this, but in general, the application follows what I believe is a fairly standard flow (pseudo code to give general idea):
stmt = mysql_stmt_init()
|
mysql_stmt_prepare(stmt, ...)
|
/* Create bind_params for statement here */
|
mysql_stmt_bind_param(stmt, bind_params)
|
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, CURSOR_TYPE_READ_ONLY)
|
mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, 1000)
|
mysql_stmt_execute(stmt)
|
res = mysql_stmt_result_metadata(stmt)
|
num = mysql_num_fields(res)
|
fields = mysql_fetch_fields(res)
|
for (i=0; i<num; i++) {
|
/* cache fields[i].name and fields[i].type */
|
}
|
mysql_free_result(res)
|
/* Create bind result data here based on cached name and type for each response column */
|
mysql_stmt_bind_result(stmt, bind_result)
|
mysql_stmt_fetch(stmt)
|
... and it fails at that fetch so I won't continue...
|
I haven't yet tried to determine what in the commit caused the change as there seems to be a bit to go through due to white space cleanups being mixed in.