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
284a14ed
Commit
284a14ed
authored
Jun 05, 2009
by
Magnus Blåudd
Browse files
Options
Browse Files
Download
Plain Diff
Merge bug#45326
parents
b0c815e2
465d21a3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
33 deletions
+33
-33
sql/mysql_priv.h
sql/mysql_priv.h
+5
-5
sql/sql_parse.cc
sql/sql_parse.cc
+6
-6
sql/sql_prepare.cc
sql/sql_prepare.cc
+22
-22
No files found.
sql/mysql_priv.h
View file @
284a14ed
...
@@ -1413,14 +1413,14 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
...
@@ -1413,14 +1413,14 @@ enum enum_schema_tables get_schema_table_idx(ST_SCHEMA_TABLE *schema_table);
/* sql_prepare.cc */
/* sql_prepare.cc */
void
mysql_stmt_prepare
(
THD
*
thd
,
const
char
*
packet
,
uint
packet_length
);
void
mysql
d
_stmt_prepare
(
THD
*
thd
,
const
char
*
packet
,
uint
packet_length
);
void
mysql_stmt_execute
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql
d
_stmt_execute
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql_stmt_close
(
THD
*
thd
,
char
*
packet
);
void
mysql
d
_stmt_close
(
THD
*
thd
,
char
*
packet
);
void
mysql_sql_stmt_prepare
(
THD
*
thd
);
void
mysql_sql_stmt_prepare
(
THD
*
thd
);
void
mysql_sql_stmt_execute
(
THD
*
thd
);
void
mysql_sql_stmt_execute
(
THD
*
thd
);
void
mysql_sql_stmt_close
(
THD
*
thd
);
void
mysql_sql_stmt_close
(
THD
*
thd
);
void
mysql_stmt_fetch
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql
d
_stmt_fetch
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql_stmt_reset
(
THD
*
thd
,
char
*
packet
);
void
mysql
d
_stmt_reset
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_get_longdata
(
THD
*
thd
,
char
*
pos
,
ulong
packet_length
);
void
mysql_stmt_get_longdata
(
THD
*
thd
,
char
*
pos
,
ulong
packet_length
);
void
reinit_stmt_before_use
(
THD
*
thd
,
LEX
*
lex
);
void
reinit_stmt_before_use
(
THD
*
thd
,
LEX
*
lex
);
...
...
sql/sql_parse.cc
View file @
284a14ed
...
@@ -1165,12 +1165,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1165,12 +1165,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
}
case
COM_STMT_EXECUTE
:
case
COM_STMT_EXECUTE
:
{
{
mysql_stmt_execute
(
thd
,
packet
,
packet_length
);
mysql
d
_stmt_execute
(
thd
,
packet
,
packet_length
);
break
;
break
;
}
}
case
COM_STMT_FETCH
:
case
COM_STMT_FETCH
:
{
{
mysql_stmt_fetch
(
thd
,
packet
,
packet_length
);
mysql
d
_stmt_fetch
(
thd
,
packet
,
packet_length
);
break
;
break
;
}
}
case
COM_STMT_SEND_LONG_DATA
:
case
COM_STMT_SEND_LONG_DATA
:
...
@@ -1180,17 +1180,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
...
@@ -1180,17 +1180,17 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
}
case
COM_STMT_PREPARE
:
case
COM_STMT_PREPARE
:
{
{
mysql_stmt_prepare
(
thd
,
packet
,
packet_length
);
mysql
d
_stmt_prepare
(
thd
,
packet
,
packet_length
);
break
;
break
;
}
}
case
COM_STMT_CLOSE
:
case
COM_STMT_CLOSE
:
{
{
mysql_stmt_close
(
thd
,
packet
);
mysql
d
_stmt_close
(
thd
,
packet
);
break
;
break
;
}
}
case
COM_STMT_RESET
:
case
COM_STMT_RESET
:
{
{
mysql_stmt_reset
(
thd
,
packet
);
mysql
d
_stmt_reset
(
thd
,
packet
);
break
;
break
;
}
}
case
COM_QUERY
:
case
COM_QUERY
:
...
@@ -5739,7 +5739,7 @@ mysql_new_select(LEX *lex, bool move_down)
...
@@ -5739,7 +5739,7 @@ mysql_new_select(LEX *lex, bool move_down)
/*
/*
Don't evaluate this subquery during statement prepare even if
Don't evaluate this subquery during statement prepare even if
it's a constant one. The flag is switched off in the end of
it's a constant one. The flag is switched off in the end of
mysql_stmt_prepare.
mysql
d
_stmt_prepare.
*/
*/
if
(
thd
->
stmt_arena
->
is_stmt_prepare
())
if
(
thd
->
stmt_arena
->
is_stmt_prepare
())
select_lex
->
uncacheable
|=
UNCACHEABLE_PREPARE
;
select_lex
->
uncacheable
|=
UNCACHEABLE_PREPARE
;
...
...
sql/sql_prepare.cc
View file @
284a14ed
...
@@ -716,9 +716,9 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
...
@@ -716,9 +716,9 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
prepared statement, parameter markers are replaced with variable names.
prepared statement, parameter markers are replaced with variable names.
Example:
Example:
@verbatim
@verbatim
mysql_stmt_prepare("UPDATE t1 SET a=a*1.25 WHERE a=?")
mysql
d
_stmt_prepare("UPDATE t1 SET a=a*1.25 WHERE a=?")
--> general logs gets [Prepare] UPDATE t1 SET a*1.25 WHERE a=?"
--> general logs gets [Prepare] UPDATE t1 SET a*1.25 WHERE a=?"
mysql_stmt_execute(stmt);
mysql
d
_stmt_execute(stmt);
--> general and binary logs get
--> general and binary logs get
[Execute] UPDATE t1 SET a*1.25 WHERE a=1"
[Execute] UPDATE t1 SET a*1.25 WHERE a=1"
@endverbatim
@endverbatim
...
@@ -2056,11 +2056,11 @@ static bool init_param_array(Prepared_statement *stmt)
...
@@ -2056,11 +2056,11 @@ static bool init_param_array(Prepared_statement *stmt)
to the client, otherwise an error message is set in THD.
to the client, otherwise an error message is set in THD.
*/
*/
void
mysql_stmt_prepare
(
THD
*
thd
,
const
char
*
packet
,
uint
packet_length
)
void
mysql
d
_stmt_prepare
(
THD
*
thd
,
const
char
*
packet
,
uint
packet_length
)
{
{
Prepared_statement
*
stmt
;
Prepared_statement
*
stmt
;
bool
error
;
bool
error
;
DBUG_ENTER
(
"mysql_stmt_prepare"
);
DBUG_ENTER
(
"mysql
d
_stmt_prepare"
);
DBUG_PRINT
(
"prep_query"
,
(
"%s"
,
packet
));
DBUG_PRINT
(
"prep_query"
,
(
"%s"
,
packet
));
...
@@ -2423,7 +2423,7 @@ static void reset_stmt_params(Prepared_statement *stmt)
...
@@ -2423,7 +2423,7 @@ static void reset_stmt_params(Prepared_statement *stmt)
client, otherwise an error message is set in THD.
client, otherwise an error message is set in THD.
*/
*/
void
mysql_stmt_execute
(
THD
*
thd
,
char
*
packet_arg
,
uint
packet_length
)
void
mysql
d
_stmt_execute
(
THD
*
thd
,
char
*
packet_arg
,
uint
packet_length
)
{
{
uchar
*
packet
=
(
uchar
*
)
packet_arg
;
// GCC 4.0.1 workaround
uchar
*
packet
=
(
uchar
*
)
packet_arg
;
// GCC 4.0.1 workaround
ulong
stmt_id
=
uint4korr
(
packet
);
ulong
stmt_id
=
uint4korr
(
packet
);
...
@@ -2433,7 +2433,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
...
@@ -2433,7 +2433,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
uchar
*
packet_end
=
packet
+
packet_length
;
uchar
*
packet_end
=
packet
+
packet_length
;
Prepared_statement
*
stmt
;
Prepared_statement
*
stmt
;
bool
open_cursor
;
bool
open_cursor
;
DBUG_ENTER
(
"mysql_stmt_execute"
);
DBUG_ENTER
(
"mysql
d
_stmt_execute"
);
packet
+=
9
;
/* stmt_id + 5 bytes of flags */
packet
+=
9
;
/* stmt_id + 5 bytes of flags */
...
@@ -2444,7 +2444,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
...
@@ -2444,7 +2444,7 @@ void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
{
{
char
llbuf
[
22
];
char
llbuf
[
22
];
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
llstr
(
stmt_id
,
llbuf
),
"mysql_stmt_execute"
);
llstr
(
stmt_id
,
llbuf
),
"mysql
d
_stmt_execute"
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2525,7 +2525,7 @@ void mysql_sql_stmt_execute(THD *thd)
...
@@ -2525,7 +2525,7 @@ void mysql_sql_stmt_execute(THD *thd)
@param packet_length Length of packet
@param packet_length Length of packet
*/
*/
void
mysql_stmt_fetch
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
)
void
mysql
d
_stmt_fetch
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
)
{
{
/* assume there is always place for 8-16 bytes */
/* assume there is always place for 8-16 bytes */
ulong
stmt_id
=
uint4korr
(
packet
);
ulong
stmt_id
=
uint4korr
(
packet
);
...
@@ -2533,7 +2533,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2533,7 +2533,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
Prepared_statement
*
stmt
;
Prepared_statement
*
stmt
;
Statement
stmt_backup
;
Statement
stmt_backup
;
Server_side_cursor
*
cursor
;
Server_side_cursor
*
cursor
;
DBUG_ENTER
(
"mysql_stmt_fetch"
);
DBUG_ENTER
(
"mysql
d
_stmt_fetch"
);
/* First of all clear possible warnings from the previous command */
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command
(
thd
);
mysql_reset_thd_for_next_command
(
thd
);
...
@@ -2542,7 +2542,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2542,7 +2542,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
{
{
char
llbuf
[
22
];
char
llbuf
[
22
];
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
llstr
(
stmt_id
,
llbuf
),
"mysql_stmt_fetch"
);
llstr
(
stmt_id
,
llbuf
),
"mysql
d
_stmt_fetch"
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2583,9 +2583,9 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2583,9 +2583,9 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
This function resets statement to the state it was right after prepare.
This function resets statement to the state it was right after prepare.
It can be used to:
It can be used to:
- clear an error happened during mysql_stmt_send_long_data
- clear an error happened during mysql
d
_stmt_send_long_data
- cancel long data stream for all placeholders without
- cancel long data stream for all placeholders without
having to call mysql_stmt_execute.
having to call mysql
d
_stmt_execute.
- close an open cursor
- close an open cursor
Sends 'OK' packet in case of success (statement was reset)
Sends 'OK' packet in case of success (statement was reset)
or 'ERROR' packet (unrecoverable error/statement not found/etc).
or 'ERROR' packet (unrecoverable error/statement not found/etc).
...
@@ -2594,12 +2594,12 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
...
@@ -2594,12 +2594,12 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
@param packet Packet with stmt id
@param packet Packet with stmt id
*/
*/
void
mysql_stmt_reset
(
THD
*
thd
,
char
*
packet
)
void
mysql
d
_stmt_reset
(
THD
*
thd
,
char
*
packet
)
{
{
/* There is always space for 4 bytes in buffer */
/* There is always space for 4 bytes in buffer */
ulong
stmt_id
=
uint4korr
(
packet
);
ulong
stmt_id
=
uint4korr
(
packet
);
Prepared_statement
*
stmt
;
Prepared_statement
*
stmt
;
DBUG_ENTER
(
"mysql_stmt_reset"
);
DBUG_ENTER
(
"mysql
d
_stmt_reset"
);
/* First of all clear possible warnings from the previous command */
/* First of all clear possible warnings from the previous command */
mysql_reset_thd_for_next_command
(
thd
);
mysql_reset_thd_for_next_command
(
thd
);
...
@@ -2609,7 +2609,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
...
@@ -2609,7 +2609,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
{
{
char
llbuf
[
22
];
char
llbuf
[
22
];
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
my_error
(
ER_UNKNOWN_STMT_HANDLER
,
MYF
(
0
),
sizeof
(
llbuf
),
llstr
(
stmt_id
,
llbuf
),
"mysql_stmt_reset"
);
llstr
(
stmt_id
,
llbuf
),
"mysql
d
_stmt_reset"
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
...
@@ -2617,7 +2617,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
...
@@ -2617,7 +2617,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
/*
/*
Clear parameters from data which could be set by
Clear parameters from data which could be set by
mysql_stmt_send_long_data() call.
mysql
d
_stmt_send_long_data() call.
*/
*/
reset_stmt_params
(
stmt
);
reset_stmt_params
(
stmt
);
...
@@ -2638,12 +2638,12 @@ void mysql_stmt_reset(THD *thd, char *packet)
...
@@ -2638,12 +2638,12 @@ void mysql_stmt_reset(THD *thd, char *packet)
we don't send any reply to this command.
we don't send any reply to this command.
*/
*/
void
mysql_stmt_close
(
THD
*
thd
,
char
*
packet
)
void
mysql
d
_stmt_close
(
THD
*
thd
,
char
*
packet
)
{
{
/* There is always space for 4 bytes in packet buffer */
/* There is always space for 4 bytes in packet buffer */
ulong
stmt_id
=
uint4korr
(
packet
);
ulong
stmt_id
=
uint4korr
(
packet
);
Prepared_statement
*
stmt
;
Prepared_statement
*
stmt
;
DBUG_ENTER
(
"mysql_stmt_close"
);
DBUG_ENTER
(
"mysql
d
_stmt_close"
);
thd
->
main_da
.
disable_status
();
thd
->
main_da
.
disable_status
();
...
@@ -2742,7 +2742,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
...
@@ -2742,7 +2742,7 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
stmt
->
state
=
Query_arena
::
ERROR
;
stmt
->
state
=
Query_arena
::
ERROR
;
stmt
->
last_errno
=
ER_WRONG_ARGUMENTS
;
stmt
->
last_errno
=
ER_WRONG_ARGUMENTS
;
sprintf
(
stmt
->
last_error
,
ER
(
ER_WRONG_ARGUMENTS
),
sprintf
(
stmt
->
last_error
,
ER
(
ER_WRONG_ARGUMENTS
),
"mysql_stmt_send_long_data"
);
"mysql
d
_stmt_send_long_data"
);
DBUG_VOID_RETURN
;
DBUG_VOID_RETURN
;
}
}
#endif
#endif
...
@@ -3166,7 +3166,7 @@ Prepared_statement::set_parameters(String *expanded_query,
...
@@ -3166,7 +3166,7 @@ Prepared_statement::set_parameters(String *expanded_query,
if
(
res
)
if
(
res
)
{
{
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
is_sql_ps
?
"EXECUTE"
:
"mysql_stmt_execute"
);
is_sql_ps
?
"EXECUTE"
:
"mysql
d
_stmt_execute"
);
reset_stmt_params
(
this
);
reset_stmt_params
(
this
);
}
}
return
res
;
return
res
;
...
@@ -3621,11 +3621,11 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
...
@@ -3621,11 +3621,11 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
}
}
/** Common part of DEALLOCATE PREPARE and mysql_stmt_close. */
/** Common part of DEALLOCATE PREPARE and mysql
d
_stmt_close. */
void
Prepared_statement
::
deallocate
()
void
Prepared_statement
::
deallocate
()
{
{
/* We account deallocate in the same manner as mysql_stmt_close */
/* We account deallocate in the same manner as mysql
d
_stmt_close */
status_var_increment
(
thd
->
status_var
.
com_stmt_close
);
status_var_increment
(
thd
->
status_var
.
com_stmt_close
);
/* Statement map calls delete stmt on erase */
/* Statement map calls delete stmt on erase */
thd
->
stmt_map
.
erase
(
this
);
thd
->
stmt_map
.
erase
(
this
);
...
...
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