diff options
author | unknown <konstantin@mysql.com> | 2005-05-16 18:29:04 +0400 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2005-05-16 18:29:04 +0400 |
commit | 1c1cc00a8ae4e18282fc7a43acc7a2bc027d7992 (patch) | |
tree | 8b23eb851e490da3bd74c4cb891111c083cb651f /tests | |
parent | b9a4e7d88eabba5b7463da899d1a72a264a84093 (diff) | |
parent | 1bb1bc69935a234fcb72088e1065712ac59f475b (diff) | |
download | mariadb-git-1c1cc00a8ae4e18282fc7a43acc7a2bc027d7992.tar.gz |
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/opt/local/work/mysql-5.0-9643
include/mysql.h:
Auto merged
libmysql/libmysql.c:
Auto merged
tests/mysql_client_test.c:
Auto merged
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 3cfed31c750..08ea5f1c1c9 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -13079,6 +13079,68 @@ static void test_bug9478() /* + Error message is returned for unsupported features. + Test also cursors with non-default PREFETCH_ROWS +*/ + +static void test_bug9643() +{ + MYSQL_STMT *stmt; + MYSQL_BIND bind[1]; + int32 a; + int rc; + const char *stmt_text; + int num_rows= 0; + ulong type; + ulong prefetch_rows= 5; + + myheader("test_bug9643"); + + mysql_query(mysql, "drop table if exists t1"); + mysql_query(mysql, "create table t1 (id integer not null primary key)"); + rc= mysql_query(mysql, "insert into t1 (id) values " + " (1), (2), (3), (4), (5), (6), (7), (8), (9)"); + myquery(rc); + + stmt= mysql_stmt_init(mysql); + /* Not implemented in 5.0 */ + type= (ulong) CURSOR_TYPE_SCROLLABLE; + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type); + DIE_UNLESS(rc); + if (! opt_silent) + printf("Got error (as expected): %s\n", mysql_stmt_error(stmt)); + + type= (ulong) CURSOR_TYPE_READ_ONLY; + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type); + check_execute(stmt, rc); + rc= mysql_stmt_attr_set(stmt, STMT_ATTR_PREFETCH_ROWS, + (void*) &prefetch_rows); + check_execute(stmt, rc); + stmt_text= "select * from t1"; + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + check_execute(stmt, rc); + + bzero(bind, sizeof(bind)); + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= (void*) &a; + bind[0].buffer_length= sizeof(a); + mysql_stmt_bind_result(stmt, bind); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + while ((rc= mysql_stmt_fetch(stmt)) == 0) + ++num_rows; + DIE_UNLESS(num_rows == 9); + + rc= mysql_stmt_close(stmt); + DIE_UNLESS(rc == 0); + + rc= mysql_query(mysql, "drop table t1"); + myquery(rc); +} + +/* Read and parse arguments and MySQL options from my.cnf */ @@ -13309,6 +13371,7 @@ static struct my_tests_st my_tests[]= { { "test_bug9159", test_bug9159 }, { "test_bug9520", test_bug9520 }, { "test_bug9478", test_bug9478 }, + { "test_bug9643", test_bug9643 }, { 0, 0 } }; |