diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/mysql_client_test.c | 123 | ||||
-rw-r--r-- | tests/thread_test.c | 2 |
2 files changed, 112 insertions, 13 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index e2721415092..866c63ae1d3 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -2117,7 +2117,7 @@ static void test_prepare_field_result() myquery(rc); rc= mysql_query(mysql, "CREATE TABLE test_prepare_field_result(int_c int, " - "var_c varchar(50), ts_c timestamp(14), " + "var_c varchar(50), ts_c timestamp, " "char_c char(4), date_c date, extra tinyint)"); myquery(rc); @@ -4878,11 +4878,11 @@ static void test_fetch_date() myquery(rc); rc= mysql_query(mysql, "CREATE TABLE test_bind_result(c1 date, c2 time, \ - c3 timestamp(14), \ + c3 timestamp, \ c4 year, \ c5 datetime, \ - c6 timestamp(4), \ - c7 timestamp(6))"); + c6 timestamp, \ + c7 timestamp)"); myquery(rc); rc= mysql_query(mysql, "SET SQL_MODE=''"); @@ -5196,7 +5196,7 @@ static void test_prepare_ext() " c12 numeric(8, 4)," " c13 date," " c14 datetime," - " c15 timestamp(14)," + " c15 timestamp," " c16 time," " c17 year," " c18 bit," @@ -6230,7 +6230,7 @@ static void test_manual_sample() } if (mysql_query(mysql, "CREATE TABLE test_table(col1 int, col2 varchar(50), \ col3 smallint, \ - col4 timestamp(14))")) + col4 timestamp)")) { fprintf(stderr, "\n create table failed"); fprintf(stderr, "\n %s", mysql_error(mysql)); @@ -7140,7 +7140,7 @@ static void test_date() rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(14), \ + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP, \ c2 TIME, \ c3 DATETIME, \ c4 DATE)"); @@ -7206,10 +7206,10 @@ static void test_date_ts() rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_date"); myquery(rc); - rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP(10), \ - c2 TIMESTAMP(14), \ + rc= mysql_query(mysql, "CREATE TABLE test_date(c1 TIMESTAMP, \ + c2 TIMESTAMP, \ c3 TIMESTAMP, \ - c4 TIMESTAMP(6))"); + c4 TIMESTAMP)"); myquery(rc); @@ -8897,7 +8897,7 @@ static void test_fetch_seek() myquery(rc); - rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp(14))"); + rc= mysql_query(mysql, "create table t1(c1 int primary key auto_increment, c2 char(10), c3 timestamp)"); myquery(rc); rc= mysql_query(mysql, "insert into t1(c2) values('venu'), ('mysql'), ('open'), ('source')"); @@ -18392,9 +18392,104 @@ static void test_wl4166_4() } /** - Bug#38486 Crash when using cursor protocol + Bug#36004 mysql_stmt_prepare resets the list of warnings */ +static void test_bug36004() +{ + int rc, warning_count= 0; + MYSQL_STMT *stmt; + + DBUG_ENTER("test_bug36004"); + myheader("test_bug36004"); + + rc= mysql_query(mysql, "drop table if exists inexistant"); + myquery(rc); + + DIE_UNLESS(mysql_warning_count(mysql) == 1); + query_int_variable(mysql, "@@warning_count", &warning_count); + DIE_UNLESS(warning_count); + + stmt= mysql_simple_prepare(mysql, "select 1"); + check_stmt(stmt); + + DIE_UNLESS(mysql_warning_count(mysql) == 0); + query_int_variable(mysql, "@@warning_count", &warning_count); + DIE_UNLESS(warning_count); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + DIE_UNLESS(mysql_warning_count(mysql) == 0); + mysql_stmt_close(stmt); + + query_int_variable(mysql, "@@warning_count", &warning_count); + DIE_UNLESS(warning_count); + + stmt= mysql_simple_prepare(mysql, "drop table if exists inexistant"); + check_stmt(stmt); + + query_int_variable(mysql, "@@warning_count", &warning_count); + DIE_UNLESS(warning_count == 0); + mysql_stmt_close(stmt); + + 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) { MYSQL_STMT *stmt; @@ -18542,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; } @@ -19154,6 +19251,8 @@ static struct my_tests_st my_tests[]= { { "test_wl4166_2", test_wl4166_2 }, { "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 }, diff --git a/tests/thread_test.c b/tests/thread_test.c index 5b76eeff2f7..def133f4a3f 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -77,7 +77,7 @@ end: mysql_close(mysql); pthread_mutex_lock(&LOCK_thread_count); thread_count--; - VOID(pthread_cond_signal(&COND_thread_count)); /* Tell main we are ready */ + pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ pthread_mutex_unlock(&LOCK_thread_count); pthread_exit(0); return 0; |