Commit 1912eaac authored by Davi Arnaut's avatar Davi Arnaut

Bug#38486: Crash when using cursor protocol

Post-merge fix: mysql_client_test.c is compiled by C compilers
and some C compilers don't support mixed declarations and code
and it's explicitly forbidden by ISO C90.

tests/mysql_client_test.c:
  Don't mix declarations and code.
parent 2f3b8603
...@@ -16196,25 +16196,28 @@ static void test_bug32265() ...@@ -16196,25 +16196,28 @@ static void test_bug32265()
static void test_bug38486(void) static void test_bug38486(void)
{ {
MYSQL_STMT *stmt;
const char *stmt_text;
unsigned long type= CURSOR_TYPE_READ_ONLY;
DBUG_ENTER("test_bug38486");
myheader("test_bug38486"); myheader("test_bug38486");
MYSQL_STMT *stmt;
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
unsigned long type= CURSOR_TYPE_READ_ONLY;
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
const char *sql= "CREATE TABLE t1 (a INT)"; stmt_text= "CREATE TABLE t1 (a INT)";
mysql_stmt_prepare(stmt,sql,strlen(sql)); mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
mysql_stmt_execute(stmt); mysql_stmt_execute(stmt);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
stmt= mysql_stmt_init(mysql); stmt= mysql_stmt_init(mysql);
mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type); mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
const char *sql2= "INSERT INTO t1 VALUES (1)"; stmt_text= "INSERT INTO t1 VALUES (1)";
mysql_stmt_prepare(stmt,sql2,strlen(sql2)); mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
mysql_stmt_execute(stmt); mysql_stmt_execute(stmt);
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
DBUG_VOID_RETURN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment