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
e2d21645
Commit
e2d21645
authored
May 24, 2007
by
ramil/ram@ramil.myoffice.izhnet.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/ram/work/b28464.new/b28464.new.5.0
into mysql.com:/home/ram/work/b28464.new/b28464.new.5.1
parents
7327f420
63b2e8d9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
1 deletion
+42
-1
mysql-test/r/limit.result
mysql-test/r/limit.result
+11
-0
mysql-test/t/limit.test
mysql-test/t/limit.test
+17
-0
sql/item.cc
sql/item.cc
+3
-0
sql/item.h
sql/item.h
+8
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-0
No files found.
mysql-test/r/limit.result
View file @
e2d21645
...
...
@@ -91,3 +91,14 @@ select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
c
28
drop table t1;
prepare s from "select 1 limit ?";
set @a='qwe';
execute s using @a;
ERROR HY000: Incorrect arguments to EXECUTE
prepare s from "select 1 limit 1, ?";
execute s using @a;
ERROR HY000: Incorrect arguments to EXECUTE
prepare s from "select 1 limit ?, ?";
execute s using @a, @a;
ERROR HY000: Incorrect arguments to EXECUTE
End of 5.0 tests
mysql-test/t/limit.test
View file @
e2d21645
...
...
@@ -71,3 +71,20 @@ explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
select
sum
(
a
)
c
FROM
t1
WHERE
a
>
0
ORDER
BY
c
LIMIT
3
;
drop
table
t1
;
# End of 4.1 tests
#
# Bug #28464: a string argument to 'limit ?' PS
#
prepare
s
from
"select 1 limit ?"
;
set
@
a
=
'qwe'
;
--
error
1210
execute
s
using
@
a
;
prepare
s
from
"select 1 limit 1, ?"
;
--
error
1210
execute
s
using
@
a
;
prepare
s
from
"select 1 limit ?, ?"
;
--
error
1210
execute
s
using
@
a
,
@
a
;
--
echo
End
of
5.0
tests
sql/item.cc
View file @
e2d21645
...
...
@@ -2348,6 +2348,7 @@ default_set_param_func(Item_param *param,
Item_param
::
Item_param
(
unsigned
pos_in_query_arg
)
:
strict_type
(
FALSE
),
state
(
NO_VALUE
),
item_result_type
(
STRING_RESULT
),
/* Don't pretend to be a literal unless value for this item is set. */
...
...
@@ -2542,6 +2543,8 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry)
if
(
entry
&&
entry
->
value
)
{
item_result_type
=
entry
->
type
;
if
(
strict_type
&&
required_result_type
!=
item_result_type
)
DBUG_RETURN
(
1
);
switch
(
item_result_type
)
{
case
REAL_RESULT
:
set_double
(
*
(
double
*
)
entry
->
value
);
...
...
sql/item.h
View file @
e2d21645
...
...
@@ -1456,8 +1456,10 @@ class Item_param :public Item
char
cnvbuf
[
MAX_FIELD_WIDTH
];
String
cnvstr
;
Item
*
cnvitem
;
public:
bool
strict_type
;
enum
Item_result
required_result_type
;
public:
enum
enum_item_param_state
{
NO_VALUE
,
NULL_VALUE
,
INT_VALUE
,
REAL_VALUE
,
...
...
@@ -1585,6 +1587,11 @@ public:
Otherwise return FALSE.
*/
bool
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
;
void
set_strict_type
(
enum
Item_result
result_type_arg
)
{
strict_type
=
TRUE
;
required_result_type
=
result_type_arg
;
}
};
...
...
sql/sql_yacc.yy
View file @
e2d21645
...
...
@@ -7911,6 +7911,9 @@ limit_options:
;
limit_option:
param_marker
{
((Item_param *) $1)->set_strict_type(INT_RESULT);
}
| ULONGLONG_NUM { $$= new Item_uint($1.str, $1.length); }
| LONG_NUM { $$= new Item_uint($1.str, $1.length); }
| NUM { $$= new Item_uint($1.str, $1.length); }
...
...
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