diff options
author | unknown <konstantin@oak.local> | 2003-11-25 17:41:12 +0300 |
---|---|---|
committer | unknown <konstantin@oak.local> | 2003-11-25 17:41:12 +0300 |
commit | aef0b9a7c77ea1ca3feafa486575bf564b1d4ce7 (patch) | |
tree | 26ddd4f0fd18c242718e53bbc257355e751c6a0a /tests/client_test.c | |
parent | 7d6479cc2800b4ae4ed504feecfee69b2f2a56ec (diff) | |
download | mariadb-git-aef0b9a7c77ea1ca3feafa486575bf564b1d4ce7.tar.gz |
fix for bug #1946:
"You can always mysql_real_query a query with placeholders
after mysql_prepare()"
sql/sql_class.cc:
prepare_command removed
sql/sql_class.h:
prepare_command removed
sql/sql_prepare.cc:
prepare_command removed
sql/sql_yacc.yy:
prepare_command removed
tests/client_test.c:
added test for bug #1946: "You can always
mysql_real_query a query with placeholders after mysql_prepare()"
Diffstat (limited to 'tests/client_test.c')
-rw-r--r-- | tests/client_test.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 637f6c4ede1..d2d77c9965c 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -8065,6 +8065,32 @@ static void test_bug1500() mysql_stmt_close(stmt); } +static void test_bug1946() +{ + MYSQL_STMT *stmt; + int rc; + + myheader("test_bug1946"); + const char *query= "INSERT INTO prepare_command VALUES (?)"; + + rc = mysql_query(mysql, "DROP TABLE IF EXISTS prepare_command"); + myquery(rc); + + rc= mysql_query(mysql,"CREATE TABLE prepare_command(ID INT)"); + myquery(rc); + + stmt = mysql_prepare(mysql, query, strlen(query)); + mystmt_init(stmt); + rc= mysql_real_query(mysql, query, strlen(query)); + assert(rc != 0); + fprintf(stdout, "Got error (as expected):\n"); + myerror(NULL); + + mysql_stmt_close(stmt); + rc= mysql_query(mysql,"DROP TABLE prepare_command"); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -8208,6 +8234,8 @@ int main(int argc, char **argv) /* Used for internal new development debugging */ test_drop_temp(); /* to test DROP TEMPORARY TABLE Access checks */ #endif + test_bug1946(); /* test that placeholders are allowed only in + prepared queries */ test_fetch_seek(); /* to test stmt seek() functions */ test_fetch_nobuffs(); /* to fecth without prior bound buffers */ test_open_direct(); /* direct execution in the middle of open stmts */ |