diff options
author | unknown <georg@lmy002.wdf.sap.corp> | 2005-07-15 14:30:47 +0200 |
---|---|---|
committer | unknown <georg@lmy002.wdf.sap.corp> | 2005-07-15 14:30:47 +0200 |
commit | 6fcb9c8e8043a2c8687324aee3cb9b88281ac51d (patch) | |
tree | 105f8ecab5c2f4717252c2106add0e090806c17a /tests | |
parent | ba7d8ad734f84c032d2352ecb05f5937855217b3 (diff) | |
download | mariadb-git-6fcb9c8e8043a2c8687324aee3cb9b88281ac51d.tar.gz |
Fix for bug #11037.
When all rows are fetched subsequent calls to mysql_stmt_fetch return
now MYSQL_NO_DATA instead of errorcode 1.
libmysql/libmysql.c:
fix for bug#11037
tests/mysql_client_test.c:
added new testcase for bug #11037
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a056814a153..010f467c4ad 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -13315,7 +13315,7 @@ static void test_bug9992() DIE_UNLESS(rc == 1); /* Got errors, as expected */ if (!opt_silent) - fprintf(stdout, "Got error, sa expected:\n [%d] %s\n", + fprintf(stdout, "Got error, as expected:\n [%d] %s\n", mysql_errno(mysql1), mysql_error(mysql1)); mysql_close(mysql1); @@ -13705,6 +13705,51 @@ static void test_bug11183() myquery(rc); } +static void test_bug11037() +{ + MYSQL_STMT *stmt; + int rc; + const char *stmt_text; + + myheader("test_bug11037"); + + mysql_query(mysql, "drop table if exists t1"); + + rc= mysql_query(mysql, "create table t1 (id int not null)"); + myquery(rc); + + rc= mysql_query(mysql, "insert into t1 values (1)"); + myquery(rc); + + stmt_text= "select id FROM t1"; + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + + /* expected error */ + rc = mysql_stmt_fetch(stmt); + DIE_UNLESS(rc==1); + if (!opt_silent) + fprintf(stdout, "Got error, as expected:\n [%d] %s\n", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + + rc = mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc = mysql_stmt_fetch(stmt); + DIE_UNLESS(rc==0); + + rc = mysql_stmt_fetch(stmt); + DIE_UNLESS(rc==MYSQL_NO_DATA); + + rc = mysql_stmt_fetch(stmt); + DIE_UNLESS(rc==MYSQL_NO_DATA); + + mysql_stmt_close(stmt); + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -13948,6 +13993,7 @@ static struct my_tests_st my_tests[]= { { "test_bug10214", test_bug10214 }, { "test_bug9735", test_bug9735 }, { "test_bug11183", test_bug11183 }, + { "test_bug11037", test_bug11037 }, { 0, 0 } }; |