Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Cannot Reproduce
-
3.0.0, 2.2.0
-
None
-
All platforms
Description
When using binary protocol (prepared statements) numeric values with zerofill flag will not be converted correctly.
How to repeat
static int test_zerofill(MYSQL *mysql)
|
{
|
MYSQL_STMT *stmt;
|
MYSQL_BIND bind;
|
char buffer[9];
|
|
int rc;
|
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
check_mysql_rc(rc, mysql);
|
rc= mysql_query(mysql, "CREATE TABLE t1 (a int(8) zerofill)");
|
check_mysql_rc(rc, mysql);
|
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1)");
|
check_mysql_rc(rc, mysql);
|
|
stmt= mysql_stmt_init(mysql);
|
rc= mysql_stmt_prepare(stmt, "SELECT a FROM t1", -1);
|
check_stmt_rc(rc, stmt);
|
rc= mysql_stmt_execute(stmt);
|
|
memset(&bind, 0, sizeof(MYSQL_BIND));
|
bind.buffer= buffer;
|
bind.buffer_type= MYSQL_TYPE_STRING;
|
bind.buffer_length= 9;
|
rc= mysql_stmt_bind_result(stmt, &bind);
|
check_stmt_rc(rc, stmt);
|
|
rc= mysql_stmt_fetch(stmt);
|
diag("Buffer: %s", buffer);
|
FAIL_IF(strlen(buffer) == 1, "Expected zerofilled string");
|
rc= mysql_stmt_close(stmt);
|
return OK;
|
}
|
This issue isn't reproducable anymore - added test test_conc176 in unittest/libmariadb/ps_bugs.c