diff options
author | unknown <konstantin@mysql.com> | 2005-11-18 17:55:52 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-11-18 17:55:52 +0300 |
commit | fe94b6bfb3f39514d6b7db9333febf34ed8279ab (patch) | |
tree | 539d1753089423ad7ea909f2c9d43ef74b0a7096 /tests | |
parent | 27b4c2a5e9d0997d5bcb91a5eed96c54625dd45c (diff) | |
download | mariadb-git-fe94b6bfb3f39514d6b7db9333febf34ed8279ab.tar.gz |
A test case for Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA
when COUNT(*) is 0". The bug itself cannot be repeated.
mysql-test/r/sp.result:
Test results were fixed (Bug#14845)
mysql-test/t/sp.test:
An SQL language test case for Bug#14845
tests/mysql_client_test.c:
A test case for Bug#14845
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e0f3fd91e5c..ce732690700 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -14546,6 +14546,49 @@ static void test_bug13524() myquery(rc); } +/* + Bug#14845 "mysql_stmt_fetch returns MYSQL_NO_DATA when COUNT(*) is 0" +*/ + +static void test_bug14845() +{ + MYSQL_STMT *stmt; + int rc; + const ulong type= CURSOR_TYPE_READ_ONLY; + const char *query= "select count(*) from t1 where 1 = 0"; + + myheader("test_bug14845"); + + rc= mysql_query(mysql, "drop table if exists t1"); + myquery(rc); + rc= mysql_query(mysql, "create table t1 (id int(11) default null, " + "name varchar(20) default null)" + "engine=MyISAM DEFAULT CHARSET=utf8"); + myquery(rc); + rc= mysql_query(mysql, "insert into t1 values (1,'abc'),(2,'def')"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (const void*) &type); + check_execute(stmt, rc); + + rc= mysql_stmt_prepare(stmt, query, strlen(query)); + check_execute(stmt, rc); + + 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); + + /* Cleanup */ + mysql_stmt_close(stmt); + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} /* Read and parse arguments and MySQL options from my.cnf @@ -14805,6 +14848,7 @@ static struct my_tests_st my_tests[]= { { "test_bug14210", test_bug14210 }, { "test_bug13488", test_bug13488 }, { "test_bug13524", test_bug13524 }, + { "test_bug14845", test_bug14845 }, { 0, 0 } }; |