Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
2.2.12
-
None
-
linux
-
MXS-SPRINT-85
Description
insert into randselect values(1, 'a'),... (10, 'ab');
string sqlstr="select names from randselect where id = ?;"
stmt = mysql_stmt_init(conn);
if(NULL == stmt)
if (mysql_stmt_prepare(stmt, sql.c_str(), strlen(sql.c_str())) != 0)
{ print_stmt_error(stmt,"stmt prepare fail"); return 1; } memset(param,0,sizeof(param));
memset(result,0,sizeof(result));
result[0].buffer_type = MYSQL_TYPE_STRING;
result[0].buffer = (char*)&value;
result[0].is_unsigned = 0;
result[0].is_null = 0;
result[0].buffer_length = MAX_SIZE;
result[0].length = &length;
if (mysql_stmt_bind_result(stmt,result) !=0)
{ print_stmt_error(stmt,"bind result error"); return 1; } param[0].buffer_type = MYSQL_TYPE_LONG;
param[0].buffer = (void *) &id;
param[0].is_unsigned = 1;
param[0].is_null = 0;
param[0].length = 0;
if (mysql_stmt_bind_param(stmt, param) != 0)
{ print_stmt_error(stmt,"bind param error"); return 1; } int j = 1;
while (j < 10)
{
id = j;
//mysql_stmt_bind_param(stmt, param);
if(mysql_stmt_execute(stmt) !=0)
if (mysql_stmt_store_result(stmt) != 0)
{ print_stmt_error(stmt, "Could not buffer result set"); return 1; } cout << "id" << id << endl;
while (!mysql_stmt_fetch(stmt))
j++;
}
mysql_stmt_close(stmt);
when multi stmt_exec router to diff db backends,maybe some exec don't get result(empty),only exec first stmt_exec node will reture result, other db backends will return empty result.
maybe because stmt_exec(https://dev.mysql.com/doc/internals/en/com-stmt-execute.html) have new-params-bound-flag,and only set when mysql_stmt_bind_param,otherwise new-params-bound-flag=0 and client not send param type lead to db return empty。
Attachments
Issue Links
- is blocked by
-
MXS-2750 COM_STMT_EXECUTE in transaction get unexpected result
- Closed
- relates to
-
MDEV-19811 Crash with prepared statement
- Open