Commit 3dd2ed30 authored by gkodinov/kgeorge@magare.gmz's avatar gkodinov/kgeorge@magare.gmz

Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt

into  magare.gmz:/home/kgeorge/mysql/autopush/B30639-5.1-opt
parents 7c87dc6e c2abf960
......@@ -15,6 +15,8 @@
/* Defines for Win32 to make it compatible for MySQL */
#define BIG_TABLES
#ifdef __WIN2000__
/* We have to do this define before including windows.h to get the AWE API
functions */
......
......@@ -4082,3 +4082,20 @@ x
1
DROP VIEW v1, v2, v3;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SELECT a FROM t1 ORDER BY a LIMIT 2;
a
1
2
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
a
3
4
5
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
a
3
4
5
DROP TABLE t1;
......@@ -3474,3 +3474,13 @@ DROP VIEW v1, v2, v3;
--enable_ps_protocol
--echo End of 5.0 tests
#
# Bug #30639: limit offset,rowcount wraps when rowcount >= 2^32 in windows
#
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SELECT a FROM t1 ORDER BY a LIMIT 2;
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967296;
SELECT a FROM t1 ORDER BY a LIMIT 2,4294967297;
DROP TABLE t1;
......@@ -2397,10 +2397,19 @@ st_lex::copy_db_to(char **p_db, size_t *p_db_length) const
void st_select_lex_unit::set_limit(st_select_lex *sl)
{
ha_rows select_limit_val;
ulonglong val;
DBUG_ASSERT(! thd->stmt_arena->is_stmt_prepare());
select_limit_val= (ha_rows)(sl->select_limit ? sl->select_limit->val_uint() :
HA_POS_ERROR);
val= sl->select_limit ? sl->select_limit->val_uint() : HA_POS_ERROR;
select_limit_val= (ha_rows)val;
#ifndef BIG_TABLES
/*
Check for overflow : ha_rows can be smaller then ulonglong if
BIG_TABLES is off.
*/
if (val != (ulonglong)select_limit_val)
select_limit_val= HA_POS_ERROR;
#endif
offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() :
ULL(0));
select_limit_cnt= select_limit_val + offset_limit_cnt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment