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
7c2d0eea
Commit
7c2d0eea
authored
Nov 25, 2003
by
konstantin@oak.local
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for bug #1946:
"You can always mysql_real_query a query with placeholders after mysql_prepare()"
parent
5e6f94f4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
5 deletions
+31
-5
sql/sql_class.cc
sql/sql_class.cc
+2
-2
sql/sql_class.h
sql/sql_class.h
+0
-1
sql/sql_prepare.cc
sql/sql_prepare.cc
+0
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
tests/client_test.c
tests/client_test.c
+28
-0
No files found.
sql/sql_class.cc
View file @
7c2d0eea
...
...
@@ -90,8 +90,8 @@ THD::THD():user_time(0), is_fatal_error(0),
{
host
=
user
=
priv_user
=
db
=
query
=
ip
=
0
;
host_or_ip
=
"connecting host"
;
locked
=
killed
=
some_tables_deleted
=
no_errors
=
password
=
query_start_used
=
prepare_command
=
0
;
locked
=
killed
=
some_tables_deleted
=
no_errors
=
password
=
0
;
query_start_used
=
0
;
count_cuted_fields
=
CHECK_FIELD_IGNORE
;
db_length
=
query_length
=
col_access
=
0
;
query_error
=
tmp_table_used
=
0
;
...
...
sql/sql_class.h
View file @
7c2d0eea
...
...
@@ -606,7 +606,6 @@ public:
bool
system_thread
,
in_lock_tables
,
global_read_lock
;
bool
query_error
,
bootstrap
,
cleanup_done
;
bool
volatile
killed
;
bool
prepare_command
;
bool
tmp_table_used
;
bool
charset_is_system_charset
,
charset_is_collation_connection
;
bool
slow_command
;
...
...
sql/sql_prepare.cc
View file @
7c2d0eea
...
...
@@ -785,7 +785,6 @@ static bool parse_prepare_query(PREP_STMT *stmt,
mysql_init_query
(
thd
);
LEX
*
lex
=
lex_start
(
thd
,
(
uchar
*
)
packet
,
length
);
lex
->
safe_to_cache_query
=
0
;
thd
->
prepare_command
=
TRUE
;
thd
->
lex
.
param_count
=
0
;
if
(
!
yyparse
((
void
*
)
thd
)
&&
!
thd
->
is_fatal_error
)
error
=
send_prepare_results
(
stmt
);
...
...
sql/sql_yacc.yy
View file @
7c2d0eea
...
...
@@ -4355,7 +4355,7 @@ param_marker:
'?'
{
LEX *lex=Lex;
if (YYTHD->
prepare_command
)
if (YYTHD->
command == COM_PREPARE
)
{
lex->param_list.push_back($$=new Item_param((uint)(lex->tok_start-(uchar *)YYTHD->query)));
lex->param_count++;
...
...
tests/client_test.c
View file @
7c2d0eea
...
...
@@ -8065,6 +8065,32 @@ static void test_bug1500()
mysql_stmt_close
(
stmt
);
}
static
void
test_bug1946
()
{
MYSQL_STMT
*
stmt
;
int
rc
;
myheader
(
"test_bug1946"
);
const
char
*
query
=
"INSERT INTO prepare_command VALUES (?)"
;
rc
=
mysql_query
(
mysql
,
"DROP TABLE IF EXISTS prepare_command"
);
myquery
(
rc
);
rc
=
mysql_query
(
mysql
,
"CREATE TABLE prepare_command(ID INT)"
);
myquery
(
rc
);
stmt
=
mysql_prepare
(
mysql
,
query
,
strlen
(
query
));
mystmt_init
(
stmt
);
rc
=
mysql_real_query
(
mysql
,
query
,
strlen
(
query
));
assert
(
rc
!=
0
);
fprintf
(
stdout
,
"Got error (as expected):
\n
"
);
myerror
(
NULL
);
mysql_stmt_close
(
stmt
);
rc
=
mysql_query
(
mysql
,
"DROP TABLE prepare_command"
);
}
/*
Read and parse arguments and MySQL options from my.cnf
*/
...
...
@@ -8208,6 +8234,8 @@ int main(int argc, char **argv)
/* Used for internal new development debugging */
test_drop_temp
();
/* to test DROP TEMPORARY TABLE Access checks */
#endif
test_bug1946
();
/* test that placeholders are allowed only in
prepared queries */
test_fetch_seek
();
/* to test stmt seek() functions */
test_fetch_nobuffs
();
/* to fecth without prior bound buffers */
test_open_direct
();
/* direct execution in the middle of open stmts */
...
...
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