[MXS-2521] COM_STMT_EXECUTE maybe return empty result Created: 2019-05-28 Updated: 2020-01-08 Resolved: 2019-06-28 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | readwritesplit |
| Affects Version/s: | 2.2.12 |
| Fix Version/s: | 2.2.22, 2.3.9, 2.4.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | xiangzhong | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
linux |
||
| Attachments: |
|
||||||||||||||||
| Issue Links: |
|
||||||||||||||||
| Sprint: | MXS-SPRINT-85 | ||||||||||||||||
| Description |
|
insert into randselect values(1, 'a'),... (10, 'ab'); string sqlstr="select names from randselect where id = ?;" 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)); result[0].buffer_type = MYSQL_TYPE_STRING; if (mysql_stmt_bind_result(stmt,result) !=0) { print_stmt_error(stmt,"bind result error"); return 1; } param[0].buffer_type = MYSQL_TYPE_LONG; if (mysql_stmt_bind_param(stmt, param) != 0) { print_stmt_error(stmt,"bind param error"); return 1; } int j = 1; id = j; if (mysql_stmt_store_result(stmt) != 0) { print_stmt_error(stmt, "Could not buffer result set"); return 1; } cout << "id" << id << endl; 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。 |
| Comments |
| Comment by dapeng huang [ 2019-06-20 ] |
|
test-mxs-2521.c |
| Comment by markus makela [ 2019-06-20 ] |
|
dapeng if you can contribute that test according to the MaxScale contribution policy (BSD-3), we can add the test into our test suite. |
| Comment by dapeng huang [ 2019-06-20 ] |
|
@markus makela ; I am contributing the test test-mxs-2521.c case under the BSD-3 |
| Comment by markus makela [ 2019-06-20 ] |
|
Thanks, we'll add it to the test suite. |