diff options
author | unknown <pem@mysql.telia.com> | 2003-08-26 17:41:40 +0200 |
---|---|---|
committer | unknown <pem@mysql.telia.com> | 2003-08-26 17:41:40 +0200 |
commit | 55e776d14565ea6ee9841612069c24f6b8a3023c (patch) | |
tree | e00ec7150a2654f1664e7aa2eba806887f08ee30 | |
parent | 138f0adf2d47c995b9e4aca96147c6afe59fdfa7 (diff) | |
download | mariadb-git-55e776d14565ea6ee9841612069c24f6b8a3023c.tar.gz |
Post-merge fixes.
-rw-r--r-- | mysql-test/r/query_cache.result | 8 | ||||
-rw-r--r-- | mysql-test/r/sel000100.result | 4 | ||||
-rw-r--r-- | mysql-test/r/sp-error.result | 2 | ||||
-rw-r--r-- | mysql-test/r/symlink.result | 2 | ||||
-rw-r--r-- | mysql-test/r/variables.result | 2 | ||||
-rw-r--r-- | mysql-test/t/sel000100.test | 4 | ||||
-rw-r--r-- | mysql-test/t/sp-error.test | 42 | ||||
-rw-r--r-- | sql/item.cc | 2 | ||||
-rw-r--r-- | sql/item_subselect.cc | 12 | ||||
-rw-r--r-- | sql/mysqld.cc | 1 | ||||
-rw-r--r-- | sql/slave.cc | 2 | ||||
-rw-r--r-- | sql/sp_head.cc | 4 | ||||
-rw-r--r-- | sql/sql_parse.cc | 2 | ||||
-rw-r--r-- | sql/sql_table.cc | 2 | ||||
-rw-r--r-- | sql/sql_union.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 | ||||
-rw-r--r-- | sql/sql_yacc.yy | 48 |
17 files changed, 84 insertions, 57 deletions
diff --git a/mysql-test/r/query_cache.result b/mysql-test/r/query_cache.result index b8b4f243ac4..664943157c1 100644 --- a/mysql-test/r/query_cache.result +++ b/mysql-test/r/query_cache.result @@ -1248,10 +1248,10 @@ Variable_name Value Qcache_queries_in_cache 0 show status like "Qcache_inserts"; Variable_name Value -Qcache_inserts 41 +Qcache_inserts 1 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 13 +Qcache_hits 1 /**/ select * from t1; a /**/ select * from t1; @@ -1261,8 +1261,8 @@ Variable_name Value Qcache_queries_in_cache 1 show status like "Qcache_inserts"; Variable_name Value -Qcache_inserts 42 +Qcache_inserts 2 show status like "Qcache_hits"; Variable_name Value -Qcache_hits 14 +Qcache_hits 2 drop table t1; diff --git a/mysql-test/r/sel000100.result b/mysql-test/r/sel000100.result index 3ffa4004b84..39600b755c1 100644 --- a/mysql-test/r/sel000100.result +++ b/mysql-test/r/sel000100.result @@ -29,10 +29,10 @@ drop table t1,t2; CREATE TABLE t1 ( html varchar(5) default NULL, rin int(11) default '0', -out int(11) default '0' +rout int(11) default '0' ) TYPE=MyISAM; 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 1 0.00 drop table t1; diff --git a/mysql-test/r/sp-error.result b/mysql-test/r/sp-error.result index 11935e4b137..95fe8edf321 100644 --- a/mysql-test/r/sp-error.result +++ b/mysql-test/r/sp-error.result @@ -35,7 +35,7 @@ call foo(); ERROR HY000: PROCEDURE foo does not exist drop procedure if exists foo; Warnings: -Warning 1272 PROCEDURE foo does not exist +Warning 1275 PROCEDURE foo does not exist create procedure foo() foo: loop leave bar; diff --git a/mysql-test/r/symlink.result b/mysql-test/r/symlink.result index 216fb4d6124..4469ca36941 100644 --- a/mysql-test/r/symlink.result +++ b/mysql-test/r/symlink.result @@ -46,8 +46,6 @@ alter table t8 rename t7; rename table t7 to t9; drop table t1; 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 diff --git a/mysql-test/r/variables.result b/mysql-test/r/variables.result index 1e1aeb365c1..8bbe773ed01 100644 --- a/mysql-test/r/variables.result +++ b/mysql-test/r/variables.result @@ -311,7 +311,7 @@ set sql_log_bin=1; set sql_log_off=1; set sql_log_update=1; 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_max_join_size=200; select @@sql_max_join_size,@@max_join_size; diff --git a/mysql-test/t/sel000100.test b/mysql-test/t/sel000100.test index c9923d178c6..8c673566847 100644 --- a/mysql-test/t/sel000100.test +++ b/mysql-test/t/sel000100.test @@ -38,11 +38,11 @@ drop table t1,t2; CREATE TABLE t1 ( html varchar(5) default NULL, rin int(11) default '0', - out int(11) default '0' + rout int(11) default '0' ) TYPE=MyISAM; 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; diff --git a/mysql-test/t/sp-error.test b/mysql-test/t/sp-error.test index 448a571fa11..01e05246d3e 100644 --- a/mysql-test/t/sp-error.test +++ b/mysql-test/t/sp-error.test @@ -32,18 +32,18 @@ create function func1() returns int return 42| # Can't create recursively ---error 1270 +--error 1273 create procedure foo() create procedure bar() set @x=3| ---error 1270 +--error 1273 create procedure foo() create function bar() returns double return 2.3| # Already exists ---error 1271 +--error 1274 create procedure proc1() set @x = 42| ---error 1271 +--error 1274 create function func1() returns int return 42| @@ -51,32 +51,32 @@ drop procedure proc1| drop function func1| # Does not exist ---error 1272 +--error 1275 alter procedure foo| ---error 1272 +--error 1275 alter function foo| ---error 1272 +--error 1275 drop procedure foo| ---error 1272 +--error 1275 drop function foo| ---error 1272 +--error 1275 call foo()| drop procedure if exists foo| # LEAVE/ITERATE with no match ---error 1275 +--error 1278 create procedure foo() foo: loop leave bar; end loop| ---error 1275 +--error 1278 create procedure foo() foo: loop iterate bar; end loop| # Redefining label ---error 1276 +--error 1279 create procedure foo() foo: loop foo: loop @@ -85,14 +85,14 @@ foo: loop end loop foo| # End label mismatch ---error 1277 +--error 1280 create procedure foo() foo: loop set @x=2; end loop bar| # Referring to undef variable ---error 1278 +--error 1281 create procedure foo(out x int) begin declare y int; @@ -106,17 +106,17 @@ begin select name from mysql.proc; select type from mysql.proc; end| ---error 1279 +--error 1282 call foo()| drop procedure foo| # RETURN in FUNCTION only ---error 1280 +--error 1283 create procedure foo() return 42| # Doesn't allow queries in FUNCTIONs (for now :-( ) ---error 1281 +--error 1284 create function foo() returns int begin declare x int; @@ -130,13 +130,13 @@ create procedure p(x int) create function f(x int) returns int return x+42| ---error 1285 +--error 1288 call p()| ---error 1285 +--error 1288 call p(1, 2)| ---error 1285 +--error 1288 select f()| ---error 1285 +--error 1288 select f(1, 2)| drop procedure p| diff --git a/sql/item.cc b/sql/item.cc index 2fb80416848..0111e4bb0bc 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -54,7 +54,7 @@ Item::Item(): command => we should check thd->lex.current_select on zero (thd->lex can be uninitialised) */ - if (thd->lex.current_select) + if (thd->lex->current_select) { SELECT_LEX_NODE::enum_parsing_place place= thd->lex->current_select->parsing_place; diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 9545ff27f45..ab887ab5c26 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -501,7 +501,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, SELECT_LEX_UNIT *unit= select_lex->master_unit(); 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(); //optimizer never use Item **ref => we can pass 0 as parameter @@ -603,7 +603,7 @@ Item_in_subselect::single_value_transformer(JOIN *join, // fix_field of item will be done in time of substituting substitution= item; have_to_be_excluded= 1; - if (thd->lex.describe) + if (thd->lex->describe) { char warn_buff[MYSQL_ERRMSG_SIZE]; sprintf(warn_buff, ER(ER_SELECT_REDUCED), select_lex->select_number); @@ -634,15 +634,15 @@ Item_in_subselect::row_value_transformer(JOIN *join, SELECT_LEX_UNIT *unit= select_lex->master_unit(); substitution= optimizer= new Item_in_optimizer(left_expr, this); - SELECT_LEX *current= thd->lex.current_select, *up; - thd->lex.current_select= up= current->return_after_parsing(); + SELECT_LEX *current= thd->lex->current_select, *up; + thd->lex->current_select= up= current->return_after_parsing(); //optimizer never use Item **ref => we can pass 0 as parameter if (!optimizer || optimizer->fix_left(thd, up->get_table_list(), 0)) { - thd->lex.current_select= current; + thd->lex->current_select= current; DBUG_RETURN(ERROR); } - thd->lex.current_select= current; + thd->lex->current_select= current; unit->dependent= 1; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index e8b475db6fc..a9929cfe1c0 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2009,7 +2009,6 @@ static int init_common_variables(const char *conf_file_name, int argc, before MY_INIT(). So we do it here. */ mysql_log.init_pthread_objects(); - mysql_update_log.init_pthread_objects(); mysql_slow_log.init_pthread_objects(); mysql_bin_log.init_pthread_objects(); diff --git a/sql/slave.cc b/sql/slave.cc index cdf34817949..5592566fba5 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -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->set_time(); // time the query - thd->lex.current_select= 0; + thd->lex->current_select= 0; if (!ev->when) ev->when = time(NULL); ev->thd = thd; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 1c2baa1c0dd..63d78039803 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -77,12 +77,12 @@ eval_func_item(THD *thd, Item *it, enum enum_field_types type) default: { 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); DBUG_PRINT("info",("default result: %*s",s->length(),s->c_ptr_quick())); it= new Item_string(thd->strmake(s->c_ptr_quick(), s->length()), - s->length(), it->charset()); + s->length(), it->collation.collation); break; } } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 7882135e401..7cb0a593e80 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3867,7 +3867,7 @@ void create_select_for_variable(const char *var_name) DBUG_ENTER("create_select_for_variable"); thd= current_thd; - lex= &thd->lex; + lex= thd->lex; mysql_init_select(lex); lex->sql_command= SQLCOM_SELECT; tmp.str= (char*) var_name; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 8c577375ddb..d11bbb43609 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2494,7 +2494,7 @@ copy_data_between_tables(TABLE *from,TABLE *to, tables.db = from->table_cache_key; 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, &tables, fields, all_fields, order) || !(sortorder=make_unireg_sortorder(order, &length)) || diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 3448128e03d..3ac12975c60 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -257,7 +257,7 @@ int st_select_lex_unit::exec() for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) { ha_rows rows= 0; - thd->lex.current_select= sl; + thd->lex->current_select= sl; if (optimized) res= sl->join->reinit(); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index fb19c53ec2b..6a047fe4544 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -95,7 +95,7 @@ int mysql_update(THD *thd, if (setup_tables(update_table_list) || 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, &tables, all_fields, all_fields, order) || setup_ftfuncs(&thd->lex->select_lex)) diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 75ff156cc63..a8ee9f28fda 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -5251,10 +5251,27 @@ opt_var_ident_type: option_value: '@' ident_or_text equal expr { - 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_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; + } } - | internal_or_splocal - {} | '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default { LEX *lex=Lex; @@ -5311,12 +5328,25 @@ option_value: internal_variable_name: ident { - sys_var *tmp=find_sys_var($1.str, $1.length); - if (!tmp) - YYABORT; - $$.var= tmp; - $$.base_name.str=0; - $$.base_name.length=0; + 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); + if (!tmp) + YYABORT; + $$.var= tmp; + $$.base_name.str=0; + $$.base_name.length=0; + } + else + { /* An SP local variable */ + $$.var= NULL; + $$.base_name= $1; + } } | ident '.' ident { |