Loading mysql-test/r/func_str.result +2 −2 Original line number Diff line number Diff line Loading @@ -1136,12 +1136,12 @@ ALTER TABLE t1 ADD INDEX (code); CREATE TABLE t2 (id varchar(10) PRIMARY KEY); INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id WHERE t2.id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); code id A12 a12 EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id WHERE id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref code code 13 const 3 Using where; Using index 1 SIMPLE t2 ref PRIMARY PRIMARY 12 const 1 Using where; Using index Loading mysql-test/t/func_str.test +2 −2 Original line number Diff line number Diff line Loading @@ -773,10 +773,10 @@ CREATE TABLE t2 (id varchar(10) PRIMARY KEY); INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id WHERE t2.id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id WHERE id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); DROP TABLE t1,t2; Loading sql/item.h +27 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,17 @@ class Settable_routine_parameter typedef bool (Item::*Item_processor) (byte *arg); /* Analyzer function SYNOPSIS argp in/out IN: Analysis parameter OUT: Parameter to be passed to the transformer RETURN TRUE Invoke the transformer FALSE Don't do it */ typedef bool (Item::*Item_analyzer) (byte **argp); typedef Item* (Item::*Item_transformer) (byte *arg); typedef void (*Cond_traverser) (const Item *item, void *arg); Loading Loading @@ -740,6 +751,22 @@ class Item { return (this->*transformer)(arg); } /* This function performs a generic "compilation" of the Item tree. The process of compilation is assumed to go as follows: compile() { if (this->*some_analyzer(...)) { compile children if any; this->*some_transformer(...); } } i.e. analysis is performed top-down while transformation is done bottom-up. */ virtual Item* compile(Item_analyzer analyzer, byte **arg_p, Item_transformer transformer, byte *arg_t) { Loading sql/item_cmpfunc.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2811,7 +2811,6 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, if (!(this->*analyzer)(arg_p)) return 0; byte *arg_v= *arg_p; List_iterator<Item> li(list); Item *item; while ((item= li++)) Loading @@ -2820,6 +2819,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ byte *arg_v= *arg_p; Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && new_item != item) li.replace(new_item); Loading sql/item_func.cc +1 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,6 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, { if (!(this->*analyzer)(arg_p)) return 0; byte *arg_v= *arg_p; if (arg_count) { Item **arg,**arg_end; Loading @@ -314,6 +313,7 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ byte *arg_v= *arg_p; Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && *arg != new_item) current_thd->change_item_tree(arg, new_item); Loading Loading
mysql-test/r/func_str.result +2 −2 Original line number Diff line number Diff line Loading @@ -1136,12 +1136,12 @@ ALTER TABLE t1 ADD INDEX (code); CREATE TABLE t2 (id varchar(10) PRIMARY KEY); INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id WHERE t2.id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); code id A12 a12 EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id WHERE id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ref code code 13 const 3 Using where; Using index 1 SIMPLE t2 ref PRIMARY PRIMARY 12 const 1 Using where; Using index Loading
mysql-test/t/func_str.test +2 −2 Original line number Diff line number Diff line Loading @@ -773,10 +773,10 @@ CREATE TABLE t2 (id varchar(10) PRIMARY KEY); INSERT INTO t2 VALUES ('a11'), ('a12'), ('a13'), ('a14'); SELECT * FROM t1 INNER JOIN t2 ON t1.code=t2.id WHERE t2.id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE t2.id='a12' AND (LENGTH(code)=5 OR code < 'a00'); EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON code=id WHERE id='a12' AND (code < 'a00' OR LENGTH(code)=5); WHERE id='a12' AND (LENGTH(code)=5 OR code < 'a00'); DROP TABLE t1,t2; Loading
sql/item.h +27 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,17 @@ class Settable_routine_parameter typedef bool (Item::*Item_processor) (byte *arg); /* Analyzer function SYNOPSIS argp in/out IN: Analysis parameter OUT: Parameter to be passed to the transformer RETURN TRUE Invoke the transformer FALSE Don't do it */ typedef bool (Item::*Item_analyzer) (byte **argp); typedef Item* (Item::*Item_transformer) (byte *arg); typedef void (*Cond_traverser) (const Item *item, void *arg); Loading Loading @@ -740,6 +751,22 @@ class Item { return (this->*transformer)(arg); } /* This function performs a generic "compilation" of the Item tree. The process of compilation is assumed to go as follows: compile() { if (this->*some_analyzer(...)) { compile children if any; this->*some_transformer(...); } } i.e. analysis is performed top-down while transformation is done bottom-up. */ virtual Item* compile(Item_analyzer analyzer, byte **arg_p, Item_transformer transformer, byte *arg_t) { Loading
sql/item_cmpfunc.cc +1 −1 Original line number Diff line number Diff line Loading @@ -2811,7 +2811,6 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, if (!(this->*analyzer)(arg_p)) return 0; byte *arg_v= *arg_p; List_iterator<Item> li(list); Item *item; while ((item= li++)) Loading @@ -2820,6 +2819,7 @@ Item *Item_cond::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ byte *arg_v= *arg_p; Item *new_item= item->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && new_item != item) li.replace(new_item); Loading
sql/item_func.cc +1 −1 Original line number Diff line number Diff line Loading @@ -304,7 +304,6 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, { if (!(this->*analyzer)(arg_p)) return 0; byte *arg_v= *arg_p; if (arg_count) { Item **arg,**arg_end; Loading @@ -314,6 +313,7 @@ Item *Item_func::compile(Item_analyzer analyzer, byte **arg_p, The same parameter value of arg_p must be passed to analyze any argument of the condition formula. */ byte *arg_v= *arg_p; Item *new_item= (*arg)->compile(analyzer, &arg_v, transformer, arg_t); if (new_item && *arg != new_item) current_thd->change_item_tree(arg, new_item); Loading