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
48d48bc9
Commit
48d48bc9
authored
Jan 14, 2006
by
konstantin@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A fix and a test case for Bug#12734 " prepared statement may
return incorrect result set for a select SQL request"
parent
977731b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
mysql-test/r/ps.result
mysql-test/r/ps.result
+34
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+30
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+6
-0
sql/item_cmpfunc.h
sql/item_cmpfunc.h
+1
-0
No files found.
mysql-test/r/ps.result
View file @
48d48bc9
...
...
@@ -718,3 +718,37 @@ execute stmt;
drop table t1;
set names default;
deallocate prepare stmt;
create table t1 (
word_id mediumint(8) unsigned not null default '0',
formatted varchar(20) not null default ''
);
insert into t1 values
(80,'pendant'), (475,'pretendants'), (989,'tendances'),
(1019,'cependant'),(1022,'abondance'),(1205,'independants'),
(13,'lessiver'),(25,'lambiner'),(46,'situer'),(71,'terminer'),
(82,'decrocher');
select count(*) from t1 where formatted like '%NDAN%';
count(*)
6
select count(*) from t1 where formatted like '%ER';
count(*)
5
prepare stmt from "select count(*) from t1 where formatted like ?";
set @like="%NDAN%";
execute stmt using @like;
count(*)
6
set @like="%ER";
execute stmt using @like;
count(*)
5
set @like="%NDAN%";
execute stmt using @like;
count(*)
6
set @like="%ER";
execute stmt using @like;
count(*)
5
deallocate prepare stmt;
drop table t1;
mysql-test/t/ps.test
View file @
48d48bc9
...
...
@@ -746,5 +746,35 @@ drop table t1;
set
names
default
;
deallocate
prepare
stmt
;
#
# A test case for Bug#12734 "prepared statement may return incorrect result
# set for a select SQL request": test that canDoTurboBM is reset for each
# execute of a prepared statement.
#
create
table
t1
(
word_id
mediumint
(
8
)
unsigned
not
null
default
'0'
,
formatted
varchar
(
20
)
not
null
default
''
);
insert
into
t1
values
(
80
,
'pendant'
),
(
475
,
'pretendants'
),
(
989
,
'tendances'
),
(
1019
,
'cependant'
),(
1022
,
'abondance'
),(
1205
,
'independants'
),
(
13
,
'lessiver'
),(
25
,
'lambiner'
),(
46
,
'situer'
),(
71
,
'terminer'
),
(
82
,
'decrocher'
);
select
count
(
*
)
from
t1
where
formatted
like
'%NDAN%'
;
select
count
(
*
)
from
t1
where
formatted
like
'%ER'
;
prepare
stmt
from
"select count(*) from t1 where formatted like ?"
;
set
@
like
=
"%NDAN%"
;
execute
stmt
using
@
like
;
set
@
like
=
"%ER"
;
execute
stmt
using
@
like
;
set
@
like
=
"%NDAN%"
;
execute
stmt
using
@
like
;
set
@
like
=
"%ER"
;
execute
stmt
using
@
like
;
deallocate
prepare
stmt
;
drop
table
t1
;
# End of 4.1 tests
sql/item_cmpfunc.cc
View file @
48d48bc9
...
...
@@ -2524,6 +2524,12 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
return
0
;
}
void
Item_func_like
::
cleanup
()
{
canDoTurboBM
=
FALSE
;
Item_bool_func2
::
cleanup
();
}
#ifdef USE_REGEX
bool
...
...
sql/item_cmpfunc.h
View file @
48d48bc9
...
...
@@ -911,6 +911,7 @@ public:
cond_result
eq_cmp_result
()
const
{
return
COND_TRUE
;
}
const
char
*
func_name
()
const
{
return
"like"
;
}
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
,
Item
**
ref
);
void
cleanup
();
};
#ifdef USE_REGEX
...
...
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