mirror of
https://github.com/MariaDB/server.git
synced 2025-09-03 20:43:11 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0
This commit is contained in:
@@ -141,7 +141,7 @@ COALESCE('a' COLLATE latin1_bin,'b');
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate _latin1'latin1_bin'),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
Note 1003 select coalesce(1) AS `COALESCE(1)`,coalesce(1.0) AS `COALESCE(1.0)`,coalesce(_latin1'a') AS `COALESCE('a')`,coalesce(1,1.0) AS `COALESCE(1,1.0)`,coalesce(1,_latin1'1') AS `COALESCE(1,'1')`,coalesce(1.1,_latin1'1') AS `COALESCE(1.1,'1')`,coalesce((_latin1'a' collate latin1_bin),_latin1'b') AS `COALESCE('a' COLLATE latin1_bin,'b')`
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
t1 CREATE TABLE `t1` (
|
t1 CREATE TABLE `t1` (
|
||||||
|
@@ -43,7 +43,7 @@ explain extended select if(u=1,st,binary st) s from t1 where st like "%a%" order
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using filesort
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,(`test`.`t1`.`st` collate _latin1'BINARY')) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like _latin1'%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,(`test`.`t1`.`st` collate _latin1'BINARY'))
|
Note 1003 select if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,(`test`.`t1`.`st` collate BINARY)) AS `s` from `test`.`t1` where (`test`.`t1`.`st` like _latin1'%a%') order by if((`test`.`t1`.`u` = 1),`test`.`t1`.`st`,(`test`.`t1`.`st` collate BINARY))
|
||||||
select nullif(u=0, 'test') from t1;
|
select nullif(u=0, 'test') from t1;
|
||||||
nullif(u=0, 'test')
|
nullif(u=0, 'test')
|
||||||
NULL
|
NULL
|
||||||
|
@@ -146,7 +146,7 @@ explain extended select * from t1 where 'a' in (a,b,c collate latin1_bin);
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate _latin1'latin1_bin')))
|
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (_latin1'a' in (`test`.`t1`.`a`,`test`.`t1`.`b`,(`test`.`t1`.`c` collate latin1_bin)))
|
||||||
drop table t1;
|
drop table t1;
|
||||||
select '1.0' in (1,2);
|
select '1.0' in (1,2);
|
||||||
'1.0' in (1,2)
|
'1.0' in (1,2)
|
||||||
|
@@ -638,7 +638,7 @@ explain extended select md5('hello'), sha('abc'), sha1('abc'), soundex(''), 'moo
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate _latin1'BINARY') AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate _latin1'latin1_bin'),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
|
Note 1003 select md5(_latin1'hello') AS `md5('hello')`,sha(_latin1'abc') AS `sha('abc')`,sha(_latin1'abc') AS `sha1('abc')`,soundex(_latin1'') AS `soundex('')`,(soundex(_latin1'mood') = soundex(_latin1'mud')) AS `'mood' sounds like 'mud'`,aes_decrypt(aes_encrypt(_latin1'abc',_latin1'1'),_latin1'1') AS `aes_decrypt(aes_encrypt('abc','1'),'1')`,concat(_latin1'*',repeat(_latin1' ',5),_latin1'*') AS `concat('*',space(5),'*')`,reverse(_latin1'abc') AS `reverse('abc')`,rpad(_latin1'a',4,_latin1'1') AS `rpad('a',4,'1')`,lpad(_latin1'a',4,_latin1'1') AS `lpad('a',4,'1')`,concat_ws(_latin1',',_latin1'',NULL,_latin1'a') AS `concat_ws(',','',NULL,'a')`,make_set(255,_latin2'a',_latin2'b',_latin2'c') AS `make_set(255,_latin2'a',_latin2'b',_latin2'c')`,elt(2,1) AS `elt(2,1)`,locate(_latin1'a',_latin1'b',2) AS `locate("a","b",2)`,format(130,10) AS `format(130,10)`,char(0) AS `char(0)`,conv(130,16,10) AS `conv(130,16,10)`,hex(130) AS `hex(130)`,(_latin1'HE' collate BINARY) AS `binary 'HE'`,export_set(255,_latin2'y',_latin2'n',_latin2' ') AS `export_set(255,_latin2'y',_latin2'n',_latin2' ')`,field((_latin1'b' collate latin1_bin),_latin1'A',_latin1'B') AS `FIELD('b' COLLATE latin1_bin,'A','B')`,find_in_set(_latin1'B',_latin1'a,b,c,d') AS `FIND_IN_SET(_latin1'B',_latin1'a,b,c,d')`,collation(conv(130,16,10)) AS `collation(conv(130,16,10))`,coercibility(conv(130,16,10)) AS `coercibility(conv(130,16,10))`,length(_latin1'\n \r\0\\_\\%\\') AS `length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,bit_length(_latin1'\n \r\0\\_\\%\\') AS `bit_length('\n\t\r\b\0\_\%\\')`,concat(_latin1'monty',_latin1' was here ',_latin1'again') AS `concat('monty',' was here ','again')`,length(_latin1'hello') AS `length('hello')`,char(ascii(_latin1'h')) AS `char(ascii('h'))`,ord(_latin1'h') AS `ord('h')`,quote((1 / 0)) AS `quote(1/0)`,crc32(_latin1'123') AS `crc32("123")`,replace(_latin1'aaaa',_latin1'a',_latin1'b') AS `replace('aaaa','a','b')`,insert(_latin1'txs',2,1,_latin1'hi') AS `insert('txs',2,1,'hi')`,left(_latin2'a',1) AS `left(_latin2'a',1)`,right(_latin2'a',1) AS `right(_latin2'a',1)`,lcase(_latin2'a') AS `lcase(_latin2'a')`,ucase(_latin2'a') AS `ucase(_latin2'a')`,substr(_latin1'abcdefg',3,2) AS `SUBSTR('abcdefg',3,2)`,substr_index(_latin1'1abcd;2abcd;3abcd;4abcd',_latin1';',2) AS `substring_index("1abcd;2abcd;3abcd;4abcd", ';', 2)`,trim(_latin2' a ') AS `trim(_latin2' a ')`,ltrim(_latin2' a ') AS `ltrim(_latin2' a ')`,rtrim(_latin2' a ') AS `rtrim(_latin2' a ')`,decode(encode(repeat(_latin1'a',100000))) AS `decode(encode(repeat("a",100000),"monty"),"monty")`
|
||||||
SELECT lpad(12345, 5, "#");
|
SELECT lpad(12345, 5, "#");
|
||||||
lpad(12345, 5, "#")
|
lpad(12345, 5, "#")
|
||||||
12345
|
12345
|
||||||
|
@@ -108,7 +108,7 @@ explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
|||||||
id select_type table type possible_keys key key_len ref rows Extra
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
|
Note 1003 select (_koi8r'a' = (_koi8r'A' collate koi8r_general_ci)) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
|
||||||
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
|
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
|
||||||
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
|
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
|
||||||
0
|
0
|
||||||
|
@@ -186,7 +186,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
|
4 SUBQUERY t2 ALL NULL NULL NULL NULL 2
|
||||||
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
|
NULL UNION RESULT <union1,3> ALL NULL NULL NULL NULL NULL
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by `test`.`t3`.`a` desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `test`.`t4`.`a`)
|
Note 1003 (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`b` = (select `test`.`t3`.`a` AS `a` from `test`.`t3` order by 1 desc limit 1))) union (select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b` from `test`.`t4` where (`test`.`t4`.`b` = (select (max(`test`.`t2`.`a`) * 4) AS `max(t2.a)*4` from `test`.`t2`)) order by `test`.`t4`.`a`)
|
||||||
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
select (select a from t3 where a<t2.a*4 order by 1 desc limit 1), a from t2;
|
||||||
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
(select a from t3 where a<t2.a*4 order by 1 desc limit 1) a
|
||||||
3 1
|
3 1
|
||||||
@@ -202,7 +202,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
|
3 DERIVED t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
|
2 SUBQUERY t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by `test`.`t3`.`a` desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
Note 1003 select (select `test`.`t3`.`a` AS `a` from `test`.`t3` where (`test`.`t3`.`a` < 8) order by 1 desc limit 1) AS `(select t3.a from t3 where a<8 order by 1 desc limit 1)`,`tt`.`a` AS `a` from (select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where (`test`.`t2`.`a` > 1)) `tt`
|
||||||
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
select * from t1 where t1.a=(select t2.a from t2 where t2.b=(select max(a) from t3) order by 1 desc limit 1);
|
||||||
a
|
a
|
||||||
2
|
2
|
||||||
|
@@ -940,7 +940,7 @@ grant update,select(b) on mysqltest.t2 to mysqltest_1@localhost;
|
|||||||
create view v4 as select b+1 from mysqltest.t2;
|
create view v4 as select b+1 from mysqltest.t2;
|
||||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
drop view v1,v2;
|
drop view v1,v2,v4;
|
||||||
set sql_mode='ansi';
|
set sql_mode='ansi';
|
||||||
create table t1 ("a*b" int);
|
create table t1 ("a*b" int);
|
||||||
create view v1 as select "a*b" from t1;
|
create view v1 as select "a*b" from t1;
|
||||||
@@ -1040,7 +1040,6 @@ CREATE VIEW v02 AS SELECT * FROM DUAL;
|
|||||||
ERROR HY000: No tables used
|
ERROR HY000: No tables used
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
Tables_in_test table_type
|
Tables_in_test table_type
|
||||||
v4 VIEW
|
|
||||||
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
|
CREATE VIEW v1 AS SELECT EXISTS (SELECT 1 UNION SELECT 2);
|
||||||
select * from v1;
|
select * from v1;
|
||||||
EXISTS (SELECT 1 UNION SELECT 2)
|
EXISTS (SELECT 1 UNION SELECT 2)
|
||||||
@@ -1166,3 +1165,91 @@ Table Create Table
|
|||||||
v3 CREATE VIEW `test`.`v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from `test`.`v1` join `test`.`v2` where (`v1`.`col1` = `v2`.`col1`)
|
v3 CREATE VIEW `test`.`v3` AS select `v1`.`col1` AS `a`,`v2`.`col1` AS `b` from `test`.`v1` join `test`.`v2` where (`v1`.`col1` = `v2`.`col1`)
|
||||||
drop view v3, v2, v1;
|
drop view v3, v2, v1;
|
||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
|
create function `f``1` () returns int return 5;
|
||||||
|
create view v1 as select test.`f``1` ();
|
||||||
|
show create view v1;
|
||||||
|
Table Create Table
|
||||||
|
v1 CREATE VIEW `test`.`v1` AS select `test`.`f``1`() AS `test.``f````1`` ()`
|
||||||
|
select * from v1;
|
||||||
|
test.`f``1` ()
|
||||||
|
5
|
||||||
|
drop view v1;
|
||||||
|
drop function `f``1`;
|
||||||
|
create function x () returns int return 5;
|
||||||
|
create view v1 as select x ();
|
||||||
|
select * from v1;
|
||||||
|
x ()
|
||||||
|
5
|
||||||
|
drop view v1;
|
||||||
|
drop function x;
|
||||||
|
create table t2 (col1 char collate latin1_german2_ci);
|
||||||
|
create view v2 as select col1 collate latin1_german1_ci from t2;
|
||||||
|
show create view v2;
|
||||||
|
Table Create Table
|
||||||
|
v2 CREATE VIEW `test`.`v2` AS select (`test`.`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `test`.`t2`
|
||||||
|
show create view v2;
|
||||||
|
Table Create Table
|
||||||
|
v2 CREATE VIEW `test`.`v2` AS select (`test`.`t2`.`col1` collate latin1_german1_ci) AS `col1 collate latin1_german1_ci` from `test`.`t2`
|
||||||
|
drop view v2;
|
||||||
|
drop table t2;
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
create view v1 as select 5 from t1 order by 1;
|
||||||
|
select * from v1;
|
||||||
|
5
|
||||||
|
5
|
||||||
|
5
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
create function x1 () returns int return 5;
|
||||||
|
create table t1 (s1 int);
|
||||||
|
create view v1 as select x1() from t1;
|
||||||
|
drop function x1;
|
||||||
|
select * from v1;
|
||||||
|
ERROR 42000: FUNCTION test.x1 does not exist
|
||||||
|
show table status;
|
||||||
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||||
|
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||||
|
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
|
||||||
|
show table status;
|
||||||
|
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||||
|
t1 MyISAM 9 Fixed 0 0 0 21474836479 1024 0 NULL # # NULL latin1_swedish_ci NULL
|
||||||
|
v1 NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL # # NULL NULL NULL NULL view
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
|
||||||
|
show create view v1;
|
||||||
|
Table Create Table
|
||||||
|
v1 CREATE VIEW `test`.`v1` AS select 99999999999999999999999999999999999999999999999999999 AS `col1`
|
||||||
|
drop view v1;
|
||||||
|
create table t<> (c<> char);
|
||||||
|
create view v<> as select c<> from t<>;
|
||||||
|
insert into v<> values ('<27>');
|
||||||
|
select * from v<>;
|
||||||
|
c<EFBFBD>
|
||||||
|
<EFBFBD>
|
||||||
|
drop view v<>;
|
||||||
|
drop table t<>;
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
|
||||||
|
create view v1(c) as select a+1 from t1 where b >= 4;
|
||||||
|
select c from v1 where exists (select * from t1 where a=2 and b=c);
|
||||||
|
c
|
||||||
|
4
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
create view v1 as select cast(1 as char(3));
|
||||||
|
show create view v1;
|
||||||
|
Table Create Table
|
||||||
|
v1 CREATE VIEW `test`.`v1` AS select cast(1 as char(3) charset latin1) AS `cast(1 as char(3))`
|
||||||
|
select * from v1;
|
||||||
|
cast(1 as char(3))
|
||||||
|
1
|
||||||
|
drop view v1;
|
||||||
|
create view v1 as select 'a',1;
|
||||||
|
create view v2 as select * from v1 union all select * from v1;
|
||||||
|
create view v3 as select * from v2 where 1 = (select `1` from v2);
|
||||||
|
create view v4 as select * from v3;
|
||||||
|
select * from v4;
|
||||||
|
ERROR 21000: Subquery returns more than 1 row
|
||||||
|
drop view v4, v3, v2, v1;
|
||||||
|
@@ -849,7 +849,7 @@ create view v4 as select b+1 from mysqltest.t2;
|
|||||||
connection root;
|
connection root;
|
||||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
|
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
|
||||||
drop database mysqltest;
|
drop database mysqltest;
|
||||||
drop view v1,v2;
|
drop view v1,v2,v4;
|
||||||
|
|
||||||
#
|
#
|
||||||
# VIEW fields quoting
|
# VIEW fields quoting
|
||||||
@@ -1106,3 +1106,104 @@ select * from v3;
|
|||||||
show create view v3;
|
show create view v3;
|
||||||
drop view v3, v2, v1;
|
drop view v3, v2, v1;
|
||||||
drop table t2, t1;
|
drop table t2, t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# VIEW based on functions with complex names
|
||||||
|
#
|
||||||
|
create function `f``1` () returns int return 5;
|
||||||
|
create view v1 as select test.`f``1` ();
|
||||||
|
show create view v1;
|
||||||
|
select * from v1;
|
||||||
|
drop view v1;
|
||||||
|
drop function `f``1`;
|
||||||
|
|
||||||
|
#
|
||||||
|
# tested problem when function name length close to ALIGN_SIZE
|
||||||
|
#
|
||||||
|
create function x () returns int return 5;
|
||||||
|
create view v1 as select x ();
|
||||||
|
select * from v1;
|
||||||
|
drop view v1;
|
||||||
|
drop function x;
|
||||||
|
|
||||||
|
#
|
||||||
|
# VIEW with collation
|
||||||
|
#
|
||||||
|
create table t2 (col1 char collate latin1_german2_ci);
|
||||||
|
create view v2 as select col1 collate latin1_german1_ci from t2;
|
||||||
|
show create view v2;
|
||||||
|
show create view v2;
|
||||||
|
drop view v2;
|
||||||
|
drop table t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# order by refers on integer field
|
||||||
|
#
|
||||||
|
create table t1 (a int);
|
||||||
|
insert into t1 values (1), (2);
|
||||||
|
create view v1 as select 5 from t1 order by 1;
|
||||||
|
select * from v1;
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# VIEW over droped function
|
||||||
|
#
|
||||||
|
create function x1 () returns int return 5;
|
||||||
|
create table t1 (s1 int);
|
||||||
|
create view v1 as select x1() from t1;
|
||||||
|
drop function x1;
|
||||||
|
-- error 1304
|
||||||
|
select * from v1;
|
||||||
|
--replace_column 12 # 13 #
|
||||||
|
show table status;
|
||||||
|
--replace_column 12 # 13 #
|
||||||
|
show table status;
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# VIEW with floating point (long bumber) as column
|
||||||
|
#
|
||||||
|
create view v1 as select 99999999999999999999999999999999999999999999999999999 as col1;
|
||||||
|
show create view v1;
|
||||||
|
drop view v1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# VIEWs with national characters
|
||||||
|
#
|
||||||
|
create table t<> (c<> char);
|
||||||
|
create view v<> as select c<> from t<>;
|
||||||
|
insert into v<> values ('<27>');
|
||||||
|
select * from v<>;
|
||||||
|
drop view v<>;
|
||||||
|
drop table t<>;
|
||||||
|
|
||||||
|
#
|
||||||
|
# problem with used_tables() of outer reference resolved in VIEW
|
||||||
|
#
|
||||||
|
create table t1 (a int, b int);
|
||||||
|
insert into t1 values (1,2), (1,3), (2,4), (2,5), (3,10);
|
||||||
|
create view v1(c) as select a+1 from t1 where b >= 4;
|
||||||
|
select c from v1 where exists (select * from t1 where a=2 and b=c);
|
||||||
|
drop view v1;
|
||||||
|
drop table t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# view with cast operation
|
||||||
|
#
|
||||||
|
create view v1 as select cast(1 as char(3));
|
||||||
|
show create view v1;
|
||||||
|
select * from v1;
|
||||||
|
drop view v1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# bug handlimg from VIEWs
|
||||||
|
#
|
||||||
|
create view v1 as select 'a',1;
|
||||||
|
create view v2 as select * from v1 union all select * from v1;
|
||||||
|
create view v3 as select * from v2 where 1 = (select `1` from v2);
|
||||||
|
create view v4 as select * from v3;
|
||||||
|
-- error 1242
|
||||||
|
select * from v4;
|
||||||
|
drop view v4, v3, v2, v1;
|
||||||
|
55
sql/item.cc
55
sql/item.cc
@@ -1302,11 +1302,21 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
|
|||||||
table_list, ref,
|
table_list, ref,
|
||||||
0, 1)) != not_found_field)
|
0, 1)) != not_found_field)
|
||||||
{
|
{
|
||||||
if (tmp && tmp != view_ref_found)
|
if (tmp)
|
||||||
{
|
{
|
||||||
prev_subselect_item->used_tables_cache|= tmp->table->map;
|
if (tmp != view_ref_found)
|
||||||
prev_subselect_item->const_item_cache= 0;
|
{
|
||||||
}
|
prev_subselect_item->used_tables_cache|= tmp->table->map;
|
||||||
|
prev_subselect_item->const_item_cache= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prev_subselect_item->used_tables_cache|=
|
||||||
|
(*ref)->used_tables();
|
||||||
|
prev_subselect_item->const_item_cache&=
|
||||||
|
(*ref)->const_item();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (sl->resolve_mode == SELECT_LEX::SELECT_MODE &&
|
if (sl->resolve_mode == SELECT_LEX::SELECT_MODE &&
|
||||||
@@ -1756,6 +1766,21 @@ int Item_real::save_in_field(Field *field, bool no_conversions)
|
|||||||
return field->store(nr);
|
return field->store(nr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item_real::print(String *str)
|
||||||
|
{
|
||||||
|
if (presentation)
|
||||||
|
{
|
||||||
|
str->append(presentation);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
char buffer[20];
|
||||||
|
String num(buffer, sizeof(buffer), &my_charset_bin);
|
||||||
|
num.set(value, decimals, &my_charset_bin);
|
||||||
|
str->append(num);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** varbinary item
|
** varbinary item
|
||||||
** In string context this is a binary string
|
** In string context this is a binary string
|
||||||
@@ -2014,11 +2039,21 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
|
|||||||
table_list, reference,
|
table_list, reference,
|
||||||
0, 1)) != not_found_field)
|
0, 1)) != not_found_field)
|
||||||
{
|
{
|
||||||
if (tmp && tmp != view_ref_found)
|
if (tmp)
|
||||||
{
|
{
|
||||||
prev_subselect_item->used_tables_cache|= tmp->table->map;
|
if (tmp != view_ref_found)
|
||||||
prev_subselect_item->const_item_cache= 0;
|
{
|
||||||
}
|
prev_subselect_item->used_tables_cache|= tmp->table->map;
|
||||||
|
prev_subselect_item->const_item_cache= 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prev_subselect_item->used_tables_cache|=
|
||||||
|
(*reference)->used_tables();
|
||||||
|
prev_subselect_item->const_item_cache&=
|
||||||
|
(*reference)->const_item();
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -698,12 +698,13 @@ public:
|
|||||||
|
|
||||||
class Item_real :public Item_num
|
class Item_real :public Item_num
|
||||||
{
|
{
|
||||||
|
char *presentation;
|
||||||
public:
|
public:
|
||||||
double value;
|
double value;
|
||||||
// Item_real() :value(0) {}
|
// Item_real() :value(0) {}
|
||||||
Item_real(const char *str_arg, uint length) :value(my_atof(str_arg))
|
Item_real(const char *str_arg, uint length) :value(my_atof(str_arg))
|
||||||
{
|
{
|
||||||
name=(char*) str_arg;
|
presentation= name=(char*) str_arg;
|
||||||
decimals=(uint8) nr_of_decimals(str_arg);
|
decimals=(uint8) nr_of_decimals(str_arg);
|
||||||
max_length=length;
|
max_length=length;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
@@ -711,12 +712,12 @@ public:
|
|||||||
Item_real(const char *str,double val_arg,uint decimal_par,uint length)
|
Item_real(const char *str,double val_arg,uint decimal_par,uint length)
|
||||||
:value(val_arg)
|
:value(val_arg)
|
||||||
{
|
{
|
||||||
name=(char*) str;
|
presentation= name=(char*) str;
|
||||||
decimals=(uint8) decimal_par;
|
decimals=(uint8) decimal_par;
|
||||||
max_length=length;
|
max_length=length;
|
||||||
fixed= 1;
|
fixed= 1;
|
||||||
}
|
}
|
||||||
Item_real(double value_par) :value(value_par) { fixed= 1; }
|
Item_real(double value_par) :presentation(0), value(value_par) { fixed= 1; }
|
||||||
int save_in_field(Field *field, bool no_conversions);
|
int save_in_field(Field *field, bool no_conversions);
|
||||||
enum Type type() const { return REAL_ITEM; }
|
enum Type type() const { return REAL_ITEM; }
|
||||||
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE; }
|
||||||
@@ -732,6 +733,7 @@ public:
|
|||||||
void cleanup() {}
|
void cleanup() {}
|
||||||
Item *new_item() { return new Item_real(name,value,decimals,max_length); }
|
Item *new_item() { return new Item_real(name,value,decimals,max_length); }
|
||||||
Item_num *neg() { value= -value; return this; }
|
Item_num *neg() { value= -value; return this; }
|
||||||
|
void print(String *str);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3270,9 +3270,25 @@ Item_func_sp::Item_func_sp(sp_name *name, List<Item> &list)
|
|||||||
const char *
|
const char *
|
||||||
Item_func_sp::func_name() const
|
Item_func_sp::func_name() const
|
||||||
{
|
{
|
||||||
return m_name->m_name.str;
|
THD *thd= current_thd;
|
||||||
|
/* Calculate length to avoud reallocation of string for sure */
|
||||||
|
uint len= ((m_name->m_db.length +
|
||||||
|
m_name->m_name.length)*2 + //characters*quoting
|
||||||
|
2 + // ` and `
|
||||||
|
1 + // .
|
||||||
|
1 + // end of string
|
||||||
|
ALIGN_SIZE(1)); // to avoid String reallocation
|
||||||
|
String qname((char *)alloc_root(&thd->mem_root, len), len,
|
||||||
|
system_charset_info);
|
||||||
|
|
||||||
|
qname.length(0);
|
||||||
|
append_identifier(thd, &qname, m_name->m_db.str, m_name->m_db.length);
|
||||||
|
qname.append('.');
|
||||||
|
append_identifier(thd, &qname, m_name->m_name.str, m_name->m_name.length);
|
||||||
|
return qname.ptr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
Item_func_sp::execute(Item **itp)
|
Item_func_sp::execute(Item **itp)
|
||||||
{
|
{
|
||||||
|
@@ -2274,6 +2274,18 @@ bool Item_func_set_collation::eq(const Item *item, bool binary_cmp) const
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Item_func_set_collation::print(String *str)
|
||||||
|
{
|
||||||
|
str->append('(');
|
||||||
|
args[0]->print(str);
|
||||||
|
str->append(" collate ", 9);
|
||||||
|
DBUG_ASSERT(args[1]->basic_const_item() &&
|
||||||
|
args[1]->type() == Item::STRING_ITEM);
|
||||||
|
args[1]->str_value.print(str);
|
||||||
|
str->append(')');
|
||||||
|
}
|
||||||
|
|
||||||
String *Item_func_charset::val_str(String *str)
|
String *Item_func_charset::val_str(String *str)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(fixed == 1);
|
DBUG_ASSERT(fixed == 1);
|
||||||
|
@@ -635,7 +635,7 @@ public:
|
|||||||
void fix_length_and_dec();
|
void fix_length_and_dec();
|
||||||
bool eq(const Item *item, bool binary_cmp) const;
|
bool eq(const Item *item, bool binary_cmp) const;
|
||||||
const char *func_name() const { return "collate"; }
|
const char *func_name() const { return "collate"; }
|
||||||
void print(String *str) { print_op(str); }
|
void print(String *str);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Item_func_charset :public Item_str_func
|
class Item_func_charset :public Item_str_func
|
||||||
|
@@ -2011,7 +2011,7 @@ void Item_char_typecast::print(String *str)
|
|||||||
if (cast_cs)
|
if (cast_cs)
|
||||||
{
|
{
|
||||||
str->append(" charset ", 9);
|
str->append(" charset ", 9);
|
||||||
str->append(cast_cs->name);
|
str->append(cast_cs->csname);
|
||||||
}
|
}
|
||||||
str->append(')');
|
str->append(')');
|
||||||
}
|
}
|
||||||
|
14
sql/sp.cc
14
sql/sp.cc
@@ -93,10 +93,15 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
|
|||||||
key[128]= type;
|
key[128]= type;
|
||||||
keylen= sizeof(key);
|
keylen= sizeof(key);
|
||||||
|
|
||||||
for (table= thd->open_tables ; table ; table= table->next)
|
if (thd->lex->proc_table)
|
||||||
if (strcmp(table->table_cache_key, "mysql") == 0 &&
|
table= thd->lex->proc_table->table;
|
||||||
strcmp(table->real_name, "proc") == 0)
|
else
|
||||||
break;
|
{
|
||||||
|
for (table= thd->open_tables ; table ; table= table->next)
|
||||||
|
if (strcmp(table->table_cache_key, "mysql") == 0 &&
|
||||||
|
strcmp(table->real_name, "proc") == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (table)
|
if (table)
|
||||||
*opened= FALSE;
|
*opened= FALSE;
|
||||||
else
|
else
|
||||||
@@ -955,6 +960,7 @@ sp_cache_functions(THD *thd, LEX *lex)
|
|||||||
LEX *newlex= new st_lex;
|
LEX *newlex= new st_lex;
|
||||||
|
|
||||||
thd->lex= newlex;
|
thd->lex= newlex;
|
||||||
|
newlex->proc_table= oldlex->proc_table; // hint if mysql.oper is opened
|
||||||
name.m_name.str= strchr(name.m_qname.str, '.');
|
name.m_name.str= strchr(name.m_qname.str, '.');
|
||||||
name.m_db.length= name.m_name.str - name.m_qname.str;
|
name.m_db.length= name.m_name.str - name.m_qname.str;
|
||||||
name.m_db.str= strmake_root(&thd->mem_root,
|
name.m_db.str= strmake_root(&thd->mem_root,
|
||||||
|
@@ -1193,7 +1193,7 @@ sp_instr_set::execute(THD *thd, uint *nextp)
|
|||||||
if (tables &&
|
if (tables &&
|
||||||
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
||||||
(res= open_and_lock_tables(thd, tables))))
|
(res= open_and_lock_tables(thd, tables))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
|
|
||||||
it= sp_eval_func_item(thd, m_value, m_type);
|
it= sp_eval_func_item(thd, m_value, m_type);
|
||||||
if (! it)
|
if (! it)
|
||||||
@@ -1294,7 +1294,7 @@ sp_instr_jump_if::execute(THD *thd, uint *nextp)
|
|||||||
if (tables &&
|
if (tables &&
|
||||||
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
||||||
(res= open_and_lock_tables(thd, tables))))
|
(res= open_and_lock_tables(thd, tables))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
|
|
||||||
it= sp_eval_func_item(thd, m_expr, MYSQL_TYPE_TINY);
|
it= sp_eval_func_item(thd, m_expr, MYSQL_TYPE_TINY);
|
||||||
if (!it)
|
if (!it)
|
||||||
@@ -1351,7 +1351,7 @@ sp_instr_jump_if_not::execute(THD *thd, uint *nextp)
|
|||||||
if (tables &&
|
if (tables &&
|
||||||
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
||||||
(res= open_and_lock_tables(thd, tables))))
|
(res= open_and_lock_tables(thd, tables))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
|
|
||||||
it= sp_eval_func_item(thd, m_expr, MYSQL_TYPE_TINY);
|
it= sp_eval_func_item(thd, m_expr, MYSQL_TYPE_TINY);
|
||||||
if (! it)
|
if (! it)
|
||||||
@@ -1407,7 +1407,7 @@ sp_instr_freturn::execute(THD *thd, uint *nextp)
|
|||||||
if (tables &&
|
if (tables &&
|
||||||
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
((res= check_table_access(thd, SELECT_ACL, tables, 0)) ||
|
||||||
(res= open_and_lock_tables(thd, tables))))
|
(res= open_and_lock_tables(thd, tables))))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
|
|
||||||
it= sp_eval_func_item(thd, m_value, m_type);
|
it= sp_eval_func_item(thd, m_value, m_type);
|
||||||
if (! it)
|
if (! it)
|
||||||
|
@@ -1751,6 +1751,7 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||||||
RETURN
|
RETURN
|
||||||
0 - ok
|
0 - ok
|
||||||
-1 - error
|
-1 - error
|
||||||
|
1 - error reported to user
|
||||||
|
|
||||||
NOTE
|
NOTE
|
||||||
The lock will automaticly be freed by close_thread_tables()
|
The lock will automaticly be freed by close_thread_tables()
|
||||||
@@ -1760,9 +1761,9 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("open_and_lock_tables");
|
DBUG_ENTER("open_and_lock_tables");
|
||||||
uint counter;
|
uint counter;
|
||||||
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
|
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter)
|
||||||
|
|| mysql_handle_derived(thd->lex))
|
||||||
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
|
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
|
||||||
DBUG_RETURN(mysql_handle_derived(thd->lex));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -39,8 +39,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
|
|||||||
ha_rows deleted;
|
ha_rows deleted;
|
||||||
DBUG_ENTER("mysql_delete");
|
DBUG_ENTER("mysql_delete");
|
||||||
|
|
||||||
if ((open_and_lock_tables(thd, table_list)))
|
if ((error= open_and_lock_tables(thd, table_list)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(error);
|
||||||
table= table_list->table;
|
table= table_list->table;
|
||||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||||
thd->proc_info="init";
|
thd->proc_info="init";
|
||||||
|
@@ -640,11 +640,8 @@ int mysqld_help(THD *thd, const char *mask)
|
|||||||
uint mlen= strlen(mask);
|
uint mlen= strlen(mask);
|
||||||
MEM_ROOT *mem_root= &thd->mem_root;
|
MEM_ROOT *mem_root= &thd->mem_root;
|
||||||
|
|
||||||
if (open_and_lock_tables(thd, tables))
|
if (res= open_and_lock_tables(thd, tables))
|
||||||
{
|
|
||||||
res= -1;
|
|
||||||
goto end;
|
goto end;
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
Init tables and fields to be usable from items
|
Init tables and fields to be usable from items
|
||||||
|
|
||||||
|
@@ -1470,7 +1470,14 @@ void st_select_lex::print_order(String *str, ORDER *order)
|
|||||||
{
|
{
|
||||||
for (; order; order= order->next)
|
for (; order; order= order->next)
|
||||||
{
|
{
|
||||||
(*order->item)->print(str);
|
if (order->counter_used)
|
||||||
|
{
|
||||||
|
char buffer[20];
|
||||||
|
my_snprintf(buffer, 20, "%u", order->counter);
|
||||||
|
str->append(buffer);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
(*order->item)->print(str);
|
||||||
if (!order->asc)
|
if (!order->asc)
|
||||||
str->append(" desc", 5);
|
str->append(" desc", 5);
|
||||||
if (order->next)
|
if (order->next)
|
||||||
|
@@ -641,6 +641,7 @@ typedef struct st_lex
|
|||||||
TABLE_LIST *query_tables; /* global list of all tables in this query */
|
TABLE_LIST *query_tables; /* global list of all tables in this query */
|
||||||
/* last element next_global of previous list */
|
/* last element next_global of previous list */
|
||||||
TABLE_LIST **query_tables_last;
|
TABLE_LIST **query_tables_last;
|
||||||
|
TABLE_LIST *proc_table; /* refer to mysql.proc if it was opened by VIEW */
|
||||||
|
|
||||||
List<key_part_spec> col_list;
|
List<key_part_spec> col_list;
|
||||||
List<key_part_spec> ref_list;
|
List<key_part_spec> ref_list;
|
||||||
|
@@ -99,8 +99,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
loaded is located
|
loaded is located
|
||||||
*/
|
*/
|
||||||
char *tdb= thd->db ? thd->db : db; // Result is never null
|
char *tdb= thd->db ? thd->db : db; // Result is never null
|
||||||
bool transactional_table, log_delayed;
|
|
||||||
ulong skip_lines= ex->skip_lines;
|
ulong skip_lines= ex->skip_lines;
|
||||||
|
int res;
|
||||||
|
bool transactional_table, log_delayed;
|
||||||
DBUG_ENTER("mysql_load");
|
DBUG_ENTER("mysql_load");
|
||||||
|
|
||||||
#ifdef EMBEDDED_LIBRARY
|
#ifdef EMBEDDED_LIBRARY
|
||||||
@@ -114,8 +115,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(-1);
|
||||||
}
|
}
|
||||||
table_list->lock_type= lock_type;
|
table_list->lock_type= lock_type;
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if ((res= open_and_lock_tables(thd, table_list)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
/* TODO: add key check when we will support VIEWs in LOAD */
|
/* TODO: add key check when we will support VIEWs in LOAD */
|
||||||
if (!table_list->updatable)
|
if (!table_list->updatable)
|
||||||
{
|
{
|
||||||
|
@@ -2136,7 +2136,7 @@ mysql_execute_command(THD *thd)
|
|||||||
case SQLCOM_DO:
|
case SQLCOM_DO:
|
||||||
if (all_tables &&
|
if (all_tables &&
|
||||||
((res= check_table_access(thd, SELECT_ACL, all_tables, 0)) ||
|
((res= check_table_access(thd, SELECT_ACL, all_tables, 0)) ||
|
||||||
(res= open_and_lock_tables(thd, all_tables))))
|
(res= open_and_lock_tables(thd, all_tables))))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
res= mysql_do(thd, *lex->insert_list);
|
res= mysql_do(thd, *lex->insert_list);
|
||||||
@@ -2400,7 +2400,6 @@ mysql_execute_command(THD *thd)
|
|||||||
|
|
||||||
if (!(res= open_and_lock_tables(thd, select_tables)))
|
if (!(res= open_and_lock_tables(thd, select_tables)))
|
||||||
{
|
{
|
||||||
res= -1; // If error
|
|
||||||
if ((result= new select_create(create_table,
|
if ((result= new select_create(create_table,
|
||||||
&lex->create_info,
|
&lex->create_info,
|
||||||
lex->create_list,
|
lex->create_list,
|
||||||
@@ -4247,7 +4246,7 @@ mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly)
|
|||||||
lex->lock_option= TL_READ;
|
lex->lock_option= TL_READ;
|
||||||
lex->found_colon= 0;
|
lex->found_colon= 0;
|
||||||
lex->safe_to_cache_query= 1;
|
lex->safe_to_cache_query= 1;
|
||||||
lex->query_tables= 0;
|
lex->proc_table= lex->query_tables= 0;
|
||||||
lex->query_tables_last= &lex->query_tables;
|
lex->query_tables_last= &lex->query_tables;
|
||||||
lex->variables_used= 0;
|
lex->variables_used= 0;
|
||||||
lex->select_lex.parent_lex= lex;
|
lex->select_lex.parent_lex= lex;
|
||||||
@@ -4936,6 +4935,7 @@ bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
|
|||||||
order->asc = asc;
|
order->asc = asc;
|
||||||
order->free_me=0;
|
order->free_me=0;
|
||||||
order->used=0;
|
order->used=0;
|
||||||
|
order->counter_used= 0;
|
||||||
list.link_in_list((byte*) order,(byte**) &order->next);
|
list.link_in_list((byte*) order,(byte**) &order->next);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@@ -897,10 +897,10 @@ static int mysql_test_insert(Prepared_statement *stmt,
|
|||||||
tables & preparation procedure
|
tables & preparation procedure
|
||||||
*/
|
*/
|
||||||
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if ((res= open_and_lock_tables(thd, table_list)))
|
||||||
{
|
{
|
||||||
thd->free_temporary_memory_pool_for_ps_preparing();
|
thd->free_temporary_memory_pool_for_ps_preparing();
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((values= its++))
|
if ((values= its++))
|
||||||
@@ -969,9 +969,7 @@ static int mysql_test_update(Prepared_statement *stmt,
|
|||||||
*/
|
*/
|
||||||
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
||||||
|
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if (!(res= open_and_lock_tables(thd, table_list)))
|
||||||
res= -1;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (!(res= mysql_prepare_update(thd, table_list,
|
if (!(res= mysql_prepare_update(thd, table_list,
|
||||||
&select->where,
|
&select->where,
|
||||||
@@ -1030,9 +1028,7 @@ static int mysql_test_delete(Prepared_statement *stmt,
|
|||||||
*/
|
*/
|
||||||
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
||||||
|
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if (!(res= open_and_lock_tables(thd, table_list)))
|
||||||
res= -1;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
|
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
|
||||||
lex->unit.cleanup();
|
lex->unit.cleanup();
|
||||||
@@ -1065,6 +1061,7 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||||||
THD *thd= stmt->thd;
|
THD *thd= stmt->thd;
|
||||||
LEX *lex= stmt->lex;
|
LEX *lex= stmt->lex;
|
||||||
SELECT_LEX_UNIT *unit= &lex->unit;
|
SELECT_LEX_UNIT *unit= &lex->unit;
|
||||||
|
int res;
|
||||||
|
|
||||||
DBUG_ENTER("mysql_test_select");
|
DBUG_ENTER("mysql_test_select");
|
||||||
|
|
||||||
@@ -1084,11 +1081,11 @@ static int mysql_test_select(Prepared_statement *stmt,
|
|||||||
tables & preparation procedure
|
tables & preparation procedure
|
||||||
*/
|
*/
|
||||||
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
thd->allocate_temporary_memory_pool_for_ps_preparing();
|
||||||
if (open_and_lock_tables(thd, tables))
|
if ((res= open_and_lock_tables(thd, tables)))
|
||||||
{
|
{
|
||||||
send_error(thd);
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
res= 1;
|
||||||
|
|
||||||
thd->used_tables= 0; // Updated by setup_fields
|
thd->used_tables= 0; // Updated by setup_fields
|
||||||
|
|
||||||
@@ -1126,7 +1123,7 @@ err_prep:
|
|||||||
unit->cleanup();
|
unit->cleanup();
|
||||||
err:
|
err:
|
||||||
thd->free_temporary_memory_pool_for_ps_preparing();
|
thd->free_temporary_memory_pool_for_ps_preparing();
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -10066,8 +10066,10 @@ find_order_in_list(THD *thd, Item **ref_pointer_array,
|
|||||||
thd->where);
|
thd->where);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
order->item= ref_pointer_array + count-1;
|
order->item= ref_pointer_array + count - 1;
|
||||||
order->in_field_list= 1;
|
order->in_field_list= 1;
|
||||||
|
order->counter= count;
|
||||||
|
order->counter_used= 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint counter;
|
uint counter;
|
||||||
|
@@ -497,6 +497,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||||||
TABLE *table;
|
TABLE *table;
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
TIME time;
|
TIME time;
|
||||||
|
int res;
|
||||||
DBUG_ENTER("mysqld_extend_show_tables");
|
DBUG_ENTER("mysqld_extend_show_tables");
|
||||||
|
|
||||||
(void) sprintf(path,"%s/%s",mysql_data_home,db);
|
(void) sprintf(path,"%s/%s",mysql_data_home,db);
|
||||||
@@ -554,13 +555,18 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
|
|||||||
table_list.select_lex= &thd->lex->select_lex;
|
table_list.select_lex= &thd->lex->select_lex;
|
||||||
if (lower_case_table_names)
|
if (lower_case_table_names)
|
||||||
my_casedn_str(files_charset_info, file_name);
|
my_casedn_str(files_charset_info, file_name);
|
||||||
if (open_and_lock_tables(thd, &table_list))
|
if ((res= open_and_lock_tables(thd, &table_list)))
|
||||||
{
|
{
|
||||||
for (uint i=2 ; i < field_list.elements ; i++)
|
for (uint i=2 ; i < field_list.elements ; i++)
|
||||||
protocol->store_null();
|
protocol->store_null();
|
||||||
// Send error to Comment field
|
// Send error to Comment field if possible
|
||||||
protocol->store(thd->net.last_error, system_charset_info);
|
if (res < 0)
|
||||||
thd->clear_error();
|
{
|
||||||
|
protocol->store(thd->net.last_error, system_charset_info);
|
||||||
|
thd->clear_error();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DBUG_RETURN(1)
|
||||||
}
|
}
|
||||||
else if (table_list.view)
|
else if (table_list.view)
|
||||||
{
|
{
|
||||||
@@ -695,14 +701,16 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
|
|||||||
char tmp[MAX_FIELD_WIDTH];
|
char tmp[MAX_FIELD_WIDTH];
|
||||||
Item *item;
|
Item *item;
|
||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
|
int res;
|
||||||
DBUG_ENTER("mysqld_show_fields");
|
DBUG_ENTER("mysqld_show_fields");
|
||||||
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
||||||
table_list->real_name));
|
table_list->real_name));
|
||||||
|
|
||||||
table_list->lock_type= TL_UNLOCK;
|
table_list->lock_type= TL_UNLOCK;
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if ((res= open_and_lock_tables(thd, table_list)))
|
||||||
{
|
{
|
||||||
send_error(thd);
|
if (res < 0)
|
||||||
|
send_error(thd);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
table= table_list->table;
|
table= table_list->table;
|
||||||
@@ -836,14 +844,16 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||||||
Protocol *protocol= thd->protocol;
|
Protocol *protocol= thd->protocol;
|
||||||
char buff[2048];
|
char buff[2048];
|
||||||
String buffer(buff, sizeof(buff), system_charset_info);
|
String buffer(buff, sizeof(buff), system_charset_info);
|
||||||
|
int res;
|
||||||
DBUG_ENTER("mysqld_show_create");
|
DBUG_ENTER("mysqld_show_create");
|
||||||
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
|
||||||
table_list->real_name));
|
table_list->real_name));
|
||||||
|
|
||||||
/* Only one table for now, but VIEW can involve several tables */
|
/* Only one table for now, but VIEW can involve several tables */
|
||||||
if (open_and_lock_tables(thd, table_list))
|
if ((res= open_and_lock_tables(thd, table_list)))
|
||||||
{
|
{
|
||||||
send_error(thd);
|
if (res < 0)
|
||||||
|
send_error(thd);
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
/* TODO: add environment variables show when it become possible */
|
/* TODO: add environment variables show when it become possible */
|
||||||
|
@@ -113,8 +113,8 @@ int mysql_update(THD *thd,
|
|||||||
LINT_INIT(used_index);
|
LINT_INIT(used_index);
|
||||||
LINT_INIT(timestamp_query_id);
|
LINT_INIT(timestamp_query_id);
|
||||||
|
|
||||||
if ((open_and_lock_tables(thd, table_list)))
|
if ((error= open_and_lock_tables(thd, table_list)))
|
||||||
DBUG_RETURN(-1);
|
DBUG_RETURN(error);
|
||||||
thd->proc_info="init";
|
thd->proc_info="init";
|
||||||
table= table_list->table;
|
table= table_list->table;
|
||||||
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
|
||||||
|
@@ -318,8 +318,10 @@ err:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// index of revision number in following table
|
/* index of revision number in following table */
|
||||||
static const int revision_number_position= 4;
|
static const int revision_number_position= 5;
|
||||||
|
/* index of last required parameter for making view */
|
||||||
|
static const int last_parameter= 8;
|
||||||
|
|
||||||
static char *view_field_names[]=
|
static char *view_field_names[]=
|
||||||
{
|
{
|
||||||
@@ -327,6 +329,7 @@ static char *view_field_names[]=
|
|||||||
(char*)"md5",
|
(char*)"md5",
|
||||||
(char*)"updatable",
|
(char*)"updatable",
|
||||||
(char*)"algorithm",
|
(char*)"algorithm",
|
||||||
|
(char*)"syscharset",
|
||||||
(char*)"revision",
|
(char*)"revision",
|
||||||
(char*)"timestamp",
|
(char*)"timestamp",
|
||||||
(char*)"create-version",
|
(char*)"create-version",
|
||||||
@@ -343,13 +346,15 @@ static File_option view_parameters[]=
|
|||||||
FILE_OPTIONS_ULONGLONG},
|
FILE_OPTIONS_ULONGLONG},
|
||||||
{{view_field_names[3], 9}, offsetof(TABLE_LIST, algorithm),
|
{{view_field_names[3], 9}, offsetof(TABLE_LIST, algorithm),
|
||||||
FILE_OPTIONS_ULONGLONG},
|
FILE_OPTIONS_ULONGLONG},
|
||||||
{{view_field_names[4], 8}, offsetof(TABLE_LIST, revision),
|
{{view_field_names[4], 10}, offsetof(TABLE_LIST, syscharset),
|
||||||
|
FILE_OPTIONS_STRING},
|
||||||
|
{{view_field_names[5], 8}, offsetof(TABLE_LIST, revision),
|
||||||
FILE_OPTIONS_REV},
|
FILE_OPTIONS_REV},
|
||||||
{{view_field_names[5], 9}, offsetof(TABLE_LIST, timestamp),
|
{{view_field_names[6], 9}, offsetof(TABLE_LIST, timestamp),
|
||||||
FILE_OPTIONS_TIMESTAMP},
|
FILE_OPTIONS_TIMESTAMP},
|
||||||
{{view_field_names[6], 14}, offsetof(TABLE_LIST, file_version),
|
{{view_field_names[7], 14}, offsetof(TABLE_LIST, file_version),
|
||||||
FILE_OPTIONS_ULONGLONG},
|
FILE_OPTIONS_ULONGLONG},
|
||||||
{{view_field_names[7], 6}, offsetof(TABLE_LIST, source),
|
{{view_field_names[8], 6}, offsetof(TABLE_LIST, source),
|
||||||
FILE_OPTIONS_ESTRING},
|
FILE_OPTIONS_ESTRING},
|
||||||
{{NULL, 0}, 0,
|
{{NULL, 0}, 0,
|
||||||
FILE_OPTIONS_STRING}
|
FILE_OPTIONS_STRING}
|
||||||
@@ -468,6 +473,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||||||
view->query.length= str.length()-1; // we do not need last \0
|
view->query.length= str.length()-1; // we do not need last \0
|
||||||
view->source.str= thd->query;
|
view->source.str= thd->query;
|
||||||
view->source.length= thd->query_length;
|
view->source.length= thd->query_length;
|
||||||
|
view->syscharset.str= (char *)system_charset_info->csname;
|
||||||
|
view->syscharset.length= strlen(view->syscharset.str);
|
||||||
view->file_version= 1;
|
view->file_version= 1;
|
||||||
view->calc_md5(md5);
|
view->calc_md5(md5);
|
||||||
view->md5.str= md5;
|
view->md5.str= md5;
|
||||||
@@ -520,6 +527,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||||||
my_bool
|
my_bool
|
||||||
mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
||||||
{
|
{
|
||||||
|
bool include_proc_table= 0;
|
||||||
DBUG_ENTER("mysql_make_view");
|
DBUG_ENTER("mysql_make_view");
|
||||||
|
|
||||||
if (table->view)
|
if (table->view)
|
||||||
@@ -551,7 +559,8 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
|||||||
TODO: when VIEWs will be stored in cache, table mem_root should
|
TODO: when VIEWs will be stored in cache, table mem_root should
|
||||||
be used here
|
be used here
|
||||||
*/
|
*/
|
||||||
if (parser->parse((gptr)table, &thd->mem_root, view_parameters, 6))
|
if (parser->parse((gptr)table, &thd->mem_root, view_parameters,
|
||||||
|
last_parameter))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -603,7 +612,21 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
|||||||
*/
|
*/
|
||||||
thd->options&= ~(MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
|
thd->options&= ~(MODE_PIPES_AS_CONCAT | MODE_ANSI_QUOTES |
|
||||||
MODE_IGNORE_SPACE | MODE_NO_BACKSLASH_ESCAPES);
|
MODE_IGNORE_SPACE | MODE_NO_BACKSLASH_ESCAPES);
|
||||||
|
CHARSET_INFO *save_cs= thd->variables.character_set_client;
|
||||||
|
if (!table->syscharset.length)
|
||||||
|
thd->variables.character_set_client= system_charset_info;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!(thd->variables.character_set_client=
|
||||||
|
get_charset_by_csname(table->syscharset.str,
|
||||||
|
MY_CS_PRIMARY, MYF(MY_WME))))
|
||||||
|
{
|
||||||
|
thd->variables.character_set_client= save_cs;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
res= yyparse((void *)thd);
|
res= yyparse((void *)thd);
|
||||||
|
thd->variables.character_set_client= save_cs;
|
||||||
thd->options= options;
|
thd->options= options;
|
||||||
}
|
}
|
||||||
if (!res && !thd->is_fatal_error)
|
if (!res && !thd->is_fatal_error)
|
||||||
@@ -612,10 +635,25 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
|
|||||||
table->belong_to_view :
|
table->belong_to_view :
|
||||||
table);
|
table);
|
||||||
|
|
||||||
/* move SP to main LEX */
|
if (lex->spfuns.records)
|
||||||
sp_merge_funs(old_lex, lex);
|
{
|
||||||
if (lex->spfuns.array.buffer)
|
/* move SP to main LEX */
|
||||||
hash_free(&lex->spfuns);
|
sp_merge_funs(old_lex, lex);
|
||||||
|
if (lex->spfuns.array.buffer)
|
||||||
|
hash_free(&lex->spfuns);
|
||||||
|
if (old_lex->proc_table == 0 &&
|
||||||
|
(old_lex->proc_table=
|
||||||
|
(TABLE_LIST*)thd->calloc(sizeof(TABLE_LIST))) != 0)
|
||||||
|
{
|
||||||
|
TABLE_LIST *table= old_lex->proc_table;
|
||||||
|
table->db= (char*)"mysql";
|
||||||
|
table->db_length= 5;
|
||||||
|
table->real_name= table->alias= (char*)"proc";
|
||||||
|
table->real_name_length= 4;
|
||||||
|
table->cacheable_table= 1;
|
||||||
|
include_proc_table= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
old_next= table->next_global;
|
old_next= table->next_global;
|
||||||
if ((table->next_global= lex->query_tables))
|
if ((table->next_global= lex->query_tables))
|
||||||
@@ -742,6 +780,17 @@ ok:
|
|||||||
lex->all_selects_list->link_prev=
|
lex->all_selects_list->link_prev=
|
||||||
(st_select_lex_node**)&old_lex->all_selects_list;
|
(st_select_lex_node**)&old_lex->all_selects_list;
|
||||||
|
|
||||||
|
if (include_proc_table)
|
||||||
|
{
|
||||||
|
TABLE_LIST *proc= old_lex->proc_table;
|
||||||
|
if((proc->next_global= table->next_global))
|
||||||
|
{
|
||||||
|
table->next_global->prev_global= &proc->next_global;
|
||||||
|
}
|
||||||
|
proc->prev_global= &table->next_global;
|
||||||
|
table->next_global= proc;
|
||||||
|
}
|
||||||
|
|
||||||
thd->lex= old_lex;
|
thd->lex= old_lex;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
|
@@ -29,9 +29,12 @@ typedef struct st_order {
|
|||||||
Item **item; /* Point at item in select fields */
|
Item **item; /* Point at item in select fields */
|
||||||
Item *item_ptr; /* Storage for initial item */
|
Item *item_ptr; /* Storage for initial item */
|
||||||
Item **item_copy; /* For SPs; the original item ptr */
|
Item **item_copy; /* For SPs; the original item ptr */
|
||||||
|
int counter; /* position in SELECT list, correct
|
||||||
|
only if counter_used is true*/
|
||||||
bool asc; /* true if ascending */
|
bool asc; /* true if ascending */
|
||||||
bool free_me; /* true if item isn't shared */
|
bool free_me; /* true if item isn't shared */
|
||||||
bool in_field_list; /* true if in select field list */
|
bool in_field_list; /* true if in select field list */
|
||||||
|
bool counter_used; /* parapeter was counter of columns */
|
||||||
Field *field; /* If tmp-table group */
|
Field *field; /* If tmp-table group */
|
||||||
char *buff; /* If tmp-table group */
|
char *buff; /* If tmp-table group */
|
||||||
table_map used,depend_map;
|
table_map used,depend_map;
|
||||||
@@ -221,6 +224,7 @@ typedef struct st_table_list
|
|||||||
LEX_STRING view_db; /* save view database */
|
LEX_STRING view_db; /* save view database */
|
||||||
LEX_STRING view_name; /* save view name */
|
LEX_STRING view_name; /* save view name */
|
||||||
LEX_STRING timestamp; /* GMT time stamp of last operation */
|
LEX_STRING timestamp; /* GMT time stamp of last operation */
|
||||||
|
LEX_STRING syscharset; /* charset of VIEW query text*/
|
||||||
ulonglong file_version; /* version of file's field set */
|
ulonglong file_version; /* version of file's field set */
|
||||||
ulonglong updatable_view; /* VIEW can be updated */
|
ulonglong updatable_view; /* VIEW can be updated */
|
||||||
ulonglong revision; /* revision control number */
|
ulonglong revision; /* revision control number */
|
||||||
|
Reference in New Issue
Block a user