summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authordlenev@brandersnatch.localdomain <>2004-10-17 13:59:46 +0400
committerdlenev@brandersnatch.localdomain <>2004-10-17 13:59:46 +0400
commitb7a957d127181b07152504d302c2feb1e7366155 (patch)
tree5ec1a93fcd42b6ff1479a53ae7cc73d7813ac938 /tests
parent3c49aa7cfa77b42ac22b43ce6bcb49db95725117 (diff)
downloadmariadb-git-b7a957d127181b07152504d302c2feb1e7366155.tar.gz
Fix for bug #6081 "Call to deprecated mysql_create_db() function crashes
server". Altough mysql_create_db()/mysql_drop_db() API calls are deprecated since 4.0, they should not crash server and should not stall connection in case of errors.
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index 0b30cc3386d..a8d63d2ed86 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -10542,6 +10542,33 @@ static void test_bug5315()
/*
+ Altough mysql_create_db(), mysql_rm_db() are deprecated since 4.0 they
+ should not crash server and should not hang in case of errors.
+
+ Since those functions can't be seen in modern API (unless client library
+ was compiled with USE_OLD_FUNCTIONS define) we use simple_command() macro.
+*/
+static void test_bug6081()
+{
+ int rc;
+ myheader("test_bug6081");
+
+ rc= simple_command(mysql, COM_DROP_DB, current_db,
+ (ulong)strlen(current_db), 0);
+ myquery(rc);
+ rc= simple_command(mysql, COM_DROP_DB, current_db,
+ (ulong)strlen(current_db), 0);
+ myquery_r(rc);
+ rc= simple_command(mysql, COM_CREATE_DB, current_db,
+ (ulong)strlen(current_db), 0);
+ myquery(rc);
+ rc= simple_command(mysql, COM_CREATE_DB, current_db,
+ (ulong)strlen(current_db), 0);
+ myquery_r(rc);
+}
+
+
+/*
Read and parse arguments and MySQL options from my.cnf
*/
@@ -10851,6 +10878,7 @@ int main(int argc, char **argv)
test_bug5194(); /* bulk inserts in prepared mode */
test_bug5315(); /* check that mysql_change_user closes all
prepared statements */
+ test_bug6081(); /* test of mysql_create_db()/mysql_rm_db() */
/*
XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST
DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH.