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
978ba8f4
Commit
978ba8f4
authored
Apr 27, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for BUG#3567: Disallow several SQL statements inside a Prepared Statement.
parent
c41919f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
2 deletions
+34
-2
sql/sql_lex.cc
sql/sql_lex.cc
+4
-2
tests/client_test.c
tests/client_test.c
+30
-0
No files found.
sql/sql_lex.cc
View file @
978ba8f4
...
...
@@ -882,10 +882,12 @@ int yylex(void *arg, void *yythd)
case
MY_LEX_COLON
:
// optional line terminator
if
(
yyPeek
())
{
if
(((
THD
*
)
yythd
)
->
client_capabilities
&
CLIENT_MULTI_STATEMENTS
)
THD
*
thd
=
(
THD
*
)
yythd
;
if
((
thd
->
client_capabilities
&
CLIENT_MULTI_STATEMENTS
)
&&
(
thd
->
command
!=
COM_PREPARE
))
{
lex
->
found_colon
=
(
char
*
)
lex
->
ptr
;
((
THD
*
)
yythd
)
->
server_status
|=
SERVER_MORE_RESULTS_EXISTS
;
thd
->
server_status
|=
SERVER_MORE_RESULTS_EXISTS
;
lex
->
next_state
=
MY_LEX_END
;
return
(
END_OF_INPUT
);
}
...
...
tests/client_test.c
View file @
978ba8f4
...
...
@@ -4940,6 +4940,34 @@ DROP TABLE IF EXISTS test_multi_tab";
mysql_close
(
mysql_local
);
}
/********************************************************
* Check that Prepared statement cannot contain several *
* SQL statements *
*********************************************************/
static
void
test_prepare_multi_statements
()
{
MYSQL
*
mysql_local
;
MYSQL_STMT
*
stmt
;
myheader
(
"test_prepare_multi_statements"
);
if
(
!
(
mysql_local
=
mysql_init
(
NULL
)))
{
fprintf
(
stdout
,
"
\n
mysql_init() failed"
);
exit
(
1
);
}
if
(
!
(
mysql_real_connect
(
mysql_local
,
opt_host
,
opt_user
,
opt_password
,
current_db
,
opt_port
,
opt_unix_socket
,
CLIENT_MULTI_STATEMENTS
)))
{
fprintf
(
stdout
,
"
\n
connection failed(%s)"
,
mysql_error
(
mysql_local
));
exit
(
1
);
}
strmov
(
query
,
"select 1; select 'another value'"
);
stmt
=
mysql_simple_prepare
(
mysql_local
,
query
);
mystmt_init_r
(
stmt
);
mysql_close
(
mysql_local
);
}
/********************************************************
* to test simple bind store result *
...
...
@@ -9210,6 +9238,8 @@ int main(int argc, char **argv)
test_prepare_field_result
();
/* prepare meta info */
test_multi_stmt
();
/* multi stmt test */
test_multi_statements
();
/* test multi statement execution */
test_prepare_multi_statements
();
/* check that multi statements are
disabled in PS */
test_store_result
();
/* test the store_result */
test_store_result1
();
/* test store result without buffers */
test_store_result2
();
/* test store result for misc case */
...
...
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