Commit 55e776d1 authored by unknown's avatar unknown

Post-merge fixes.

parent 138f0adf
...@@ -1248,10 +1248,10 @@ Variable_name Value ...@@ -1248,10 +1248,10 @@ Variable_name Value
Qcache_queries_in_cache 0 Qcache_queries_in_cache 0
show status like "Qcache_inserts"; show status like "Qcache_inserts";
Variable_name Value Variable_name Value
Qcache_inserts 41 Qcache_inserts 1
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 13 Qcache_hits 1
/**/ select * from t1; /**/ select * from t1;
a a
/**/ select * from t1; /**/ select * from t1;
...@@ -1261,8 +1261,8 @@ Variable_name Value ...@@ -1261,8 +1261,8 @@ Variable_name Value
Qcache_queries_in_cache 1 Qcache_queries_in_cache 1
show status like "Qcache_inserts"; show status like "Qcache_inserts";
Variable_name Value Variable_name Value
Qcache_inserts 42 Qcache_inserts 2
show status like "Qcache_hits"; show status like "Qcache_hits";
Variable_name Value Variable_name Value
Qcache_hits 14 Qcache_hits 2
drop table t1; drop table t1;
...@@ -29,10 +29,10 @@ drop table t1,t2; ...@@ -29,10 +29,10 @@ drop table t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
html varchar(5) default NULL, html varchar(5) default NULL,
rin int(11) default '0', rin int(11) default '0',
out int(11) default '0' rout int(11) default '0'
) TYPE=MyISAM; ) TYPE=MyISAM;
INSERT INTO t1 VALUES ('1',1,0); INSERT INTO t1 VALUES ('1',1,0);
SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
html prod html prod
1 0.00 1 0.00
drop table t1; drop table t1;
...@@ -35,7 +35,7 @@ call foo(); ...@@ -35,7 +35,7 @@ call foo();
ERROR HY000: PROCEDURE foo does not exist ERROR HY000: PROCEDURE foo does not exist
drop procedure if exists foo; drop procedure if exists foo;
Warnings: Warnings:
Warning 1272 PROCEDURE foo does not exist Warning 1275 PROCEDURE foo does not exist
create procedure foo() create procedure foo()
foo: loop foo: loop
leave bar; leave bar;
......
...@@ -46,8 +46,6 @@ alter table t8 rename t7; ...@@ -46,8 +46,6 @@ alter table t8 rename t7;
rename table t7 to t9; rename table t7 to t9;
drop table t1; drop table t1;
Got one of the listed errors Got one of the listed errors
Warnings:
Note 1008 Can't drop database 'test_mysqltest'; database doesn't exist
Got one of the listed errors Got one of the listed errors
Got one of the listed errors Got one of the listed errors
Got one of the listed errors Got one of the listed errors
......
...@@ -311,7 +311,7 @@ set sql_log_bin=1; ...@@ -311,7 +311,7 @@ set sql_log_bin=1;
set sql_log_off=1; set sql_log_off=1;
set sql_log_update=1; set sql_log_update=1;
Warnings: Warnings:
Note 1282 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored. Note 1285 The update log is deprecated and replaced by the binary log. SET SQL_LOG_UPDATE has been ignored.
set sql_low_priority_updates=1; set sql_low_priority_updates=1;
set sql_max_join_size=200; set sql_max_join_size=200;
select @@sql_max_join_size,@@max_join_size; select @@sql_max_join_size,@@max_join_size;
......
...@@ -38,11 +38,11 @@ drop table t1,t2; ...@@ -38,11 +38,11 @@ drop table t1,t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
html varchar(5) default NULL, html varchar(5) default NULL,
rin int(11) default '0', rin int(11) default '0',
out int(11) default '0' rout int(11) default '0'
) TYPE=MyISAM; ) TYPE=MyISAM;
INSERT INTO t1 VALUES ('1',1,0); INSERT INTO t1 VALUES ('1',1,0);
SELECT DISTINCT html,SUM(out)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin; SELECT DISTINCT html,SUM(rout)/(SUM(rin)+1) as 'prod' FROM t1 GROUP BY rin;
drop table t1; drop table t1;
...@@ -32,18 +32,18 @@ create function func1() returns int ...@@ -32,18 +32,18 @@ create function func1() returns int
return 42| return 42|
# Can't create recursively # Can't create recursively
--error 1270 --error 1273
create procedure foo() create procedure foo()
create procedure bar() set @x=3| create procedure bar() set @x=3|
--error 1270 --error 1273
create procedure foo() create procedure foo()
create function bar() returns double return 2.3| create function bar() returns double return 2.3|
# Already exists # Already exists
--error 1271 --error 1274
create procedure proc1() create procedure proc1()
set @x = 42| set @x = 42|
--error 1271 --error 1274
create function func1() returns int create function func1() returns int
return 42| return 42|
...@@ -51,32 +51,32 @@ drop procedure proc1| ...@@ -51,32 +51,32 @@ drop procedure proc1|
drop function func1| drop function func1|
# Does not exist # Does not exist
--error 1272 --error 1275
alter procedure foo| alter procedure foo|
--error 1272 --error 1275
alter function foo| alter function foo|
--error 1272 --error 1275
drop procedure foo| drop procedure foo|
--error 1272 --error 1275
drop function foo| drop function foo|
--error 1272 --error 1275
call foo()| call foo()|
drop procedure if exists foo| drop procedure if exists foo|
# LEAVE/ITERATE with no match # LEAVE/ITERATE with no match
--error 1275 --error 1278
create procedure foo() create procedure foo()
foo: loop foo: loop
leave bar; leave bar;
end loop| end loop|
--error 1275 --error 1278
create procedure foo() create procedure foo()
foo: loop foo: loop
iterate bar; iterate bar;
end loop| end loop|
# Redefining label # Redefining label
--error 1276 --error 1279
create procedure foo() create procedure foo()
foo: loop foo: loop
foo: loop foo: loop
...@@ -85,14 +85,14 @@ foo: loop ...@@ -85,14 +85,14 @@ foo: loop
end loop foo| end loop foo|
# End label mismatch # End label mismatch
--error 1277 --error 1280
create procedure foo() create procedure foo()
foo: loop foo: loop
set @x=2; set @x=2;
end loop bar| end loop bar|
# Referring to undef variable # Referring to undef variable
--error 1278 --error 1281
create procedure foo(out x int) create procedure foo(out x int)
begin begin
declare y int; declare y int;
...@@ -106,17 +106,17 @@ begin ...@@ -106,17 +106,17 @@ begin
select name from mysql.proc; select name from mysql.proc;
select type from mysql.proc; select type from mysql.proc;
end| end|
--error 1279 --error 1282
call foo()| call foo()|
drop procedure foo| drop procedure foo|
# RETURN in FUNCTION only # RETURN in FUNCTION only
--error 1280 --error 1283
create procedure foo() create procedure foo()
return 42| return 42|
# Doesn't allow queries in FUNCTIONs (for now :-( ) # Doesn't allow queries in FUNCTIONs (for now :-( )
--error 1281 --error 1284
create function foo() returns int create function foo() returns int
begin begin
declare x int; declare x int;
...@@ -130,13 +130,13 @@ create procedure p(x int) ...@@ -130,13 +130,13 @@ create procedure p(x int)
create function f(x int) returns int create function f(x int) returns int
return x+42| return x+42|
--error 1285 --error 1288
call p()| call p()|
--error 1285 --error 1288
call p(1, 2)| call p(1, 2)|
--error 1285 --error 1288
select f()| select f()|
--error 1285 --error 1288
select f(1, 2)| select f(1, 2)|
drop procedure p| drop procedure p|
......
...@@ -54,7 +54,7 @@ Item::Item(): ...@@ -54,7 +54,7 @@ Item::Item():
command => we should check thd->lex.current_select on zero (thd->lex command => we should check thd->lex.current_select on zero (thd->lex
can be uninitialised) can be uninitialised)
*/ */
if (thd->lex.current_select) if (thd->lex->current_select)
{ {
SELECT_LEX_NODE::enum_parsing_place place= SELECT_LEX_NODE::enum_parsing_place place=
thd->lex->current_select->parsing_place; thd->lex->current_select->parsing_place;
......
...@@ -501,7 +501,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -501,7 +501,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
SELECT_LEX_UNIT *unit= select_lex->master_unit(); SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this); substitution= optimizer= new Item_in_optimizer(left_expr, this);
SELECT_LEX *current= thd->lex.current_select, *up; SELECT_LEX *current= thd->lex->current_select, *up;
thd->lex->current_select= up= current->return_after_parsing(); thd->lex->current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter //optimizer never use Item **ref => we can pass 0 as parameter
...@@ -603,7 +603,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, ...@@ -603,7 +603,7 @@ Item_in_subselect::single_value_transformer(JOIN *join,
// fix_field of item will be done in time of substituting // fix_field of item will be done in time of substituting
substitution= item; substitution= item;
have_to_be_excluded= 1; have_to_be_excluded= 1;
if (thd->lex.describe) if (thd->lex->describe)
{ {
char warn_buff[MYSQL_ERRMSG_SIZE]; char warn_buff[MYSQL_ERRMSG_SIZE];
sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number);
...@@ -634,15 +634,15 @@ Item_in_subselect::row_value_transformer(JOIN *join, ...@@ -634,15 +634,15 @@ Item_in_subselect::row_value_transformer(JOIN *join,
SELECT_LEX_UNIT *unit= select_lex->master_unit(); SELECT_LEX_UNIT *unit= select_lex->master_unit();
substitution= optimizer= new Item_in_optimizer(left_expr, this); substitution= optimizer= new Item_in_optimizer(left_expr, this);
SELECT_LEX *current= thd->lex.current_select, *up; SELECT_LEX *current= thd->lex->current_select, *up;
thd->lex.current_select= up= current->return_after_parsing(); thd->lex->current_select= up= current->return_after_parsing();
//optimizer never use Item **ref => we can pass 0 as parameter //optimizer never use Item **ref => we can pass 0 as parameter
if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0)) if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0))
{ {
thd->lex.current_select= current; thd->lex->current_select= current;
DBUG_RETURN(ERROR); DBUG_RETURN(ERROR);
} }
thd->lex.current_select= current; thd->lex->current_select= current;
unit->dependent= 1; unit->dependent= 1;
} }
......
...@@ -2009,7 +2009,6 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2009,7 +2009,6 @@ static int init_common_variables(const char *conf_file_name, int argc,
before MY_INIT(). So we do it here. before MY_INIT(). So we do it here.
*/ */
mysql_log.init_pthread_objects(); mysql_log.init_pthread_objects();
mysql_update_log.init_pthread_objects();
mysql_slow_log.init_pthread_objects(); mysql_slow_log.init_pthread_objects();
mysql_bin_log.init_pthread_objects(); mysql_bin_log.init_pthread_objects();
......
...@@ -2385,7 +2385,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli) ...@@ -2385,7 +2385,7 @@ static int exec_relay_log_event(THD* thd, RELAY_LOG_INFO* rli)
thd->server_id = ev->server_id; // use the original server id for logging thd->server_id = ev->server_id; // use the original server id for logging
thd->set_time(); // time the query thd->set_time(); // time the query
thd->lex.current_select= 0; thd->lex->current_select= 0;
if (!ev->when) if (!ev->when)
ev->when = time(NULL); ev->when = time(NULL);
ev->thd = thd; ev->thd = thd;
......
...@@ -77,12 +77,12 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type) ...@@ -77,12 +77,12 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type)
default: default:
{ {
char buffer[MAX_FIELD_WIDTH]; char buffer[MAX_FIELD_WIDTH];
String tmp(buffer, sizeof(buffer), it->charset()); String tmp(buffer, sizeof(buffer), it->collation.collation);
String *s= it->val_str(&tmp); String *s= it->val_str(&tmp);
DBUG_PRINT("info",("default result: %*s",s->length(),s->c_ptr_quick())); DBUG_PRINT("info",("default result: %*s",s->length(),s->c_ptr_quick()));
it= new Item_string(thd->strmake(s->c_ptr_quick(), s->length()), it= new Item_string(thd->strmake(s->c_ptr_quick(), s->length()),
s->length(), it->charset()); s->length(), it->collation.collation);
break; break;
} }
} }
......
...@@ -3867,7 +3867,7 @@ void create_select_for_variable(const char *var_name) ...@@ -3867,7 +3867,7 @@ void create_select_for_variable(const char *var_name)
DBUG_ENTER("create_select_for_variable"); DBUG_ENTER("create_select_for_variable");
thd= current_thd; thd= current_thd;
lex= &thd->lex; lex= thd->lex;
mysql_init_select(lex); mysql_init_select(lex);
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
tmp.str= (char*) var_name; tmp.str= (char*) var_name;
......
...@@ -2494,7 +2494,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, ...@@ -2494,7 +2494,7 @@ copy_data_between_tables(TABLE *from,TABLE *to,
tables.db = from->table_cache_key; tables.db = from->table_cache_key;
error=1; error=1;
if (thd->lex.select_lex->setup_ref_array(thd, order_num) || if (thd->lex->select_lex.setup_ref_array(thd, order_num) ||
setup_order(thd, thd->lex->select_lex.ref_pointer_array, setup_order(thd, thd->lex->select_lex.ref_pointer_array,
&tables, fields, all_fields, order) || &tables, fields, all_fields, order) ||
!(sortorder=make_unireg_sortorder(order, &length)) || !(sortorder=make_unireg_sortorder(order, &length)) ||
......
...@@ -257,7 +257,7 @@ int st_select_lex_unit::exec() ...@@ -257,7 +257,7 @@ int st_select_lex_unit::exec()
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{ {
ha_rows rows= 0; ha_rows rows= 0;
thd->lex.current_select= sl; thd->lex->current_select= sl;
if (optimized) if (optimized)
res= sl->join->reinit(); res= sl->join->reinit();
......
...@@ -95,7 +95,7 @@ int mysql_update(THD *thd, ...@@ -95,7 +95,7 @@ int mysql_update(THD *thd,
if (setup_tables(update_table_list) || if (setup_tables(update_table_list) ||
setup_conds(thd,update_table_list,&conds) || setup_conds(thd,update_table_list,&conds) ||
thd->lex.select_lex->setup_ref_array(thd, order_num) || thd->lex->select_lex.setup_ref_array(thd, order_num) ||
setup_order(thd, thd->lex->select_lex.ref_pointer_array, setup_order(thd, thd->lex->select_lex.ref_pointer_array,
&tables, all_fields, all_fields, order) || &tables, all_fields, all_fields, order) ||
setup_ftfuncs(&thd->lex->select_lex)) setup_ftfuncs(&thd->lex->select_lex))
......
...@@ -5253,8 +5253,25 @@ option_value: ...@@ -5253,8 +5253,25 @@ option_value:
{ {
Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4))); Lex->var_list.push_back(new set_var_user(new Item_func_set_user_var($2,$4)));
} }
| internal_or_splocal | internal_variable_name equal set_expr_or_default
{} {
LEX *lex=Lex;
if ($1.var)
{ /* System variable */
lex->var_list.push_back(new set_var(lex->option_type, $1.var,
&$1.base_name, $3));
}
else
{ /* An SP local variable */
sp_pvar_t *spv= lex->spcont->find_pvar(&$1.base_name);
sp_instr_set *i= new sp_instr_set(lex->sphead->instructions(),
spv->offset, $3, spv->type);
lex->sphead->add_instr(i);
spv->isset= TRUE;
}
}
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{ {
LEX *lex=Lex; LEX *lex=Lex;
...@@ -5311,6 +5328,13 @@ option_value: ...@@ -5311,6 +5328,13 @@ option_value:
internal_variable_name: internal_variable_name:
ident ident
{ {
LEX *lex= Lex;
sp_pcontext *spc= lex->spcont;
sp_pvar_t *spv;
/* We have to lookup here since local vars can shadow sysvars */
if (!spc || !(spv = spc->find_pvar(&$1)))
{ /* Not an SP local variable */
sys_var *tmp=find_sys_var($1.str, $1.length); sys_var *tmp=find_sys_var($1.str, $1.length);
if (!tmp) if (!tmp)
YYABORT; YYABORT;
...@@ -5318,6 +5342,12 @@ internal_variable_name: ...@@ -5318,6 +5342,12 @@ internal_variable_name:
$$.base_name.str=0; $$.base_name.str=0;
$$.base_name.length=0; $$.base_name.length=0;
} }
else
{ /* An SP local variable */
$$.var= NULL;
$$.base_name= $1;
}
}
| ident '.' ident | ident '.' ident
{ {
sys_var *tmp=find_sys_var($3.str, $3.length); sys_var *tmp=find_sys_var($3.str, $3.length);
......
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