Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1933 05/06/07 14:17:56 konstantin@stripped +10 -0
Manual merge.
sql/sql_error.cc
1.34 05/06/07 14:17:50 konstantin@stripped +0 -2
Manual merge.
sql/sql_yacc.yy
1.390 05/06/07 14:13:55 konstantin@stripped +0 -0
Auto merged
sql/sql_select.cc
1.330 05/06/07 14:13:55 konstantin@stripped +0 -0
Auto merged
sql/sql_repl.cc
1.140 05/06/07 14:13:54 konstantin@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.449 05/06/07 14:13:54 konstantin@stripped +0 -0
Auto merged
sql/sql_handler.cc
1.69 05/06/07 14:13:54 konstantin@stripped +0 -0
Auto merged
sql/sql_class.h
1.236 05/06/07 14:13:54 konstantin@stripped +0 -0
Auto merged
sql/sp_head.cc
1.144 05/06/07 14:13:53 konstantin@stripped +0 -0
Auto merged
sql/item_subselect.cc
1.108 05/06/07 14:13:53 konstantin@stripped +0 -0
Auto merged
sql/item.h
1.135 05/06/07 14:13:53 konstantin@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: konstantin
# Host: dragonfly.local
# Root: /opt/local/work/mysql-5.0-7306-final/RESYNC
--- 1.134/sql/item.h 2005-06-05 18:08:42 +04:00
+++ 1.135/sql/item.h 2005-06-07 14:13:53 +04:00
@@ -337,6 +337,11 @@
*/
virtual longlong val_int()=0;
/*
+ This is just a shortcut to avoid the cast. You should still use
+ unsigned_flag to check the sign of the item.
+ */
+ inline ulonglong val_uint() { return (ulonglong) val_int(); }
+ /*
Return string representation of this item object.
SYNOPSIS
@@ -980,10 +985,10 @@
longlong value;
Item_int(int32 i,uint length=11) :value((longlong) i)
{ max_length=length; fixed= 1; }
-#ifdef HAVE_LONG_LONG
Item_int(longlong i,uint length=21) :value(i)
{ max_length=length; fixed= 1; }
-#endif
+ Item_int(ulonglong i, uint length= 21) :value((longlong)i)
+ { max_length=length; fixed= 1; unsigned_flag= 1; }
Item_int(const char *str_arg,longlong i,uint length) :value(i)
{ max_length=length; name=(char*) str_arg; fixed= 1; }
Item_int(const char *str_arg, uint length=64);
@@ -1021,9 +1026,8 @@
{
public:
Item_uint(const char *str_arg, uint length);
+ Item_uint(uint32 i) :Item_int((ulonglong) i, 10) {}
Item_uint(const char *str_arg, longlong i, uint length);
- Item_uint(uint32 i) :Item_int((longlong) i, 10)
- { unsigned_flag= 1; }
double val_real()
{ DBUG_ASSERT(fixed == 1); return ulonglong2double((ulonglong)value); }
String *val_str(String*);
--- 1.235/sql/sql_class.h 2005-06-07 12:30:02 +04:00
+++ 1.236/sql/sql_class.h 2005-06-07 14:13:54 +04:00
@@ -661,8 +661,8 @@
#endif
enum enum_state
{
- INITIALIZED= 0, PREPARED= 1, EXECUTED= 3, CONVENTIONAL_EXECUTION= 2,
- ERROR= -1
+ INITIALIZED= 0, INITIALIZED_FOR_SP= 1, PREPARED= 2,
+ CONVENTIONAL_EXECUTION= 3, EXECUTED= 4, ERROR= -1
};
enum_state state;
@@ -691,6 +691,7 @@
virtual Type type() const;
virtual ~Item_arena() {};
+ inline bool is_stmt_prepare() const { return state == INITIALIZED; }
inline bool is_stmt_prepare_or_first_sp_execute() const
{ return (int)state < (int)PREPARED; }
inline bool is_first_stmt_execute() const { return state == PREPARED; }
--- 1.448/sql/sql_parse.cc 2005-06-07 06:43:55 +04:00
+++ 1.449/sql/sql_parse.cc 2005-06-07 14:13:54 +04:00
@@ -2351,7 +2351,8 @@
{
SELECT_LEX *param= lex->unit.global_parameters;
if (!param->explicit_limit)
- param->select_limit= thd->variables.select_limit;
+ param->select_limit=
+ new Item_int((ulonglong)thd->variables.select_limit);
}
select_result *result=lex->result;
@@ -3141,13 +3142,15 @@
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if (update_precheck(thd, all_tables))
break;
+ DBUG_ASSERT(select_lex->offset_limit == 0);
+ unit->set_limit(select_lex);
res= (result= mysql_update(thd, all_tables,
select_lex->item_list,
lex->value_list,
select_lex->where,
select_lex->order_list.elements,
(ORDER *) select_lex->order_list.first,
- select_lex->select_limit,
+ unit->select_limit_cnt,
lex->duplicates, lex->ignore));
/* mysql_update return 2 if we need to switch to multi-update */
if (result != 2)
@@ -3253,9 +3256,11 @@
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if ((res= delete_precheck(thd, all_tables)))
break;
+ DBUG_ASSERT(select_lex->offset_limit == 0);
+ unit->set_limit(select_lex);
res = mysql_delete(thd, all_tables, select_lex->where,
&select_lex->order_list,
- select_lex->select_limit, select_lex->options);
+ unit->select_limit_cnt, select_lex->options);
break;
}
case SQLCOM_DELETE_MULTI:
@@ -3842,9 +3847,10 @@
*/
if (check_db_used(thd, all_tables))
goto error;
+ unit->set_limit(select_lex);
res= mysql_ha_read(thd, first_table, lex->ha_read_mode, lex->ident.str,
lex->insert_list, lex->ha_rkey_mode, select_lex->where,
- select_lex->select_limit, select_lex->offset_limit);
+ unit->select_limit_cnt, unit->offset_limit_cnt);
break;
case SQLCOM_BEGIN:
@@ -5126,7 +5132,6 @@
{
SELECT_LEX *select_lex= lex->current_select;
select_lex->init_select();
- select_lex->select_limit= HA_POS_ERROR;
lex->orig_sql_command= SQLCOM_END;
lex->wild= 0;
if (select_lex == &lex->select_lex)
@@ -5141,6 +5146,7 @@
mysql_new_select(LEX *lex, bool move_down)
{
SELECT_LEX *select_lex;
+ THD *thd;
DBUG_ENTER("mysql_new_select");
if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
@@ -5190,7 +5196,7 @@
fake->select_number= INT_MAX;
fake->make_empty_select();
fake->linkage= GLOBAL_OPTIONS_TYPE;
- fake->select_limit= HA_POS_ERROR;
+ fake->select_limit= 0;
}
}
@@ -5238,8 +5244,8 @@
{
lex->sql_command= SQLCOM_DELETE_MULTI;
mysql_init_select(lex);
- lex->select_lex.select_limit= lex->unit.select_limit_cnt=
- HA_POS_ERROR;
+ lex->select_lex.select_limit= 0;
+ lex->unit.select_limit_cnt= HA_POS_ERROR;
lex->select_lex.table_list.save_and_clear(&lex->auxilliary_table_list);
lex->lock_option= using_update_log ? TL_READ_NO_INSERT : TL_READ;
lex->query_tables= 0;
@@ -6753,8 +6759,7 @@
if (select_lex->order_list.elements)
msg= "ORDER BY";
- else if (select_lex->select_limit && select_lex->select_limit !=
- HA_POS_ERROR)
+ else if (select_lex->select_limit)
msg= "LIMIT";
if (msg)
{
--- 1.329/sql/sql_select.cc 2005-06-07 06:43:55 +04:00
+++ 1.330/sql/sql_select.cc 2005-06-07 14:13:55 +04:00
@@ -10077,7 +10077,7 @@
{
join->do_send_rows= 0;
if (join->unit->fake_select_lex)
- join->unit->fake_select_lex->select_limit= HA_POS_ERROR;
+ join->unit->fake_select_lex->select_limit= 0;
DBUG_RETURN(NESTED_LOOP_OK);
}
}
--- 1.389/sql/sql_yacc.yy 2005-06-06 22:21:28 +04:00
+++ 1.390/sql/sql_yacc.yy 2005-06-07 14:13:55 +04:00
@@ -721,7 +721,7 @@
signed_literal now_or_signed_literal opt_escape
sp_opt_default
simple_ident_nospvar simple_ident_q
- field_or_var
+ field_or_var limit_option
%type <item_num>
NUM_literal
@@ -5542,8 +5542,8 @@
{
LEX *lex= Lex;
SELECT_LEX *sel= lex->current_select;
- sel->offset_limit= 0L;
- sel->select_limit= HA_POS_ERROR;
+ sel->offset_limit= 0;
+ sel->select_limit= 0;
}
| limit_clause {}
;
@@ -5558,21 +5558,21 @@
;
limit_options:
- ulong_num
+ limit_option
{
SELECT_LEX *sel= Select;
sel->select_limit= $1;
- sel->offset_limit= 0L;
+ sel->offset_limit= 0;
sel->explicit_limit= 1;
}
- | ulong_num ',' ulong_num
+ | limit_option ',' limit_option
{
SELECT_LEX *sel= Select;
sel->select_limit= $3;
sel->offset_limit= $1;
sel->explicit_limit= 1;
}
- | ulong_num OFFSET_SYM ulong_num
+ | limit_option OFFSET_SYM limit_option
{
SELECT_LEX *sel= Select;
sel->select_limit= $1;
@@ -5580,18 +5580,23 @@
sel->explicit_limit= 1;
}
;
+limit_option:
+ param_marker
+ | 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); }
delete_limit_clause:
/* empty */
{
LEX *lex=Lex;
- lex->current_select->select_limit= HA_POS_ERROR;
+ lex->current_select->select_limit= 0;
}
- | LIMIT ulonglong_num
+ | LIMIT limit_option
{
SELECT_LEX *sel= Select;
- sel->select_limit= (ha_rows) $2;
+ sel->select_limit= $2;
sel->explicit_limit= 1;
};
@@ -7942,8 +7947,8 @@
LEX *lex=Lex;
lex->sql_command = SQLCOM_HA_READ;
lex->ha_rkey_mode= HA_READ_KEY_EXACT; /* Avoid purify warnings */
- lex->current_select->select_limit= 1;
- lex->current_select->offset_limit= 0L;
+ lex->current_select->select_limit= new Item_int(1);
+ lex->current_select->offset_limit= 0;
if (!lex->current_select->add_table_to_list(lex->thd, $2, 0, 0))
YYABORT;
}
--- 1.107/sql/item_subselect.cc 2005-06-06 22:21:25 +04:00
+++ 1.108/sql/item_subselect.cc 2005-06-07 14:13:53 +04:00
@@ -600,8 +600,8 @@
decimals= 0;
max_length= 1;
max_columns= engine->cols();
- /* We need only 1 row to determinate existence */
- unit->global_parameters->select_limit= 1;
+ /* We need only 1 row to determine existence */
+ unit->global_parameters->select_limit= new Item_int(1);
}
double Item_exists_subselect::val_real()
--- 1.143/sql/sp_head.cc 2005-06-06 15:36:19 +04:00
+++ 1.144/sql/sp_head.cc 2005-06-07 14:13:53 +04:00
@@ -319,7 +319,7 @@
*sp_lex_sp_key(const byte *ptr, uint *plen, my_bool first);
DBUG_ENTER("sp_head::sp_head");
- state= INITIALIZED;
+ state= INITIALIZED_FOR_SP;
m_backpatch.empty();
m_lex.empty();
hash_init(&m_sptabs, system_charset_info, 0, 0, 0, sp_table_key, 0, 0);
@@ -1077,7 +1077,7 @@
DBUG_ENTER("sp_head::restore_thd_mem_root");
Item *flist= free_list; // The old list
set_item_arena(thd); // Get new free_list and mem_root
- state= INITIALIZED;
+ state= INITIALIZED_FOR_SP;
DBUG_PRINT("info", ("mem_root 0x%lx returned from thd mem root 0x%lx",
(ulong) &mem_root, (ulong) &thd->mem_root));
--- 1.139/sql/sql_repl.cc 2005-06-06 22:21:27 +04:00
+++ 1.140/sql/sql_repl.cc 2005-06-07 14:13:54 +04:00
@@ -1316,6 +1316,7 @@
if (mysql_bin_log.is_open())
{
LEX_MASTER_INFO *lex_mi= &thd->lex->mi;
+ SELECT_LEX_UNIT *unit= &thd->lex->unit;
ha_rows event_count, limit_start, limit_end;
my_off_t pos = max(BIN_LOG_HEADER_SIZE, lex_mi->pos); // user-friendly
char search_file_name[FN_REFLEN], *name;
@@ -1324,8 +1325,9 @@
LOG_INFO linfo;
Log_event* ev;
- limit_start= thd->lex->current_select->offset_limit;
- limit_end= thd->lex->current_select->select_limit + limit_start;
+ unit->set_limit(thd->lex->current_select);
+ limit_start= unit->offset_limit_cnt;
+ limit_end= unit->select_limit_cnt;
name= search_file_name;
if (log_file_name)
--- 1.68/sql/sql_handler.cc 2005-06-06 22:21:27 +04:00
+++ 1.69/sql/sql_handler.cc 2005-06-07 14:13:54 +04:00
@@ -321,8 +321,8 @@
key_expr
ha_rkey_mode
cond
- select_limit
- offset_limit
+ select_limit_cnt
+ offset_limit_cnt
RETURN
FALSE ok
@@ -333,7 +333,7 @@
enum enum_ha_read_modes mode, char *keyname,
List<Item> *key_expr,
enum ha_rkey_function ha_rkey_mode, Item *cond,
- ha_rows select_limit,ha_rows offset_limit)
+ ha_rows select_limit_cnt, ha_rows offset_limit_cnt)
{
TABLE_LIST *hash_tables;
TABLE *table;
@@ -429,7 +429,6 @@
if (insert_fields(thd, tables, tables->db, tables->alias, &it, 0, 0))
goto err0;
- select_limit+=offset_limit;
protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
HANDLER_TABLES_HACK(thd);
@@ -447,7 +446,7 @@
table->file->init_table_handle_for_HANDLER();
- for (num_rows=0; num_rows < select_limit; )
+ for (num_rows=0; num_rows < select_limit_cnt; )
{
switch (mode) {
case RFIRST:
@@ -535,7 +534,7 @@
}
if (cond && !cond->val_int())
continue;
- if (num_rows >= offset_limit)
+ if (num_rows >= offset_limit_cnt)
{
Item *item;
protocol->prepare_for_resend();
--- 1.33/sql/sql_error.cc 2005-06-06 22:21:26 +04:00
+++ 1.34/sql/sql_error.cc 2005-06-07 14:17:50 +04:00
@@ -225,21 +225,21 @@
MYSQL_ERROR *err;
SELECT_LEX *sel= &thd->lex->select_lex;
- ha_rows offset= sel->offset_limit, limit= sel->select_limit;
+ SELECT_LEX_UNIT *unit= &thd->lex->unit;
+ ha_rows idx= 0;
Protocol *protocol=thd->protocol;
-
+
+ unit->set_limit(sel);
+
List_iterator_fast<MYSQL_ERROR> it(thd->warn_list);
while ((err= it++))
{
/* Skip levels that the user is not interested in */
if (!(levels_to_show & ((ulong) 1 << err->level)))
continue;
- if (offset)
- {
- offset--;
+ if (++idx <= unit->offset_limit_cnt)
continue;
- }
- if (limit-- == 0)
+ if (idx > unit->select_limit_cnt)
break;
protocol->prepare_for_resend();
protocol->store(warning_level_names[err->level],
| Thread |
|---|
| • bk commit into 5.0 tree (konstantin:1.1933) | konstantin | 7 Jun |