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
a39da98d
Commit
a39da98d
authored
Jan 18, 2003
by
venu@myvenu.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial multi query execution support
parent
529e4a76
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
4 deletions
+60
-4
include/mysql.h
include/mysql.h
+3
-1
include/mysql_com.h
include/mysql_com.h
+2
-0
libmysql/libmysql.c
libmysql/libmysql.c
+35
-2
sql/sql_lex.cc
sql/sql_lex.cc
+9
-1
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_parse.cc
sql/sql_parse.cc
+10
-0
No files found.
include/mysql.h
View file @
a39da98d
...
...
@@ -502,10 +502,12 @@ my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
my_bool
last_data
);
int
STDCALL
mysql_multi_query
(
MYSQL
*
mysql
,
const
char
*
query
,
unsigned
long
len
);
MYSQL_RES
*
STDCALL
mysql_next_result
(
MYSQL
*
mysql
);
MYSQL_RES
*
STDCALL
mysql_prepare_result
(
MYSQL_STMT
*
stmt
);
my_ulonglong
STDCALL
mysql_stmt_affected_rows
(
MYSQL_STMT
*
stmt
);
int
STDCALL
mysql_stmt_store_result
(
MYSQL_STMT
*
stmt
);
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
);
my_bool
STDCALL
mysql_next_result
(
MYSQL
*
mysql
);
/* new status messages */
...
...
include/mysql_com.h
View file @
a39da98d
...
...
@@ -106,10 +106,12 @@ enum enum_server_command
#define CLIENT_TRANSACTIONS 8192
/* Client knows about transactions */
#define CLIENT_PROTOCOL_41 16384
/* New 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768
/* New 4.1 authentication */
#define CLIENT_MULTI_QUERIES 65536
/* Enable/disable multi query support */
#define SERVER_STATUS_IN_TRANS 1
/* Transaction has started */
#define SERVER_STATUS_AUTOCOMMIT 2
/* Server in auto_commit mode */
#define SERVER_STATUS_MORE_RESULTS 4
/* More results on server */
#define SERVER_MORE_RESULTS_EXISTS 8
/* Multi query - next query exists */
#define MYSQL_ERRMSG_SIZE 200
#define NET_READ_TIMEOUT 30
/* Timeout on read */
...
...
libmysql/libmysql.c
View file @
a39da98d
...
...
@@ -3858,7 +3858,7 @@ static my_bool read_prepare_result(MYSQL_STMT *stmt)
}
if
(
!
(
stmt
->
params
=
(
MYSQL_BIND
*
)
alloc_root
(
&
stmt
->
mem_root
,
sizeof
(
MYSQL_BIND
)
*
(
stmt
->
param_count
+
(
param_count
+
field_count
))))
{
set_stmt_error
(
stmt
,
CR_OUT_OF_MEMORY
);
...
...
@@ -5161,3 +5161,36 @@ my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode)
DBUG_RETURN
((
my_bool
)
mysql_real_query
(
mysql
,
"set autocommit=1"
,
16
));
DBUG_RETURN
((
my_bool
)
mysql_real_query
(
mysql
,
"set autocommit=0"
,
16
));
}
/********************************************************************
Multi query execution related implementations
*********************************************************************/
/*
Returns if there are any more query results exists to be read using
mysql_next_result()
*/
my_bool
STDCALL
mysql_more_results
(
MYSQL
*
mysql
)
{
if
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
return
1
;
return
0
;
}
/*
Reads and returns the next query results
*/
my_bool
STDCALL
mysql_next_result
(
MYSQL
*
mysql
)
{
mysql
->
net
.
last_error
[
0
]
=
0
;
mysql
->
net
.
last_errno
=
0
;
mysql
->
affected_rows
=
~
(
my_ulonglong
)
0
;
if
(
mysql
->
last_used_con
->
server_status
&
SERVER_MORE_RESULTS_EXISTS
)
return
mysql_read_query_result
(
mysql
);
return
0
;
}
sql/sql_lex.cc
View file @
a39da98d
...
...
@@ -906,6 +906,14 @@ int yylex(void *arg, void *yythd)
case
STATE_COLON
:
// optional line terminator
if
(
yyPeek
())
{
if
(((
THD
*
)
yythd
)
->
client_capabilities
&
CLIENT_MULTI_QUERIES
)
{
lex
->
found_colon
=
(
char
*
)
lex
->
ptr
;
((
THD
*
)
yythd
)
->
server_status
|=
SERVER_MORE_RESULTS_EXISTS
;
lex
->
next_state
=
STATE_END
;
return
(
END_OF_INPUT
);
}
else
state
=
STATE_CHAR
;
// Return ';'
break
;
}
...
...
sql/sql_lex.h
View file @
a39da98d
...
...
@@ -414,6 +414,7 @@ typedef struct st_lex
char
*
backup_dir
;
/* For RESTORE/BACKUP */
char
*
to_log
;
/* For PURGE MASTER LOGS TO */
char
*
x509_subject
,
*
x509_issuer
,
*
ssl_cipher
;
char
*
found_colon
;
/* For multi queries - next query */
enum
SSL_type
ssl_type
;
/* defined in violite.h */
String
*
wild
;
sql_exchange
*
exchange
;
...
...
sql/sql_parse.cc
View file @
a39da98d
...
...
@@ -1426,6 +1426,14 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
mysql_slow_log
.
write
(
thd
,
thd
->
query
,
thd
->
query_length
,
start_of_query
);
}
}
if
(
command
==
COM_QUERY
&&
thd
->
lex
.
found_colon
)
{
/*
Multiple queries exits, execute them individually
*/
uint
length
=
thd
->
query_length
-
(
uint
)(
thd
->
lex
.
found_colon
-
thd
->
query
)
+
1
;
dispatch_command
(
command
,
thd
,
thd
->
lex
.
found_colon
,
length
);
}
thd
->
proc_info
=
"cleaning up"
;
VOID
(
pthread_mutex_lock
(
&
LOCK_thread_count
));
// For process list
thd
->
proc_info
=
0
;
...
...
@@ -3082,6 +3090,7 @@ mysql_init_query(THD *thd)
lex
->
olap
=
lex
->
describe
=
0
;
lex
->
derived_tables
=
false
;
lex
->
lock_option
=
TL_READ
;
lex
->
found_colon
=
0
;
thd
->
check_loops_counter
=
thd
->
select_number
=
lex
->
select_lex
.
select_number
=
1
;
thd
->
free_list
=
0
;
...
...
@@ -3090,6 +3099,7 @@ mysql_init_query(THD *thd)
thd
->
sent_row_count
=
thd
->
examined_row_count
=
0
;
thd
->
fatal_error
=
thd
->
rand_used
=
0
;
thd
->
possible_loops
=
0
;
thd
->
server_status
&=
~
SERVER_MORE_RESULTS_EXISTS
;
DBUG_VOID_RETURN
;
}
...
...
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