From df2695495188b0c3459eabb40c8e390f56cddb27 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 26 Jan 2016 16:00:59 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. The metadata creation part of the mysqld_shww_create separated to be used on the mysqld_stmt_prepare stage. --- tests/mysql_client_test.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index a1a52e832dd..b14b4f4dab9 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -422,6 +422,15 @@ static void test_prepare_simple() mysql_stmt_close(stmt); + /* show create */ + strmov(query, "SHOW CREATE TABLE test_prepare_simple"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + + DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); + + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); -- cgit v1.2.1 From f3926cd18e2ba64f2643c6c4f6a981ed99868895 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Jan 2016 12:01:55 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. Fix for SHOW CREATE DATABASE. --- tests/mysql_client_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index b14b4f4dab9..3d46a720cf7 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -426,9 +426,14 @@ static void test_prepare_simple() strmov(query, "SHOW CREATE TABLE test_prepare_simple"); stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); - DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); + mysql_stmt_close(stmt); + /* show create database */ + strmov(query, "SHOW CREATE DATABASE test"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); mysql_stmt_close(stmt); /* now fetch the results ..*/ -- cgit v1.2.1 From 552d33095a25f6e1f9af802e71713b0bec0f6acb Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Jan 2016 12:39:27 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. Fix for SHOW GRANTS statement. --- tests/mysql_client_test.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 3d46a720cf7..84353f63d3b 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -436,6 +436,13 @@ static void test_prepare_simple() DIE_UNLESS(mysql_stmt_field_count(stmt) == 2); mysql_stmt_close(stmt); + /* show grants */ + strmov(query, "SHOW GRANTS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 1); + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); -- cgit v1.2.1 From 75a1d866dd4c00b91ca9b29593ad41543f084544 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Jan 2016 13:31:53 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. SHOW SLAVE STATUS fixed. --- tests/mysql_client_test.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 84353f63d3b..d871ea178ea 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -443,6 +443,13 @@ static void test_prepare_simple() DIE_UNLESS(mysql_stmt_field_count(stmt) == 1); mysql_stmt_close(stmt); + /* show slave status */ + strmov(query, "SHOW SLAVE STATUS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 47); + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); -- cgit v1.2.1 From efb36ac5d5a5e2b7937545e2d3fddb1b7c8b7f9a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Jan 2016 13:42:53 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. SHOW MASTER STATUS fixed. --- tests/mysql_client_test.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index d871ea178ea..ccc39d5f9ce 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -450,6 +450,13 @@ static void test_prepare_simple() DIE_UNLESS(mysql_stmt_field_count(stmt) == 47); mysql_stmt_close(stmt); + /* show master status */ + strmov(query, "SHOW MASTER STATUS"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 4); + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); -- cgit v1.2.1 From d16d40be2c47d8be5360ae7604f0199635dc0063 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Jan 2016 14:58:52 +0400 Subject: MDEV-5273 Prepared statement doesn't return metadata after prepare. SHOW CREATE PROCEDURE/FUNCTION fixed. --- tests/mysql_client_test.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'tests') diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index ccc39d5f9ce..dd892b45449 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -457,6 +457,20 @@ static void test_prepare_simple() DIE_UNLESS(mysql_stmt_field_count(stmt) == 4); mysql_stmt_close(stmt); + /* show create procedure */ + strmov(query, "SHOW CREATE PROCEDURE e1;"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 6); + mysql_stmt_close(stmt); + + /* show create function */ + strmov(query, "SHOW CREATE FUNCTION e1;"); + stmt= mysql_simple_prepare(mysql, query); + check_stmt(stmt); + DIE_UNLESS(mysql_stmt_field_count(stmt) == 6); + mysql_stmt_close(stmt); + /* now fetch the results ..*/ rc= mysql_commit(mysql); myquery(rc); -- cgit v1.2.1