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
f16b102f
Commit
f16b102f
authored
Jun 17, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-bug4-5.0
parents
46fa81f9
c0918af2
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
47 additions
and
51 deletions
+47
-51
include/mysql_com.h
include/mysql_com.h
+2
-2
libmysql/libmysql.c
libmysql/libmysql.c
+14
-13
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+1
-1
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+1
-1
sql/mysql_priv.h
sql/mysql_priv.h
+1
-3
sql/sql_class.h
sql/sql_class.h
+2
-6
sql/sql_lex.cc
sql/sql_lex.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+9
-9
sql/sql_prepare.cc
sql/sql_prepare.cc
+11
-10
sql/sql_yacc.yy
sql/sql_yacc.yy
+4
-4
tests/mysql_client_test.c
tests/mysql_client_test.c
+1
-1
No files found.
include/mysql_com.h
View file @
f16b102f
...
...
@@ -48,8 +48,8 @@ enum enum_server_command
COM_PROCESS_INFO
,
COM_CONNECT
,
COM_PROCESS_KILL
,
COM_DEBUG
,
COM_PING
,
COM_TIME
,
COM_DELAYED_INSERT
,
COM_CHANGE_USER
,
COM_BINLOG_DUMP
,
COM_TABLE_DUMP
,
COM_CONNECT_OUT
,
COM_REGISTER_SLAVE
,
COM_
PREPARE
,
COM_EXECUTE
,
COM_LONG_DATA
,
COM_CLOSE_STMT
,
COM_
RESET_STMT
,
COM_SET_OPTION
,
COM
_FETCH
,
COM_
STMT_PREPARE
,
COM_STMT_EXECUTE
,
COM_STMT_SEND_LONG_DATA
,
COM_STMT_CLOSE
,
COM_
STMT_RESET
,
COM_SET_OPTION
,
COM_STMT
_FETCH
,
/* don't forget to update const char *command_name[] in sql_parse.cc */
/* Must be last */
...
...
libmysql/libmysql.c
View file @
f16b102f
...
...
@@ -1736,7 +1736,7 @@ myodbc_remove_escape(MYSQL *mysql,char *name)
/******************* Declarations ***********************************/
/* Default number of rows fetched per one COM_FETCH command. */
/* Default number of rows fetched per one COM_
STMT_
FETCH command. */
#define DEFAULT_PREFETCH_ROWS (ulong) 1
...
...
@@ -1887,7 +1887,7 @@ void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
}
/*
Read and unpack server reply to COM_PREPARE command (sent from
Read and unpack server reply to COM_
STMT_
PREPARE command (sent from
mysql_stmt_prepare).
SYNOPSIS
...
...
@@ -2082,7 +2082,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
mysql_use_result it won't be freed in mysql_stmt_free_result and
we should get 'Commands out of sync' here.
*/
if
(
simple_command
(
mysql
,
COM_
CLOSE_STMT
,
buff
,
4
,
1
))
if
(
simple_command
(
mysql
,
COM_
STMT_CLOSE
,
buff
,
4
,
1
))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
mysql
->
net
.
sqlstate
);
...
...
@@ -2091,7 +2091,7 @@ mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, ulong length)
stmt
->
state
=
MYSQL_STMT_INIT_DONE
;
}
if
(
simple_command
(
mysql
,
COM_PREPARE
,
query
,
length
,
1
))
if
(
simple_command
(
mysql
,
COM_
STMT_
PREPARE
,
query
,
length
,
1
))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
mysql
->
net
.
sqlstate
);
...
...
@@ -2175,7 +2175,7 @@ static unsigned int alloc_stmt_fields(MYSQL_STMT *stmt)
/*
Update result set columns metadata if it was sent again in
reply to COM_EXECUTE.
reply to COM_
STMT_
EXECUTE.
*/
static
void
update_stmt_fields
(
MYSQL_STMT
*
stmt
)
...
...
@@ -2490,7 +2490,7 @@ static my_bool store_param(MYSQL_STMT *stmt, MYSQL_BIND *param)
/*
Auxilary function to send COM_EXECUTE packet to server and read reply.
Auxilary function to send COM_
STMT_
EXECUTE packet to server and read reply.
Used from cli_stmt_execute, which is in turn used by mysql_stmt_execute.
*/
...
...
@@ -2507,7 +2507,7 @@ static my_bool execute(MYSQL_STMT *stmt, char *packet, ulong length)
int4store
(
buff
,
stmt
->
stmt_id
);
/* Send stmt id to server */
buff
[
4
]
=
(
char
)
stmt
->
flags
;
int4store
(
buff
+
5
,
1
);
/* iteration count */
if
(
cli_advanced_command
(
mysql
,
COM_EXECUTE
,
buff
,
sizeof
(
buff
),
if
(
cli_advanced_command
(
mysql
,
COM_
STMT_
EXECUTE
,
buff
,
sizeof
(
buff
),
packet
,
length
,
1
)
||
(
*
mysql
->
methods
->
read_query_result
)(
mysql
))
{
...
...
@@ -2720,7 +2720,7 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
/* Send row request to the server */
int4store
(
buff
,
stmt
->
stmt_id
);
int4store
(
buff
+
4
,
stmt
->
prefetch_rows
);
/* number of rows to fetch */
if
(
cli_advanced_command
(
mysql
,
COM_FETCH
,
buff
,
sizeof
(
buff
),
if
(
cli_advanced_command
(
mysql
,
COM_
STMT_
FETCH
,
buff
,
sizeof
(
buff
),
NullS
,
0
,
1
))
{
set_stmt_errmsg
(
stmt
,
net
->
last_error
,
net
->
last_errno
,
net
->
sqlstate
);
...
...
@@ -2910,7 +2910,7 @@ int STDCALL mysql_stmt_execute(MYSQL_STMT *stmt)
- if data dictionary changed between prepare and execute, for
example a table used in the query was altered.
Note, that now (4.1.3) we always send metadata in reply to
COM_EXECUTE (even if it is not necessary), so either this or
COM_
STMT_
EXECUTE (even if it is not necessary), so either this or
previous branch always works.
TODO: send metadata only when it's really necessary and add a warning
'Metadata changed' when it's sent twice.
...
...
@@ -3380,8 +3380,9 @@ mysql_stmt_send_long_data(MYSQL_STMT *stmt, uint param_number,
Note that we don't get any ok packet from the server in this case
This is intentional to save bandwidth.
*/
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_LONG_DATA
,
buff
,
sizeof
(
buff
),
data
,
length
,
1
))
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_STMT_SEND_LONG_DATA
,
buff
,
sizeof
(
buff
),
data
,
length
,
1
))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
mysql
->
net
.
sqlstate
);
...
...
@@ -4930,7 +4931,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
*/
char
buff
[
MYSQL_STMT_HEADER
];
/* packet header: 4 bytes for stmt id */
int4store
(
buff
,
stmt
->
stmt_id
);
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_
RESET_STM
T
,
buff
,
if
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_
STMT_RESE
T
,
buff
,
sizeof
(
buff
),
0
,
0
,
0
))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
...
...
@@ -5004,7 +5005,7 @@ my_bool STDCALL mysql_stmt_close(MYSQL_STMT *stmt)
mysql
->
status
=
MYSQL_STATUS_READY
;
}
int4store
(
buff
,
stmt
->
stmt_id
);
if
((
rc
=
simple_command
(
mysql
,
COM_
CLOSE_STMT
,
buff
,
4
,
1
)))
if
((
rc
=
simple_command
(
mysql
,
COM_
STMT_CLOSE
,
buff
,
4
,
1
)))
{
set_stmt_errmsg
(
stmt
,
mysql
->
net
.
last_error
,
mysql
->
net
.
last_errno
,
mysql
->
net
.
sqlstate
);
...
...
libmysqld/lib_sql.cc
View file @
f16b102f
...
...
@@ -220,7 +220,7 @@ static int emb_stmt_execute(MYSQL_STMT *stmt)
THD
*
thd
=
(
THD
*
)
stmt
->
mysql
->
thd
;
thd
->
client_param_count
=
stmt
->
param_count
;
thd
->
client_params
=
stmt
->
params
;
if
(
emb_advanced_command
(
stmt
->
mysql
,
COM_EXECUTE
,
0
,
0
,
if
(
emb_advanced_command
(
stmt
->
mysql
,
COM_
STMT_
EXECUTE
,
0
,
0
,
header
,
sizeof
(
header
),
1
)
||
emb_mysql_read_query_result
(
stmt
->
mysql
))
{
...
...
sql/item_cmpfunc.cc
View file @
f16b102f
...
...
@@ -649,7 +649,7 @@ bool Item_in_optimizer::fix_left(THD *thd,
If it is preparation PS only then we do not know values of parameters =>
cant't get there values and do not need that values.
*/
if
(
!
thd
->
only
_prepare
())
if
(
!
thd
->
current_arena
->
is_stmt
_prepare
())
cache
->
store
(
args
[
0
]);
if
(
cache
->
cols
()
==
1
)
{
...
...
sql/mysql_priv.h
View file @
f16b102f
...
...
@@ -559,8 +559,6 @@ struct Query_cache_query_flags
#define query_cache_invalidate_by_MyISAM_filename_ref NULL
#endif
/*HAVE_QUERY_CACHE*/
#define prepare_execute(A) ((A)->command == COM_EXECUTE)
bool
mysql_create_db
(
THD
*
thd
,
char
*
db
,
HA_CREATE_INFO
*
create
,
bool
silent
);
bool
mysql_alter_db
(
THD
*
thd
,
const
char
*
db
,
HA_CREATE_INFO
*
create
);
bool
mysql_rm_db
(
THD
*
thd
,
char
*
db
,
bool
if_exists
,
bool
silent
);
...
...
@@ -842,7 +840,7 @@ bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
void
mysql_stmt_execute
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql_sql_stmt_execute
(
THD
*
thd
,
LEX_STRING
*
stmt_name
);
void
mysql_stmt_fetch
(
THD
*
thd
,
char
*
packet
,
uint
packet_length
);
void
mysql_stmt_
fre
e
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_
clos
e
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_reset
(
THD
*
thd
,
char
*
packet
);
void
mysql_stmt_get_longdata
(
THD
*
thd
,
char
*
pos
,
ulong
packet_length
);
void
reinit_stmt_before_use
(
THD
*
thd
,
LEX
*
lex
);
...
...
sql/sql_class.h
View file @
f16b102f
...
...
@@ -1046,7 +1046,7 @@ public:
#endif
struct
st_my_thread_var
*
mysys_var
;
/*
Type of current query: COM_
PREPARE, COM_QUERY, etc. Set from
Type of current query: COM_
STMT_PREPARE, COM_QUERY, etc. Set from
first byte of the packet in do_command()
*/
enum
enum_server_command
command
;
...
...
@@ -1338,13 +1338,9 @@ public:
return
0
;
#endif
}
inline
bool
only_prepare
()
{
return
command
==
COM_PREPARE
;
}
inline
bool
fill_derived_tables
()
{
return
!
only
_prepare
()
&&
!
lex
->
only_view_structure
();
return
!
current_arena
->
is_stmt
_prepare
()
&&
!
lex
->
only_view_structure
();
}
inline
gptr
trans_alloc
(
unsigned
int
size
)
{
...
...
sql/sql_lex.cc
View file @
f16b102f
...
...
@@ -967,7 +967,7 @@ int yylex(void *arg, void *yythd)
{
THD
*
thd
=
(
THD
*
)
yythd
;
if
((
thd
->
client_capabilities
&
CLIENT_MULTI_STATEMENTS
)
&&
(
thd
->
command
!=
COM_PREPARE
))
(
thd
->
command
!=
COM_
STMT_
PREPARE
))
{
lex
->
safe_to_cache_query
=
0
;
lex
->
found_semicolon
=
(
char
*
)
lex
->
ptr
;
...
...
sql/sql_parse.cc
View file @
f16b102f
...
...
@@ -1634,32 +1634,32 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
}
break
;
}
case
COM_EXECUTE
:
case
COM_
STMT_
EXECUTE
:
{
mysql_stmt_execute
(
thd
,
packet
,
packet_length
);
break
;
}
case
COM_FETCH
:
case
COM_
STMT_
FETCH
:
{
mysql_stmt_fetch
(
thd
,
packet
,
packet_length
);
break
;
}
case
COM_LONG_DATA
:
case
COM_
STMT_SEND_
LONG_DATA
:
{
mysql_stmt_get_longdata
(
thd
,
packet
,
packet_length
);
break
;
}
case
COM_PREPARE
:
case
COM_
STMT_
PREPARE
:
{
mysql_stmt_prepare
(
thd
,
packet
,
packet_length
,
0
);
break
;
}
case
COM_
CLOSE_STMT
:
case
COM_
STMT_CLOSE
:
{
mysql_stmt_
fre
e
(
thd
,
packet
);
mysql_stmt_
clos
e
(
thd
,
packet
);
break
;
}
case
COM_
RESET_STM
T
:
case
COM_
STMT_RESE
T
:
{
mysql_stmt_reset
(
thd
,
packet
);
break
;
...
...
@@ -2199,7 +2199,7 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
/*
Read query from packet and store in thd->query
Used in COM_QUERY and COM_PREPARE
Used in COM_QUERY and COM_
STMT_
PREPARE
DESCRIPTION
Sets the following THD variables:
...
...
@@ -2501,7 +2501,7 @@ mysql_execute_command(THD *thd)
lex
->
prepared_stmt_name
.
str
,
query_len
,
query_str
));
}
thd
->
command
=
COM_PREPARE
;
thd
->
command
=
COM_
STMT_
PREPARE
;
if
(
!
(
res
=
mysql_stmt_prepare
(
thd
,
query_str
,
query_len
+
1
,
&
lex
->
prepared_stmt_name
)))
send_ok
(
thd
,
0L
,
0L
,
"Statement prepared"
);
...
...
sql/sql_prepare.cc
View file @
f16b102f
...
...
@@ -19,9 +19,9 @@ This file contains the implementation of prepare and executes.
Prepare:
- Server gets the query from client with command 'COM_PREPARE';
- Server gets the query from client with command 'COM_
STMT_
PREPARE';
in the following format:
[COM_PREPARE:1] [query]
[COM_
STMT_
PREPARE:1] [query]
- Parse the query and recognize any parameter markers '?' and
store its information list in lex->param_list
- Allocate a new statement for this prepare; and keep this in
...
...
@@ -37,10 +37,10 @@ Prepare:
Prepare-execute:
- Server gets the command 'COM_EXECUTE' to execute the
- Server gets the command 'COM_
STMT_
EXECUTE' to execute the
previously prepared query. If there is any param markers; then client
will send the data in the following format:
[COM_EXECUTE:1]
[COM_
STMT_
EXECUTE:1]
[STMT_ID:4]
[NULL_BITS:(param_count+7)/8)]
[TYPES_SUPPLIED_BY_CLIENT(0/1):1]
...
...
@@ -55,9 +55,10 @@ Prepare-execute:
Long data handling:
- Server gets the long data in pieces with command type 'COM_LONG_DATA'.
- Server gets the long data in pieces with command type
'COM_STMT_SEND_LONG_DATA'.
- The packet recieved will have the format as:
[COM_LONG_DATA:1][STMT_ID:4][parameter_number:2][data]
[COM_
STMT_SEND_
LONG_DATA:1][STMT_ID:4][parameter_number:2][data]
- data from the packet is appended to long data value buffer for this
placeholder.
- It's up to the client to check for read data ended. The server doesn't
...
...
@@ -2117,7 +2118,7 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
{
my_error
(
ER_WRONG_ARGUMENTS
,
MYF
(
0
),
"EXECUTE"
);
}
thd
->
command
=
COM_EXECUTE
;
/* For nice messages in general log */
thd
->
command
=
COM_
STMT_
EXECUTE
;
/* For nice messages in general log */
execute_stmt
(
thd
,
stmt
,
&
expanded_query
);
DBUG_VOID_RETURN
;
}
...
...
@@ -2185,7 +2186,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
/*
COM_FETCH handler: fetches requested amount of rows from cursor
COM_
STMT_
FETCH handler: fetches requested amount of rows from cursor
SYNOPSIS
mysql_stmt_fetch()
...
...
@@ -2290,13 +2291,13 @@ void mysql_stmt_reset(THD *thd, char *packet)
Note: we don't send any reply to that command.
*/
void
mysql_stmt_
fre
e
(
THD
*
thd
,
char
*
packet
)
void
mysql_stmt_
clos
e
(
THD
*
thd
,
char
*
packet
)
{
/* There is always space for 4 bytes in packet buffer */
ulong
stmt_id
=
uint4korr
(
packet
);
Prepared_statement
*
stmt
;
DBUG_ENTER
(
"mysql_stmt_
fre
e"
);
DBUG_ENTER
(
"mysql_stmt_
clos
e"
);
statistic_increment
(
thd
->
status_var
.
com_stmt_close
,
&
LOCK_status
);
if
(
!
(
stmt
=
find_prepared_statement
(
thd
,
stmt_id
,
"mysql_stmt_close"
)))
...
...
sql/sql_yacc.yy
View file @
f16b102f
...
...
@@ -914,7 +914,7 @@ deallocate:
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
if (thd->command == COM_PREPARE)
if (thd->command == COM_
STMT_
PREPARE)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
...
...
@@ -939,7 +939,7 @@ prepare:
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
if (thd->command == COM_PREPARE)
if (thd->command == COM_
STMT_
PREPARE)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
...
...
@@ -974,7 +974,7 @@ execute:
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
if (thd->command == COM_PREPARE)
if (thd->command == COM_
STMT_
PREPARE)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
...
...
@@ -6902,7 +6902,7 @@ param_marker:
{
THD *thd=YYTHD;
LEX *lex= thd->lex;
if (thd->command == COM_PREPARE)
if (thd->command == COM_
STMT_
PREPARE)
{
Item_param *item= new Item_param((uint) (lex->tok_start -
(uchar *) thd->query));
...
...
tests/mysql_client_test.c
View file @
f16b102f
...
...
@@ -13040,7 +13040,7 @@ static void test_bug9478()
int4store
(
buff
,
stmt
->
stmt_id
);
buff
[
4
]
=
0
;
/* Flag */
int4store
(
buff
+
5
,
1
);
/* Return 1 row */
rc
=
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_EXECUTE
,
buff
,
rc
=
((
*
mysql
->
methods
->
advanced_command
)(
mysql
,
COM_
STMT_
EXECUTE
,
buff
,
sizeof
(
buff
),
0
,
0
,
1
)
||
(
*
mysql
->
methods
->
read_query_result
)(
mysql
));
DIE_UNLESS
(
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