summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-09-19 18:02:59 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-09-19 18:02:59 +0300
commitff4a94b779acc5e566e17131872484fbfa660244 (patch)
treebf1411b693049fac521a2ff38b77a72c6a8ab188 /sql/sql_lex.cc
parented34aabe653d5863b8fcd03960b8a8e3201e3991 (diff)
parent717dba2422be48471b651e15cf621a7ec9d4afa3 (diff)
downloadmariadb-git-ff4a94b779acc5e566e17131872484fbfa660244.tar.gz
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into magare.gmz:/home/kgeorge/mysql/autopush/B30639-5.1-opt mysql-test/r/select.result: Auto merged mysql-test/t/select.test: Auto merged sql/sql_lex.cc: Auto merged
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc13
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 6b94505e46e..0a5f83af400 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -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;