Commit ed47a1da authored by unknown's avatar unknown

Merge sinisa@work.mysql.com:/home/bk/mysql

into sinisa.nasamreza.org:/mnt/work/mysql

parents 614bc5a1 5b15b39c
...@@ -449,19 +449,21 @@ class Item_func_isnull :public Item_bool_func ...@@ -449,19 +449,21 @@ class Item_func_isnull :public Item_bool_func
void update_used_tables() void update_used_tables()
{ {
if (!args[0]->maybe_null) if (!args[0]->maybe_null)
used_tables_cache=0; /* is always false */ {
used_tables_cache= 0; /* is always false */
cached_value= (longlong) 0;
}
else else
{ {
args[0]->update_used_tables(); args[0]->update_used_tables();
used_tables_cache=args[0]->used_tables(); if (!(used_tables_cache=args[0]->used_tables()))
}
if (!used_tables_cache)
{ {
/* Remember if the value is always NULL or never NULL */ /* Remember if the value is always NULL or never NULL */
args[0]->val(); args[0]->val();
cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0; cached_value= args[0]->null_value ? (longlong) 1 : (longlong) 0;
} }
} }
}
optimize_type select_optimize() const { return OPTIMIZE_NULL; } optimize_type select_optimize() const { return OPTIMIZE_NULL; }
}; };
......
...@@ -58,6 +58,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -58,6 +58,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if ((*param->item)->type() != Item::INT_ITEM || if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc;
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; return 0;
} }
...@@ -65,6 +66,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -65,6 +66,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
param = param->next; param = param->next;
if (param->next) // no third parameter possible if (param->next) // no third parameter possible
{ {
delete pc;
net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMCOUNT_TO_PROCEDURE, proc_name);
return 0; return 0;
} }
...@@ -72,6 +74,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -72,6 +74,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if ((*param->item)->type() != Item::INT_ITEM || if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc;
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; return 0;
} }
...@@ -80,6 +83,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result, ...@@ -80,6 +83,7 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
else if ((*param->item)->type() != Item::INT_ITEM || else if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val() < 0) (*param->item)->val() < 0)
{ {
delete pc;
net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name); net_printf(&thd->net, ER_WRONG_PARAMETERS_TO_PROCEDURE, proc_name);
return 0; return 0;
} }
......
...@@ -288,11 +288,12 @@ class analyse: public Procedure ...@@ -288,11 +288,12 @@ class analyse: public Procedure
public: public:
uint max_tree_elements, max_treemem; uint max_tree_elements, max_treemem;
analyse(select_result *res) :Procedure(res, PROC_NO_SORT), rows(0), analyse(select_result *res) :Procedure(res, PROC_NO_SORT), f_info(0),
output_str_length(0) {} rows(0), output_str_length(0) {}
~analyse() ~analyse()
{ {
if (f_info)
for (field_info **f=f_info; f != f_end; f++) for (field_info **f=f_info; f != f_end; f++)
delete (*f); delete (*f);
} }
......
...@@ -156,7 +156,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0), ...@@ -156,7 +156,7 @@ THD::THD():user_time(0),fatal_error(0),last_insert_id_used(0),
*/ */
{ {
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
ulong tmp=(ulong) (rnd(&sql_rand) * ((ulong)~0L)); ulong tmp=(ulong) (rnd(&sql_rand) * ((ulong)0xffffffff));
randominit(&rand, tmp + (ulong) start_time, randominit(&rand, tmp + (ulong) start_time,
tmp + (ulong) thread_id); tmp + (ulong) thread_id);
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
......
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