diff options
author | Daniel Fischer <df@sun.com> | 2010-04-21 14:58:09 +0200 |
---|---|---|
committer | Daniel Fischer <df@sun.com> | 2010-04-21 14:58:09 +0200 |
commit | 6b26a262432445947c8db52df03e55db46961532 (patch) | |
tree | 4fad82e285f056995b626f0a62b5fa0488294c19 /tests | |
parent | e2c67fb4312ff69a54403c5581e0bcd33909ef68 (diff) | |
parent | 5e8fbb2e21d3dbef9244425cbbdcb9be53f10280 (diff) | |
download | mariadb-git-6b26a262432445947c8db52df03e55db46961532.tar.gz |
Merge
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/big_record.pl | 2 | ||||
-rw-r--r-- | tests/myisam-big-rows.tst | 2 | ||||
-rw-r--r-- | tests/mysql_client_test.c | 168 |
3 files changed, 169 insertions, 3 deletions
diff --git a/tests/big_record.pl b/tests/big_record.pl index fbe94e3540f..cd80488581a 100755 --- a/tests/big_record.pl +++ b/tests/big_record.pl @@ -2,7 +2,7 @@ # This is a test with stores big records in a blob. # Note that for the default test the mysql server should have been -# started with at least 'mysqld -O max_allowed_packet=30M' and you should have +# started with at least 'mysqld --max_allowed_packet=30M' and you should have # at least 256M memory in your computer. use DBI; diff --git a/tests/myisam-big-rows.tst b/tests/myisam-big-rows.tst index 56c06f4820f..97147999f87 100644 --- a/tests/myisam-big-rows.tst +++ b/tests/myisam-big-rows.tst @@ -1,7 +1,7 @@ # # Test rows with length above > 16M # Note that for this to work, you should start mysqld with -# -O max_allowed_packet=32M +# --max_allowed_packet=32M # drop table if exists t1; diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e9c70257e01..8112a2a3c0d 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -5673,7 +5673,7 @@ static void test_stmt_close() } -/* Test simple set-variable prepare */ +/* Test simple set variable prepare */ static void test_set_variable() { @@ -18436,6 +18436,59 @@ static void test_bug36004() DBUG_VOID_RETURN; } +/** + Test that COM_REFRESH issues a implicit commit. +*/ + +static void test_wl4284_1() +{ + int rc; + MYSQL_ROW row; + MYSQL_RES *result; + + DBUG_ENTER("test_wl4284_1"); + myheader("test_wl4284_1"); + + /* set AUTOCOMMIT to OFF */ + rc= mysql_autocommit(mysql, FALSE); + myquery(rc); + + rc= mysql_query(mysql, "DROP TABLE IF EXISTS trans"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE trans (a INT) ENGINE= InnoDB"); + myquery(rc); + + rc= mysql_query(mysql, "INSERT INTO trans VALUES(1)"); + myquery(rc); + + rc= mysql_refresh(mysql, REFRESH_GRANT | REFRESH_TABLES); + myquery(rc); + + rc= mysql_rollback(mysql); + myquery(rc); + + rc= mysql_query(mysql, "SELECT * FROM trans"); + myquery(rc); + + result= mysql_use_result(mysql); + mytest(result); + + row= mysql_fetch_row(result); + mytest(row); + + mysql_free_result(result); + + /* set AUTOCOMMIT to ON */ + rc= mysql_autocommit(mysql, TRUE); + myquery(rc); + + rc= mysql_query(mysql, "DROP TABLE trans"); + myquery(rc); + + DBUG_VOID_RETURN; +} + static void test_bug38486(void) { @@ -18584,6 +18637,8 @@ static void test_bug40365(void) DIE_UNLESS(tm[i].day == 0); } mysql_stmt_close(stmt); + rc= mysql_commit(mysql); + myquery(rc); DBUG_VOID_RETURN; } @@ -18881,6 +18936,115 @@ static void test_bug44495() } /* + Bug#49972: Crash in prepared statements. + + The following case lead to a server crash: + - Use binary protocol; + - Prepare a statement with OUT-parameter; + - Execute the statement; + - Cause re-prepare of the statement (change dependencies); + - Execute the statement again -- crash here. +*/ + +static void test_bug49972() +{ + int rc; + MYSQL_STMT *stmt; + + MYSQL_BIND in_param_bind; + MYSQL_BIND out_param_bind; + int int_data; + my_bool is_null; + + DBUG_ENTER("test_bug49972"); + myheader("test_49972"); + + rc= mysql_query(mysql, "DROP FUNCTION IF EXISTS f1"); + myquery(rc); + + rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE FUNCTION f1() RETURNS INT RETURN 1"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE PROCEDURE p1(IN a INT, OUT b INT) SET b = a"); + myquery(rc); + + stmt= mysql_simple_prepare(mysql, "CALL p1((SELECT f1()), ?)"); + check_stmt(stmt); + + bzero((char *) &in_param_bind, sizeof (in_param_bind)); + + in_param_bind.buffer_type= MYSQL_TYPE_LONG; + in_param_bind.buffer= (char *) &int_data; + in_param_bind.length= 0; + in_param_bind.is_null= 0; + + rc= mysql_stmt_bind_param(stmt, &in_param_bind); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + { + bzero(&out_param_bind, sizeof (out_param_bind)); + + out_param_bind.buffer_type= MYSQL_TYPE_LONG; + out_param_bind.is_null= &is_null; + out_param_bind.buffer= &int_data; + out_param_bind.buffer_length= sizeof (int_data); + + rc= mysql_stmt_bind_result(stmt, &out_param_bind); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + rc= mysql_stmt_fetch(stmt); + DBUG_ASSERT(rc == MYSQL_NO_DATA); + + mysql_stmt_next_result(stmt); + mysql_stmt_fetch(stmt); + } + + rc= mysql_query(mysql, "DROP FUNCTION f1"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE FUNCTION f1() RETURNS INT RETURN 1"); + myquery(rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + { + bzero(&out_param_bind, sizeof (out_param_bind)); + + out_param_bind.buffer_type= MYSQL_TYPE_LONG; + out_param_bind.is_null= &is_null; + out_param_bind.buffer= &int_data; + out_param_bind.buffer_length= sizeof (int_data); + + rc= mysql_stmt_bind_result(stmt, &out_param_bind); + check_execute(stmt, rc); + + rc= mysql_stmt_fetch(stmt); + rc= mysql_stmt_fetch(stmt); + DBUG_ASSERT(rc == MYSQL_NO_DATA); + + mysql_stmt_next_result(stmt); + mysql_stmt_fetch(stmt); + } + + mysql_stmt_close(stmt); + + rc= mysql_query(mysql, "DROP PROCEDURE p1"); + myquery(rc); + + rc= mysql_query(mysql, "DROP FUNCTION f1"); + myquery(rc); + + DBUG_VOID_RETURN; +} + +/* Read and parse arguments and MySQL options from my.cnf */ @@ -19197,6 +19361,7 @@ static struct my_tests_st my_tests[]= { { "test_wl4166_3", test_wl4166_3 }, { "test_wl4166_4", test_wl4166_4 }, { "test_bug36004", test_bug36004 }, + { "test_wl4284_1", test_wl4284_1 }, { "test_wl4435", test_wl4435 }, { "test_wl4435_2", test_wl4435_2 }, { "test_bug38486", test_bug38486 }, @@ -19208,6 +19373,7 @@ static struct my_tests_st my_tests[]= { #endif { "test_bug41078", test_bug41078 }, { "test_bug44495", test_bug44495 }, + { "test_bug49972", test_bug49972 }, { 0, 0 } }; |