mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merged 4.1 to 5.0.
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union include/mysql_com.h: Auto merged libmysql/libmysql.c: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/subselect.test: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_func.cc: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/protocol.cc: Auto merged sql/records.cc: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_cache.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_delete.cc: Auto merged sql/sql_derived.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_repl.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged
This commit is contained in:
@@ -36,6 +36,8 @@
|
||||
#endif
|
||||
#include <mysys_err.h>
|
||||
|
||||
#include <sp_rcontext.h>
|
||||
|
||||
/*
|
||||
The following is used to initialise Table_ident with a internal
|
||||
table name
|
||||
@@ -86,12 +88,13 @@ extern "C" void free_user_var(user_var_entry *entry)
|
||||
THD::THD():user_time(0), is_fatal_error(0),
|
||||
last_insert_id_used(0),
|
||||
insert_id_used(0), rand_used(0), in_lock_tables(0),
|
||||
global_read_lock(0), bootstrap(0)
|
||||
global_read_lock(0), bootstrap(0), spcont(NULL)
|
||||
{
|
||||
host=user=priv_user=db=query=ip=0;
|
||||
host_or_ip= "connecting host";
|
||||
locked=killed=count_cuted_fields=some_tables_deleted=no_errors=password=
|
||||
locked=count_cuted_fields=some_tables_deleted=no_errors=password=
|
||||
query_start_used=prepare_command=0;
|
||||
killed= NOT_KILLED;
|
||||
db_length=query_length=col_access=0;
|
||||
query_error= tmp_table_used= 0;
|
||||
next_insert_id=last_insert_id=0;
|
||||
@@ -181,7 +184,7 @@ THD::THD():user_time(0), is_fatal_error(0),
|
||||
if (open_cached_file(&transaction.trans_log,
|
||||
mysql_tmpdir, LOG_PREFIX, binlog_cache_size,
|
||||
MYF(MY_WME)))
|
||||
killed=1;
|
||||
killed= KILL_CONNECTION;
|
||||
transaction.trans_log.end_of_file= max_binlog_cache_size;
|
||||
}
|
||||
#endif
|
||||
@@ -196,6 +199,9 @@ THD::THD():user_time(0), is_fatal_error(0),
|
||||
pthread_mutex_unlock(&LOCK_thread_count);
|
||||
randominit(&rand, tmp + (ulong) &rand, tmp + (ulong) ::query_id);
|
||||
}
|
||||
|
||||
/* QQ init the temporary function cache */
|
||||
spfuns.empty();
|
||||
}
|
||||
|
||||
|
||||
@@ -286,6 +292,10 @@ void THD::cleanup(void)
|
||||
pthread_mutex_unlock(&LOCK_user_locks);
|
||||
ull= 0;
|
||||
}
|
||||
|
||||
// extern void sp_clear_function_cache(THD *);
|
||||
// sp_clear_function_cache(this);
|
||||
|
||||
cleanup_done=1;
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@@ -337,14 +347,14 @@ THD::~THD()
|
||||
}
|
||||
|
||||
|
||||
void THD::awake(bool prepare_to_die)
|
||||
void THD::awake(THD::killed_state state_to_set)
|
||||
{
|
||||
THD_CHECK_SENTRY(this);
|
||||
safe_mutex_assert_owner(&LOCK_delete);
|
||||
|
||||
if (prepare_to_die)
|
||||
killed = 1;
|
||||
thr_alarm_kill(real_id);
|
||||
killed= state_to_set;
|
||||
if (state_to_set != THD::KILL_QUERY)
|
||||
thr_alarm_kill(real_id);
|
||||
#ifdef SIGNAL_WITH_VIO_CLOSE
|
||||
close_active_vio();
|
||||
#endif
|
||||
@@ -461,7 +471,7 @@ CHANGED_TABLE_LIST* THD::changed_table_dup(const char *key, long key_length)
|
||||
{
|
||||
my_error(EE_OUTOFMEMORY, MYF(ME_BELL),
|
||||
ALIGN_SIZE(sizeof(TABLE_LIST)) + key_length + 1);
|
||||
killed= 1;
|
||||
killed= KILL_CONNECTION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1007,9 +1017,12 @@ bool select_exists_subselect::send_data(List<Item> &items)
|
||||
int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
||||
{
|
||||
List_iterator_fast<Item> li(list);
|
||||
List_iterator_fast<LEX_STRING> gl(var_list);
|
||||
List_iterator_fast<my_var> gl(var_list);
|
||||
Item *item;
|
||||
my_var *mv;
|
||||
LEX_STRING *ls;
|
||||
|
||||
row_count= 0;
|
||||
if (var_list.elements != list.elements)
|
||||
{
|
||||
my_error(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, MYF(0));
|
||||
@@ -1018,19 +1031,39 @@ int select_dumpvar::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
||||
unit=u;
|
||||
while ((item=li++))
|
||||
{
|
||||
ls= gl++;
|
||||
Item_func_set_user_var *xx = new Item_func_set_user_var(*ls,item);
|
||||
xx->fix_fields(thd,(TABLE_LIST*) thd->lex.select_lex.table_list.first,&item);
|
||||
xx->fix_length_and_dec();
|
||||
vars.push_back(xx);
|
||||
mv=gl++;
|
||||
ls= &mv->s;
|
||||
if (mv->local)
|
||||
{
|
||||
(void)local_vars.push_back(new Item_splocal(mv->offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
Item_func_set_user_var *xx = new Item_func_set_user_var(*ls,item);
|
||||
xx->fix_fields(thd,(TABLE_LIST*) thd->lex.select_lex.table_list.first,&item);
|
||||
xx->fix_length_and_dec();
|
||||
vars.push_back(xx);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool select_dumpvar::send_data(List<Item> &items)
|
||||
{
|
||||
List_iterator_fast<Item_func_set_user_var> li(vars);
|
||||
List_iterator_fast<Item_splocal> var_li(local_vars);
|
||||
List_iterator_fast<my_var> my_li(var_list);
|
||||
List_iterator_fast<Item> it(items);
|
||||
Item_func_set_user_var *xx;
|
||||
Item_splocal *yy;
|
||||
Item *item;
|
||||
my_var *zz;
|
||||
DBUG_ENTER("send_data");
|
||||
if (unit->offset_limit_cnt)
|
||||
{ // using limit offset,count
|
||||
unit->offset_limit_cnt--;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
if (unit->offset_limit_cnt)
|
||||
{ // Using limit offset,count
|
||||
@@ -1042,8 +1075,21 @@ bool select_dumpvar::send_data(List<Item> &items)
|
||||
my_error(ER_TOO_MANY_ROWS, MYF(0));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
while ((xx=li++))
|
||||
xx->update();
|
||||
while ((zz=my_li++) && (item=it++))
|
||||
{
|
||||
if (zz->local)
|
||||
{
|
||||
if ((yy=var_li++))
|
||||
{
|
||||
thd->spcont->set_item(yy->get_offset(), item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((xx=li++))
|
||||
xx->update();
|
||||
}
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user