summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <sergefp@mysql.com>2004-04-27 03:44:41 +0400
committerunknown <sergefp@mysql.com>2004-04-27 03:44:41 +0400
commit978ba8f47ef6adf41c5a9eb75cc927c3aa1b8e69 (patch)
treee26205820dce9563bbb1bde4b6d57634a9e288cf /tests
parentc41919f3583aa40645cc10571718b39091980c25 (diff)
downloadmariadb-git-978ba8f47ef6adf41c5a9eb75cc927c3aa1b8e69.tar.gz
Fix for BUG#3567: Disallow several SQL statements inside a Prepared Statement.
Diffstat (limited to 'tests')
-rw-r--r--tests/client_test.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c
index 5e82baaaf53..000b55a202e 100644
--- a/tests/client_test.c
+++ b/tests/client_test.c
@@ -4940,6 +4940,34 @@ DROP TABLE IF EXISTS test_multi_tab";
mysql_close(mysql_local);
}
+/********************************************************
+* Check that Prepared statement cannot contain several *
+* SQL statements *
+*********************************************************/
+static void test_prepare_multi_statements()
+{
+ MYSQL *mysql_local;
+ MYSQL_STMT *stmt;
+ myheader("test_prepare_multi_statements");
+
+ if (!(mysql_local = mysql_init(NULL)))
+ {
+ fprintf(stdout,"\n mysql_init() failed");
+ exit(1);
+ }
+
+ if (!(mysql_real_connect(mysql_local,opt_host,opt_user,
+ opt_password, current_db, opt_port,
+ opt_unix_socket, CLIENT_MULTI_STATEMENTS)))
+ {
+ fprintf(stdout,"\n connection failed(%s)", mysql_error(mysql_local));
+ exit(1);
+ }
+ strmov(query, "select 1; select 'another value'");
+ stmt = mysql_simple_prepare(mysql_local,query);
+ mystmt_init_r(stmt);
+ mysql_close(mysql_local);
+}
/********************************************************
* to test simple bind store result *
@@ -9210,6 +9238,8 @@ int main(int argc, char **argv)
test_prepare_field_result(); /* prepare meta info */
test_multi_stmt(); /* multi stmt test */
test_multi_statements();/* test multi statement execution */
+ test_prepare_multi_statements(); /* check that multi statements are
+ disabled in PS */
test_store_result(); /* test the store_result */
test_store_result1(); /* test store result without buffers */
test_store_result2(); /* test store result for misc case */