summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-11 12:27:53 +0400
committerAlexey Kopytov <Alexey.Kopytov@Sun.com>2010-05-11 12:27:53 +0400
commitd9a5541a34f273c390f088504dc41daf6cdfaa0a (patch)
treea082c9a70425283b10f95421a2d3c2f680aa939c /tests
parentcb421d43cdc0eaa5f342ac3c75c1a4c4a4156f6c (diff)
parent6d0425b18df7468036a1bbf6d781d624a28e2fb3 (diff)
downloadmariadb-git-d9a5541a34f273c390f088504dc41daf6cdfaa0a.tar.gz
Manual merge from mysql-5.1-bugteam to mysql-trunk-merge.
Conflicts: Text conflict in tests/mysql_client_test.c
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c82
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 82f5af19e14..b518b617535 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18979,6 +18979,87 @@ static void test_bug53371()
}
+
+/**
+ Bug#42373: libmysql can mess a connection at connect
+*/
+static void test_bug42373()
+{
+ int rc;
+ MYSQL con;
+ MYSQL_STMT *stmt;
+
+ DBUG_ENTER("test_bug42373");
+ myheader("test_42373");
+
+ rc= mysql_query(mysql, "DROP PROCEDURE IF EXISTS p1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE PROCEDURE p1()"
+ " BEGIN"
+ " SELECT 1;"
+ " INSERT INTO t1 VALUES (2);"
+ "END;");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)");
+ myquery(rc);
+
+ /* Try with a stored procedure. */
+ DIE_UNLESS(mysql_client_init(&con));
+
+ mysql_options(&con, MYSQL_INIT_COMMAND, "CALL p1()");
+
+ DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
+ current_db, opt_port, opt_unix_socket,
+ CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
+
+ stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= my_process_stmt_result(stmt);
+ DIE_UNLESS(rc == 1);
+
+ mysql_stmt_close(stmt);
+
+ /* Now try with a multi-statement. */
+ DIE_UNLESS(mysql_client_init(&con));
+
+ mysql_options(&con, MYSQL_INIT_COMMAND,
+ "SELECT 3; INSERT INTO t1 VALUES (4)");
+
+ DIE_UNLESS(mysql_real_connect(&con, opt_host, opt_user, opt_password,
+ current_db, opt_port, opt_unix_socket,
+ CLIENT_MULTI_STATEMENTS|CLIENT_MULTI_RESULTS));
+
+ stmt= mysql_simple_prepare(&con, "SELECT a FROM t1");
+ check_stmt(stmt);
+
+ rc= mysql_stmt_execute(stmt);
+ check_execute(stmt, rc);
+
+ rc= my_process_stmt_result(stmt);
+ DIE_UNLESS(rc == 2);
+
+ mysql_stmt_close(stmt);
+ mysql_close(&con);
+
+ rc= mysql_query(mysql, "DROP TABLE t1");
+ myquery(rc);
+
+ rc= mysql_query(mysql, "DROP PROCEDURE p1");
+ myquery(rc);
+
+ DBUG_VOID_RETURN;
+}
+
+
/*
Bug#49972: Crash in prepared statements.
@@ -19419,6 +19500,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug41078", test_bug41078 },
{ "test_bug44495", test_bug44495 },
{ "test_bug49972", test_bug49972 },
+ { "test_bug42373", test_bug42373 },
{ 0, 0 }
};