diff options
author | konstantin@mysql.com <> | 2004-09-08 12:33:05 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2004-09-08 12:33:05 +0400 |
commit | 3640843a8b9dcf6255a40286c1d47a67479dfc1d (patch) | |
tree | 6113d3613407058e37ca56ab85c7c3153c770a0a /tests | |
parent | dab891864737a916f8593c6e668f6dfaa557fe58 (diff) | |
download | mariadb-git-3640843a8b9dcf6255a40286c1d47a67479dfc1d.tar.gz |
A fix and test case for bug#5399 "Wrong statement executed by MySQL
server" (use my_charset_bin for stmt id hash).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index b124fba3f59..0f9d1dba4a7 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10163,6 +10163,52 @@ static void test_bug4231() myquery(rc); } + +static void test_bug5399() +{ + /* + Ascii 97 is 'a', which gets mapped to Ascii 65 'A' unless internal + statement id hash in the server uses binary collation. + */ +#define NUM_OF_USED_STMT 97 + MYSQL_STMT *stmt[NUM_OF_USED_STMT]; + MYSQL_BIND bind[1]; + char buff[500]; + int rc, i; + int32 no; + + myheader("test_bug5399"); + + bzero(bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= &no; + + for (i= 0; i < NUM_OF_USED_STMT; ++i) + { + stmt[i]= mysql_stmt_init(mysql); + sprintf(buff, "select %d", i); + rc= mysql_stmt_prepare(stmt[i], buff, strlen(buff)); + check_execute(stmt[i], rc); + mysql_stmt_bind_result(stmt[i], bind); + } + printf("%d statements prepared.\n", NUM_OF_USED_STMT); + + for (i= 0; i < NUM_OF_USED_STMT; ++i) + { + rc= mysql_stmt_execute(stmt[i]); + check_execute(stmt[i], rc); + rc= mysql_stmt_store_result(stmt[i]); + check_execute(stmt[i], rc); + rc= mysql_stmt_fetch(stmt[i]); + assert(rc == 0); + assert((int32) i == no); + } + + for (i= 0; i < NUM_OF_USED_STMT; ++i) + mysql_stmt_close(stmt[i]); +#undef NUM_OF_USED_STMT +} + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10463,6 +10509,8 @@ int main(int argc, char **argv) test_bug5126(); /* support for mediumint type in libmysql */ test_bug4231(); /* proper handling of all-zero times and dates in the server */ + test_bug5399(); /* check that statement id uniquely identifies + statement */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. |