1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-07 02:42:49 +03:00

Another fix for CONC-177: ps-protocol with integer values and zerofill

weren't correctly converted to strings
This commit is contained in:
Georg Richter
2016-05-30 20:46:29 +02:00
parent ec383d59fa
commit b90b17804d
3 changed files with 45 additions and 6 deletions

View File

@@ -4188,6 +4188,38 @@ static int test_conc177(MYSQL *mysql)
FAIL_IF(strcmp(buf1, "00000000000000000008.8"), "Expected 00000000000000000008.8");
FAIL_IF(strcmp(buf2, "0000000008.8"), "Expected 0000000008.8");
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 default 1, b int(4) zerofill default 1)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (DEFAULT, DEFAULT)");
check_mysql_rc(rc, mysql);
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, stmt_str, strlen(stmt_str));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
memset(bind, 0, 2 * sizeof(MYSQL_BIND));
bind[0].buffer= &buf1;
bind[0].buffer_type= MYSQL_TYPE_STRING;
bind[0].buffer_length= 128;
bind[1].buffer= &buf2;
bind[1].buffer_type= MYSQL_TYPE_STRING;
bind[1].buffer_length= 128;
rc= mysql_stmt_bind_result(stmt, bind);
check_stmt_rc(rc, stmt);
rc= mysql_stmt_fetch(stmt);
mysql_stmt_close(stmt);
diag("buf1 %s\nbuf2 %s", buf1, buf2);
FAIL_IF(strcmp(buf1, "00000001"), "Expected 00000001");
FAIL_IF(strcmp(buf2, "0001"), "Expected 0001");
return OK;
}