mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
MDEV-5273 Prepared statement doesn't return metadata after prepare.
SHOW BINARY LOGS fixed.
This commit is contained in:
@ -104,6 +104,7 @@ When one supplies long data for a placeholder:
|
|||||||
// mysql_handle_derived
|
// mysql_handle_derived
|
||||||
#include "sql_cursor.h"
|
#include "sql_cursor.h"
|
||||||
#include "sql_show.h"
|
#include "sql_show.h"
|
||||||
|
#include "sql_repl.h"
|
||||||
#include "slave.h"
|
#include "slave.h"
|
||||||
#include "sp_head.h"
|
#include "sp_head.h"
|
||||||
#include "sp.h"
|
#include "sp.h"
|
||||||
@ -1939,6 +1940,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
|
@brief Validate and prepare for execution CREATE VIEW statement
|
||||||
|
|
||||||
@ -2307,6 +2331,13 @@ static bool check_prepared_statement(Prepared_statement *stmt)
|
|||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(FALSE);
|
||||||
}
|
}
|
||||||
break;
|
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:
|
case SQLCOM_CREATE_VIEW:
|
||||||
if (lex->create_view_mode == VIEW_ALTER)
|
if (lex->create_view_mode == VIEW_ALTER)
|
||||||
{
|
{
|
||||||
|
@ -4146,6 +4146,19 @@ bool show_binlog_info(THD* thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void show_binlogs_get_fields(THD *thd, List<Item> *field_list)
|
||||||
|
{
|
||||||
|
MEM_ROOT *mem_root= thd->mem_root;
|
||||||
|
field_list->push_back(new (mem_root)
|
||||||
|
Item_empty_string(thd, "Log_name", 255),
|
||||||
|
mem_root);
|
||||||
|
field_list->push_back(new (mem_root)
|
||||||
|
Item_return_int(thd, "File_size", 20,
|
||||||
|
MYSQL_TYPE_LONGLONG),
|
||||||
|
mem_root);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Execute a SHOW BINARY LOGS statement.
|
Execute a SHOW BINARY LOGS statement.
|
||||||
|
|
||||||
@ -4165,7 +4178,6 @@ bool show_binlogs(THD* thd)
|
|||||||
uint length;
|
uint length;
|
||||||
int cur_dir_len;
|
int cur_dir_len;
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
MEM_ROOT *mem_root= thd->mem_root;
|
|
||||||
DBUG_ENTER("show_binlogs");
|
DBUG_ENTER("show_binlogs");
|
||||||
|
|
||||||
if (!mysql_bin_log.is_open())
|
if (!mysql_bin_log.is_open())
|
||||||
@ -4174,13 +4186,8 @@ bool show_binlogs(THD* thd)
|
|||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
field_list.push_back(new (mem_root)
|
show_binlogs_get_fields(thd, &field_list);
|
||||||
Item_empty_string(thd, "Log_name", 255),
|
|
||||||
mem_root);
|
|
||||||
field_list.push_back(new (mem_root)
|
|
||||||
Item_return_int(thd, "File_size", 20,
|
|
||||||
MYSQL_TYPE_LONGLONG),
|
|
||||||
mem_root);
|
|
||||||
if (protocol->send_result_set_metadata(&field_list,
|
if (protocol->send_result_set_metadata(&field_list,
|
||||||
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
@ -52,6 +52,7 @@ bool purge_master_logs(THD* thd, const char* to_log);
|
|||||||
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
|
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
|
||||||
bool log_in_use(const char* log_name);
|
bool log_in_use(const char* log_name);
|
||||||
void adjust_linfo_offsets(my_off_t purge_offset);
|
void adjust_linfo_offsets(my_off_t purge_offset);
|
||||||
|
void show_binlogs_get_fields(THD *thd, List<Item> *field_list);
|
||||||
bool show_binlogs(THD* thd);
|
bool show_binlogs(THD* thd);
|
||||||
extern int init_master_info(Master_info* mi);
|
extern int init_master_info(Master_info* mi);
|
||||||
void kill_zombie_dump_threads(uint32 slave_server_id);
|
void kill_zombie_dump_threads(uint32 slave_server_id);
|
||||||
|
Reference in New Issue
Block a user