summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorunknown <kostja@bodhi.local>2006-12-01 13:25:06 +0300
committerunknown <kostja@bodhi.local>2006-12-01 13:25:06 +0300
commitfe84b016e1fd62d92c9f13a1e21784ea8cb200cd (patch)
treef5e6ea500cc0b8162cc8b977ac2c888fceea2f6d /tests
parent4ec847218dca3fa31d6b7d61fffdf71c444c1c74 (diff)
downloadmariadb-git-fe84b016e1fd62d92c9f13a1e21784ea8cb200cd.tar.gz
A fix and a test case for Bug#24179 "select b into $var" fails with
--cursor_protocol": fix a misleading error message in case of SELECT .. INTO. sql/sql_class.cc: Implement select_result::check_simple_select hierarchy to support correct error messages in case of SELECT .. INTO and C API cursors. sql/sql_class.h: Set the error message inside the function that checks for the error condition (simple_select, renamed to check_simple_select). sql/sql_prepare.cc: Use a new method that now sets the error. tests/mysql_client_test.c: Add a test case for Bug#24179 "select b into $var" fails with --cursor_protocol" (check for the right error message and error code).
Diffstat (limited to 'tests')
-rw-r--r--tests/mysql_client_test.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index c596a589d55..0b8d4d81558 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -15456,6 +15456,33 @@ static void test_bug21635()
DBUG_VOID_RETURN;
}
+/*
+ Bug#24179 "select b into $var" fails with --cursor_protocol"
+ The failure is correct, check that the returned message is meaningful.
+*/
+
+static void test_bug24179()
+{
+ int rc;
+ MYSQL_STMT *stmt;
+
+ DBUG_ENTER("test_bug24179");
+ myheader("test_bug24179");
+
+ stmt= open_cursor("select 1 into @a");
+ rc= mysql_stmt_execute(stmt);
+ DIE_UNLESS(rc);
+ if (!opt_silent)
+ {
+ printf("Got error (as expected): %d %s\n",
+ mysql_stmt_errno(stmt),
+ mysql_stmt_error(stmt));
+ }
+ DIE_UNLESS(mysql_stmt_errno(stmt) == 1323);
+
+ DBUG_VOID_RETURN;
+}
+
/*
Read and parse arguments and MySQL options from my.cnf
@@ -15735,6 +15762,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug21726", test_bug21726 },
{ "test_bug23383", test_bug23383 },
{ "test_bug21635", test_bug21635 },
+ { "test_bug24179", test_bug24179 },
{ 0, 0 }
};