Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
34df3140
Commit
34df3140
authored
Jan 27, 2016
by
Alexey Botchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5273 Prepared statement doesn't return metadata after prepare.
SHOW BINARY LOGS fixed.
parent
efb36ac5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
8 deletions
+47
-8
sql/sql_prepare.cc
sql/sql_prepare.cc
+31
-0
sql/sql_repl.cc
sql/sql_repl.cc
+15
-8
sql/sql_repl.h
sql/sql_repl.h
+1
-0
No files found.
sql/sql_prepare.cc
View file @
34df3140
...
...
@@ -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"
...
...
@@ -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
...
...
@@ -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
)
{
...
...
sql/sql_repl.cc
View file @
34df3140
...
...
@@ -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.
...
...
@@ -4165,7 +4178,6 @@ bool show_binlogs(THD* thd)
uint
length
;
int
cur_dir_len
;
Protocol
*
protocol
=
thd
->
protocol
;
MEM_ROOT
*
mem_root
=
thd
->
mem_root
;
DBUG_ENTER
(
"show_binlogs"
);
if
(
!
mysql_bin_log
.
is_open
())
...
...
@@ -4174,13 +4186,8 @@ bool show_binlogs(THD* thd)
DBUG_RETURN
(
TRUE
);
}
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
);
show_binlogs_get_fields
(
thd
,
&
field_list
);
if
(
protocol
->
send_result_set_metadata
(
&
field_list
,
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
))
DBUG_RETURN
(
TRUE
);
...
...
sql/sql_repl.h
View file @
34df3140
...
...
@@ -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
log_in_use
(
const
char
*
log_name
);
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
);
extern
int
init_master_info
(
Master_info
*
mi
);
void
kill_zombie_dump_threads
(
uint32
slave_server_id
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment