summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-01-27 13:57:25 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-01-28 11:12:03 +0400
commit34df3140f2e5fe3a8531c5f6eb430e2192bfa737 (patch)
tree74172a236a561431a0dc0383444481d7957197de /sql/sql_prepare.cc
parentefb36ac5d5a5e2b7937545e2d3fddb1b7c8b7f9a (diff)
downloadmariadb-git-34df3140f2e5fe3a8531c5f6eb430e2192bfa737.tar.gz
MDEV-5273 Prepared statement doesn't return metadata after prepare.
SHOW BINARY LOGS fixed.
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 7ba269ed131..c67acff32f6 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -104,6 +104,7 @@ When one supplies long data for a placeholder:
// mysql_handle_derived
#include "sql_cursor.h"
#include "sql_show.h"
+#include "sql_repl.h"
#include "slave.h"
#include "sp_head.h"
#include "sp.h"
@@ -1940,6 +1941,29 @@ static bool mysql_test_show_master_status(Prepared_statement *stmt)
/**
+ Validate and prepare for execution SHOW BINLOGS statement.
+
+ @param stmt prepared statement
+
+ @retval
+ FALSE success
+ @retval
+ TRUE error, error message is set in THD
+*/
+
+static bool mysql_test_show_binlogs(Prepared_statement *stmt)
+{
+ DBUG_ENTER("mysql_test_show_binlogs");
+ THD *thd= stmt->thd;
+ List<Item> fields;
+
+ show_binlogs_get_fields(thd, &fields);
+
+ DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
+}
+
+
+/**
@brief Validate and prepare for execution CREATE VIEW statement
@param stmt prepared statement
@@ -2307,6 +2331,13 @@ static bool check_prepared_statement(Prepared_statement *stmt)
DBUG_RETURN(FALSE);
}
break;
+ case SQLCOM_SHOW_BINLOGS:
+ if (!(res= mysql_test_show_binlogs(stmt)))
+ {
+ /* Statement and field info has already been sent */
+ DBUG_RETURN(FALSE);
+ }
+ break;
case SQLCOM_CREATE_VIEW:
if (lex->create_view_mode == VIEW_ALTER)
{