diff options
author | konstantin@mysql.com <> | 2004-09-22 15:50:07 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2004-09-22 15:50:07 +0400 |
commit | 36548b10ca2d796c46436ab445569f6e0476ecaf (patch) | |
tree | e9e451c78db8c48bfcfbf6943d785f85d1b8a6f8 /tests | |
parent | e7a70ed162f6b208ead1fa93824592f242b015bc (diff) | |
download | mariadb-git-36548b10ca2d796c46436ab445569f6e0476ecaf.tar.gz |
A fix and test case for Bug#5315 "mysql_change_user() doesn't free
prepared statements."
Diffstat (limited to 'tests')
-rw-r--r-- | tests/client_test.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/client_test.c b/tests/client_test.c index 0a4d635984d..accefb668a8 100644 --- a/tests/client_test.c +++ b/tests/client_test.c @@ -10391,6 +10391,34 @@ static void test_bug5194() } +static void test_bug5315() +{ + MYSQL_STMT *stmt; + const char *stmt_text; + int rc; + + myheader("test_bug5315"); + + stmt_text= "SELECT 1"; + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + DBUG_ASSERT(rc == 0); + mysql_change_user(mysql, opt_user, opt_password, current_db); + rc= mysql_stmt_execute(stmt); + DBUG_ASSERT(rc != 0); + if (rc) + printf("Got error (as expected):\n%s", mysql_stmt_error(stmt)); + /* check that connection is OK */ + mysql_stmt_close(stmt); + stmt= mysql_stmt_init(mysql); + rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); + DBUG_ASSERT(rc == 0); + rc= mysql_stmt_execute(stmt); + DBUG_ASSERT(rc == 0); + mysql_stmt_close(stmt); +} + + /* Read and parse arguments and MySQL options from my.cnf */ @@ -10694,6 +10722,8 @@ int main(int argc, char **argv) test_bug5399(); /* check that statement id uniquely identifies statement */ test_bug5194(); /* bulk inserts in prepared mode */ + test_bug5315(); /* check that mysql_change_user closes all + prepared statements */ /* XXX: PLEASE RUN THIS PROGRAM UNDER VALGRIND AND VERIFY THAT YOUR TEST DOESN'T CONTAIN WARNINGS/ERRORS BEFORE YOU PUSH. |