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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
efb36ac5
Commit
efb36ac5
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 MASTER STATUS fixed.
parent
75a1d866
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
14 deletions
+58
-14
sql/slave.h
sql/slave.h
+1
-0
sql/sql_prepare.cc
sql/sql_prepare.cc
+30
-0
sql/sql_repl.cc
sql/sql_repl.cc
+20
-14
tests/mysql_client_test.c
tests/mysql_client_test.c
+7
-0
No files found.
sql/slave.h
View file @
efb36ac5
...
...
@@ -211,6 +211,7 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list,
bool
full
,
size_t
gtid_pos_length
);
bool
show_master_info
(
THD
*
thd
,
Master_info
*
mi
,
bool
full
);
bool
show_all_master_info
(
THD
*
thd
);
void
show_binlog_info_get_fields
(
THD
*
thd
,
List
<
Item
>
*
field_list
);
bool
show_binlog_info
(
THD
*
thd
);
bool
rpl_master_has_bug
(
const
Relay_log_info
*
rli
,
uint
bug_id
,
bool
report
,
bool
(
*
pred
)(
const
void
*
),
const
void
*
param
);
...
...
sql/sql_prepare.cc
View file @
efb36ac5
...
...
@@ -1916,6 +1916,29 @@ static bool mysql_test_show_slave_status(Prepared_statement *stmt)
}
/**
Validate and prepare for execution SHOW MASTER STATUS statement.
@param stmt prepared statement
@retval
FALSE success
@retval
TRUE error, error message is set in THD
*/
static
bool
mysql_test_show_master_status
(
Prepared_statement
*
stmt
)
{
DBUG_ENTER
(
"mysql_test_show_master_status"
);
THD
*
thd
=
stmt
->
thd
;
List
<
Item
>
fields
;
show_binlog_info_get_fields
(
thd
,
&
fields
);
DBUG_RETURN
(
send_stmt_metadata
(
thd
,
stmt
,
&
fields
));
}
/**
@brief Validate and prepare for execution CREATE VIEW statement
...
...
@@ -2277,6 +2300,13 @@ static bool check_prepared_statement(Prepared_statement *stmt)
DBUG_RETURN
(
FALSE
);
}
break
;
case
SQLCOM_SHOW_MASTER_STAT
:
if
(
!
(
res
=
mysql_test_show_master_status
(
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 @
efb36ac5
...
...
@@ -4088,6 +4088,25 @@ bool mysql_show_binlog_events(THD* thd)
}
void
show_binlog_info_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
,
"File"
,
FN_REFLEN
),
mem_root
);
field_list
->
push_back
(
new
(
mem_root
)
Item_return_int
(
thd
,
"Position"
,
20
,
MYSQL_TYPE_LONGLONG
),
mem_root
);
field_list
->
push_back
(
new
(
mem_root
)
Item_empty_string
(
thd
,
"Binlog_Do_DB"
,
255
),
mem_root
);
field_list
->
push_back
(
new
(
mem_root
)
Item_empty_string
(
thd
,
"Binlog_Ignore_DB"
,
255
),
mem_root
);
}
/**
Execute a SHOW MASTER STATUS statement.
...
...
@@ -4100,23 +4119,10 @@ bool mysql_show_binlog_events(THD* thd)
bool
show_binlog_info
(
THD
*
thd
)
{
Protocol
*
protocol
=
thd
->
protocol
;
MEM_ROOT
*
mem_root
=
thd
->
mem_root
;
DBUG_ENTER
(
"show_binlog_info"
);
List
<
Item
>
field_list
;
field_list
.
push_back
(
new
(
mem_root
)
Item_empty_string
(
thd
,
"File"
,
FN_REFLEN
),
mem_root
);
field_list
.
push_back
(
new
(
mem_root
)
Item_return_int
(
thd
,
"Position"
,
20
,
MYSQL_TYPE_LONGLONG
),
mem_root
);
field_list
.
push_back
(
new
(
mem_root
)
Item_empty_string
(
thd
,
"Binlog_Do_DB"
,
255
),
mem_root
);
field_list
.
push_back
(
new
(
mem_root
)
Item_empty_string
(
thd
,
"Binlog_Ignore_DB"
,
255
),
mem_root
);
show_binlog_info_get_fields
(
thd
,
&
field_list
);
if
(
protocol
->
send_result_set_metadata
(
&
field_list
,
Protocol
::
SEND_NUM_ROWS
|
Protocol
::
SEND_EOF
))
...
...
tests/mysql_client_test.c
View file @
efb36ac5
...
...
@@ -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
);
...
...
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