Merge weblab.(none):/home/marcsql/TREE/mysql-5.1-base
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt-merge
This commit is contained in:
commit
1c27dd1d67
@ -1308,8 +1308,8 @@ static char *cover_definer_clause_in_trigger(const char *trigger_def_str,
|
||||
|
||||
@note This function will go away when WL#3995 is implemented.
|
||||
|
||||
@param[in] def_str CREATE FUNCTION|PROCEDURE statement string.
|
||||
@param[in] def_length length of the def_str.
|
||||
@param[in] def_str CREATE FUNCTION|PROCEDURE statement string.
|
||||
@param[in] def_str_length length of the def_str.
|
||||
|
||||
@return pointer to the new allocated query string.
|
||||
*/
|
||||
|
@ -750,7 +750,7 @@ void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
|
||||
@param thd user thread connection handle
|
||||
@param lex_str pointer to LEX_STRING object to be initialized
|
||||
@param str initializer to be copied into lex_str
|
||||
@param length length of str, in bytes
|
||||
@param size length of str, in bytes
|
||||
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
|
||||
instead of using lex_str value
|
||||
@return NULL on failure, or pointer to the LEX_STRING object
|
||||
@ -773,7 +773,7 @@ void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
|
||||
Invalidate the query cache for a given table.
|
||||
|
||||
@param thd user thread connection handle
|
||||
@param key databasename\0tablename\0
|
||||
@param key databasename\\0tablename\\0
|
||||
@param key_length length of key in bytes, including the NUL bytes
|
||||
@param using_trx flag: TRUE if using transactions, FALSE otherwise
|
||||
*/
|
||||
|
@ -1,100 +1,70 @@
|
||||
CREATE DATABASE IF NOT EXISTS events_test;
|
||||
USE events_test;
|
||||
"We use procedure here because its statements won't be logged into the general log"
|
||||
"If we had used normal select that are logged in different ways depending on whether"
|
||||
"the test suite is run in normal mode or with --ps-protocol"
|
||||
CREATE procedure select_general_log()
|
||||
BEGIN
|
||||
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
|
||||
END|
|
||||
"Check General Query Log"
|
||||
CALL select_general_log();
|
||||
drop database if exists events_test;
|
||||
create database if not exists events_test;
|
||||
use events_test;
|
||||
|
||||
We use procedure here because its statements won't be
|
||||
logged into the general log. If we had used normal select
|
||||
that are logged in different ways depending on whether the
|
||||
test suite is run in normal mode or with --ps-protocol
|
||||
|
||||
create procedure select_general_log()
|
||||
begin
|
||||
select user_host, argument from mysql.general_log
|
||||
where argument like '%events_logs_test%';
|
||||
end|
|
||||
|
||||
Check that general query log works, but sub-statements
|
||||
of the stored procedure do not leave traces in it.
|
||||
|
||||
truncate mysql.general_log;
|
||||
select 'events_logs_tests' as outside_event;
|
||||
outside_event
|
||||
events_logs_tests
|
||||
call select_general_log();
|
||||
user_host argument
|
||||
USER_HOST CREATE procedure select_general_log()
|
||||
BEGIN
|
||||
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
|
||||
END
|
||||
SET GLOBAL event_scheduler=on;
|
||||
TRUNCATE mysql.general_log;
|
||||
CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL;
|
||||
"Wait the scheduler to start"
|
||||
"Should see 2 rows - the 'SELECT' is in the middle. The other two are selects from general_log"
|
||||
CALL select_general_log();
|
||||
USER_HOST select 'events_logs_tests' as outside_event
|
||||
|
||||
Check that unlike sub-statements of stored procedures,
|
||||
sub-statements of events are present in the general log.
|
||||
|
||||
set global event_scheduler=on;
|
||||
truncate mysql.general_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve do select 'events_logs_test' as inside_event;
|
||||
call select_general_log();
|
||||
user_host argument
|
||||
USER_HOST CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL
|
||||
USER_HOST SELECT 'alabala', SLEEP(1) FROM DUAL
|
||||
DROP PROCEDURE select_general_log;
|
||||
DROP EVENT log_general;
|
||||
SET GLOBAL event_scheduler=off;
|
||||
"Check slow query log"
|
||||
"Save the values"
|
||||
SET @old_global_long_query_time:=(select get_value());
|
||||
SET @old_session_long_query_time:=@@long_query_time;
|
||||
SHOW VARIABLES LIKE 'log_slow_queries';
|
||||
USER_HOST create event ev_log_general on schedule at now() on completion not preserve do select 'events_logs_test' as inside_event
|
||||
USER_HOST select 'events_logs_test' as inside_event
|
||||
|
||||
Check slow query log
|
||||
|
||||
Ensure that slow logging is on
|
||||
show variables like 'log_slow_queries';
|
||||
Variable_name Value
|
||||
log_slow_queries ON
|
||||
DROP FUNCTION get_value;
|
||||
"Make it quite long"
|
||||
SET SESSION long_query_time=300;
|
||||
TRUNCATE mysql.slow_log;
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
user_host query_time db sql_text
|
||||
"Set new values"
|
||||
SET GLOBAL long_query_time=4;
|
||||
SET SESSION long_query_time=0.5;
|
||||
"Check that logging is working"
|
||||
SELECT SLEEP(2);
|
||||
SLEEP(2)
|
||||
0
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
user_host query_time db sql_text
|
||||
USER_HOST SLEEPVAL events_test SELECT SLEEP(2)
|
||||
SET SESSION long_query_time=300;
|
||||
"Make it quite long"
|
||||
TRUNCATE mysql.slow_log;
|
||||
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
|
||||
SET SESSION long_query_time=1;
|
||||
"This won't go to the slow log"
|
||||
SELECT * FROM slow_event_test;
|
||||
slo_val val
|
||||
SET SESSION long_query_time=1;
|
||||
SET GLOBAL event_scheduler=on;
|
||||
SET GLOBAL long_query_time=20;
|
||||
CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5);
|
||||
"Sleep some more time than the actual event run will take"
|
||||
SHOW VARIABLES LIKE 'event_scheduler';
|
||||
Variable_name Value
|
||||
event_scheduler ON
|
||||
"Check our table. Should see 1 row"
|
||||
SELECT * FROM slow_event_test;
|
||||
slo_val val
|
||||
20 0
|
||||
"Check slow log. Should not see anything because 1.5 is under the threshold of 20 for GLOBAL, though over SESSION which is 1"
|
||||
"This should show that the GLOBAL value is regarded and not the SESSION one of the current connection"
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
user_host query_time db sql_text
|
||||
"Another test to show that GLOBAL is regarded and not SESSION."
|
||||
"This should go to the slow log"
|
||||
SET SESSION long_query_time=10;
|
||||
DROP EVENT long_event;
|
||||
SET GLOBAL long_query_time=1;
|
||||
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
|
||||
"Sleep some more time than the actual event run will take"
|
||||
"Check our table. Should see 2 rows"
|
||||
SELECT * FROM slow_event_test;
|
||||
slo_val val
|
||||
20 0
|
||||
1 0
|
||||
"Check slow log. Should see 1 row because 2 is over the threshold of 1 for GLOBAL, though under SESSION which is 10"
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
user_host query_time db sql_text
|
||||
USER_HOST SLEEPVAL events_test INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2)
|
||||
DROP EVENT long_event2;
|
||||
"Make it quite long"
|
||||
SET SESSION long_query_time=300;
|
||||
TRUNCATE mysql.slow_log;
|
||||
DROP TABLE slow_event_test;
|
||||
SET GLOBAL long_query_time =@old_global_long_query_time;
|
||||
SET SESSION long_query_time =@old_session_long_query_time;
|
||||
DROP DATABASE events_test;
|
||||
SET GLOBAL event_scheduler=off;
|
||||
|
||||
Demonstrate that session value has no effect
|
||||
|
||||
set @@session.long_query_time=1;
|
||||
set @@global.long_query_time=300;
|
||||
truncate mysql.slow_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve
|
||||
do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
|
||||
Nothing should be logged
|
||||
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
user_host db sql_text
|
||||
set @@global.long_query_time=1;
|
||||
truncate mysql.slow_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve
|
||||
do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
|
||||
Event sub-statement should be logged.
|
||||
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
user_host db sql_text
|
||||
USER_HOST events_test select 'events_logs_test' as inside_event, sleep(1.5)
|
||||
drop database events_test;
|
||||
set global event_scheduler=off;
|
||||
set @@global.long_query_time=default;
|
||||
set @@session.long_query_time=default;
|
||||
|
@ -13,9 +13,9 @@ insert into t1 values (1);
|
||||
lock tables t1 read;
|
||||
update low_priority t1 set n = 4;
|
||||
select n from t1;
|
||||
unlock tables;
|
||||
n
|
||||
1
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
create table t1 (a int, b int);
|
||||
create table t2 (c int, d int);
|
||||
@ -43,6 +43,7 @@ insert t1 select * from t2;
|
||||
drop table t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
create table t1(a int);
|
||||
lock tables t1 write;
|
||||
show columns from t1;
|
||||
@ -91,10 +92,11 @@ DROP DATABASE mysqltest_1;
|
||||
ERROR HY000: Can't drop database 'mysqltest_1'; database doesn't exist
|
||||
create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) engine=innodb;
|
||||
lock tables t1 write;
|
||||
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
|
||||
alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
|
||||
alter table t1 auto_increment=0;
|
||||
alter table t1 auto_increment=0;
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
create table t1 (i int);
|
||||
lock table t1 read;
|
||||
update t1 set i= 10;;
|
||||
@ -104,4 +106,11 @@ i
|
||||
ERROR 70100: Query execution was interrupted
|
||||
unlock tables;
|
||||
drop table t1;
|
||||
drop table if exists t1;
|
||||
create table t1 (a int) ENGINE=MEMORY;
|
||||
--> client 2
|
||||
handler t1 open;
|
||||
ERROR HY000: Table storage engine for 't1' doesn't have this option
|
||||
--> client 1
|
||||
drop table t1;
|
||||
End of 5.1 tests
|
||||
|
@ -273,6 +273,16 @@ create table VAR_SAMP(a int);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP(a int)' at line 1
|
||||
create table VAR_SAMP (a int);
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VAR_SAMP (a int)' at line 1
|
||||
DROP TABLE IF EXISTS table_25930_a;
|
||||
DROP TABLE IF EXISTS table_25930_b;
|
||||
SET SQL_MODE = 'ANSI_QUOTES';
|
||||
CREATE TABLE table_25930_a ( "blah" INT );
|
||||
CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
|
||||
desc table_25930_b;
|
||||
Field Type Null Key Default Extra
|
||||
"blah" - 1 bigint(12) YES NULL
|
||||
DROP TABLE table_25930_a;
|
||||
DROP TABLE table_25930_b;
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
select pi(3.14);
|
||||
ERROR 42000: Incorrect parameter count in the call to native function 'pi'
|
||||
|
@ -1650,6 +1650,30 @@ a (select count(*) from t2)
|
||||
3 0
|
||||
4 0
|
||||
drop table t1,t2;
|
||||
DROP DATABASE IF EXISTS bug30269;
|
||||
CREATE DATABASE bug30269;
|
||||
USE bug30269;
|
||||
CREATE TABLE test1 (id int, name varchar(23));
|
||||
CREATE VIEW view1 AS SELECT id FROM test1;
|
||||
INSERT INTO test1 VALUES (5, 'testit');
|
||||
GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
|
||||
GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
|
||||
set global query_cache_size= 81920;
|
||||
USE bug30269;
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
SELECT id FROM test1 WHERE id>2;
|
||||
id
|
||||
5
|
||||
SELECT id FROM view1 WHERE id>2;
|
||||
id
|
||||
5
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
DROP DATABASE bug30269;
|
||||
DROP USER 'bug30269'@'localhost';
|
||||
set GLOBAL query_cache_type=default;
|
||||
set GLOBAL query_cache_limit=default;
|
||||
set GLOBAL query_cache_min_res_unit=default;
|
||||
|
@ -1,115 +1,87 @@
|
||||
# Can't test with embedded server that doesn't support grants
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
CREATE DATABASE IF NOT EXISTS events_test;
|
||||
USE events_test;
|
||||
--echo "We use procedure here because its statements won't be logged into the general log"
|
||||
--echo "If we had used normal select that are logged in different ways depending on whether"
|
||||
--echo "the test suite is run in normal mode or with --ps-protocol"
|
||||
--disable_warnings
|
||||
drop database if exists events_test;
|
||||
--enable_warnings
|
||||
create database if not exists events_test;
|
||||
use events_test;
|
||||
--echo
|
||||
--echo We use procedure here because its statements won't be
|
||||
--echo logged into the general log. If we had used normal select
|
||||
--echo that are logged in different ways depending on whether the
|
||||
--echo test suite is run in normal mode or with --ps-protocol
|
||||
--echo
|
||||
delimiter |;
|
||||
CREATE procedure select_general_log()
|
||||
BEGIN
|
||||
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
|
||||
END|
|
||||
delimiter ;|
|
||||
--echo "Check General Query Log"
|
||||
--replace_column 1 USER_HOST
|
||||
CALL select_general_log();
|
||||
SET GLOBAL event_scheduler=on;
|
||||
TRUNCATE mysql.general_log;
|
||||
CREATE EVENT log_general ON SCHEDULE EVERY 1 MINUTE DO SELECT 'alabala', SLEEP(1) FROM DUAL;
|
||||
--echo "Wait the scheduler to start"
|
||||
--sleep 1.5
|
||||
--echo "Should see 2 rows - the 'SELECT' is in the middle. The other two are selects from general_log"
|
||||
--replace_column 1 USER_HOST
|
||||
CALL select_general_log();
|
||||
DROP PROCEDURE select_general_log;
|
||||
DROP EVENT log_general;
|
||||
SET GLOBAL event_scheduler=off;
|
||||
|
||||
--echo "Check slow query log"
|
||||
--disable_query_log
|
||||
DELIMITER |;
|
||||
CREATE FUNCTION get_value()
|
||||
returns INT
|
||||
deterministic
|
||||
BEGIN
|
||||
DECLARE var_name CHAR(255);
|
||||
DECLARE var_val INT;
|
||||
DECLARE done INT DEFAULT 0;
|
||||
DECLARE cur1 CURSOR FOR SHOW GLOBAL VARIABLES LIKE 'long_query_time';
|
||||
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
|
||||
OPEN cur1;
|
||||
FETCH cur1 INTO var_name, var_val;
|
||||
CLOSE cur1;
|
||||
RETURN var_val;
|
||||
create procedure select_general_log()
|
||||
begin
|
||||
select user_host, argument from mysql.general_log
|
||||
where argument like '%events_logs_test%';
|
||||
end|
|
||||
DELIMITER ;|
|
||||
--enable_query_log
|
||||
--echo "Save the values"
|
||||
SET @old_global_long_query_time:=(select get_value());
|
||||
SET @old_session_long_query_time:=@@long_query_time;
|
||||
SHOW VARIABLES LIKE 'log_slow_queries';
|
||||
DROP FUNCTION get_value;
|
||||
--echo "Make it quite long"
|
||||
SET SESSION long_query_time=300;
|
||||
TRUNCATE mysql.slow_log;
|
||||
delimiter ;|
|
||||
--echo
|
||||
--echo Check that general query log works, but sub-statements
|
||||
--echo of the stored procedure do not leave traces in it.
|
||||
--echo
|
||||
truncate mysql.general_log;
|
||||
# Logging format in ps protocol is slightly different
|
||||
--disable_ps_protocol
|
||||
select 'events_logs_tests' as outside_event;
|
||||
--enable_ps_protocol
|
||||
--replace_column 1 USER_HOST
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
--echo "Set new values"
|
||||
SET GLOBAL long_query_time=4;
|
||||
SET SESSION long_query_time=0.5;
|
||||
--echo "Check that logging is working"
|
||||
SELECT SLEEP(2);
|
||||
--replace_column 1 USER_HOST 2 SLEEPVAL
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
SET SESSION long_query_time=300;
|
||||
--echo "Make it quite long"
|
||||
TRUNCATE mysql.slow_log;
|
||||
CREATE TABLE slow_event_test (slo_val tinyint, val tinyint);
|
||||
SET SESSION long_query_time=1;
|
||||
--echo "This won't go to the slow log"
|
||||
SELECT * FROM slow_event_test;
|
||||
SET SESSION long_query_time=1;
|
||||
SET GLOBAL event_scheduler=on;
|
||||
SET GLOBAL long_query_time=20;
|
||||
CREATE EVENT long_event ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(1.5);
|
||||
--echo "Sleep some more time than the actual event run will take"
|
||||
--sleep 2
|
||||
SHOW VARIABLES LIKE 'event_scheduler';
|
||||
--echo "Check our table. Should see 1 row"
|
||||
SELECT * FROM slow_event_test;
|
||||
--echo "Check slow log. Should not see anything because 1.5 is under the threshold of 20 for GLOBAL, though over SESSION which is 1"
|
||||
--echo "This should show that the GLOBAL value is regarded and not the SESSION one of the current connection"
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
--echo "Another test to show that GLOBAL is regarded and not SESSION."
|
||||
--echo "This should go to the slow log"
|
||||
SET SESSION long_query_time=10;
|
||||
DROP EVENT long_event;
|
||||
SET GLOBAL long_query_time=1;
|
||||
CREATE EVENT long_event2 ON SCHEDULE EVERY 1 MINUTE DO INSERT INTO slow_event_test SELECT @@long_query_time, SLEEP(2);
|
||||
--echo "Sleep some more time than the actual event run will take"
|
||||
let $wait_timeout= 30;
|
||||
let $wait_condition= SELECT COUNT(*) = 1 FROM mysql.slow_log;
|
||||
call select_general_log();
|
||||
--echo
|
||||
--echo Check that unlike sub-statements of stored procedures,
|
||||
--echo sub-statements of events are present in the general log.
|
||||
--echo
|
||||
set global event_scheduler=on;
|
||||
truncate mysql.general_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve do select 'events_logs_test' as inside_event;
|
||||
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
|
||||
--source include/wait_condition.inc
|
||||
--echo "Check our table. Should see 2 rows"
|
||||
SELECT * FROM slow_event_test;
|
||||
--echo "Check slow log. Should see 1 row because 2 is over the threshold of 1 for GLOBAL, though under SESSION which is 10"
|
||||
--replace_column 1 USER_HOST 2 SLEEPVAL
|
||||
SELECT user_host, query_time, db, sql_text FROM mysql.slow_log;
|
||||
DROP EVENT long_event2;
|
||||
--echo "Make it quite long"
|
||||
SET SESSION long_query_time=300;
|
||||
TRUNCATE mysql.slow_log;
|
||||
DROP TABLE slow_event_test;
|
||||
SET GLOBAL long_query_time =@old_global_long_query_time;
|
||||
SET SESSION long_query_time =@old_session_long_query_time;
|
||||
--replace_column 1 USER_HOST
|
||||
call select_general_log();
|
||||
|
||||
DROP DATABASE events_test;
|
||||
--echo
|
||||
--echo Check slow query log
|
||||
--echo
|
||||
--echo Ensure that slow logging is on
|
||||
show variables like 'log_slow_queries';
|
||||
--echo
|
||||
--echo Demonstrate that session value has no effect
|
||||
--echo
|
||||
set @@session.long_query_time=1;
|
||||
set @@global.long_query_time=300;
|
||||
truncate mysql.slow_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve
|
||||
do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
|
||||
--source include/wait_condition.inc
|
||||
--echo
|
||||
--echo Nothing should be logged
|
||||
--echo
|
||||
--replace_column 1 USER_HOST
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
set @@global.long_query_time=1;
|
||||
truncate mysql.slow_log;
|
||||
create event ev_log_general on schedule at now() on completion not preserve
|
||||
do select 'events_logs_test' as inside_event, sleep(1.5);
|
||||
--let $wait_condition=select count(*)=0 from information_schema.events where event_name='ev_log_general'
|
||||
--source include/wait_condition.inc
|
||||
--echo
|
||||
--echo Event sub-statement should be logged.
|
||||
--echo
|
||||
--replace_column 1 USER_HOST
|
||||
select user_host, db, sql_text from mysql.slow_log where sql_text not like 'create event%';
|
||||
|
||||
drop database events_test;
|
||||
set global event_scheduler=off;
|
||||
set @@global.long_query_time=default;
|
||||
set @@session.long_query_time=default;
|
||||
|
||||
SET GLOBAL event_scheduler=off;
|
||||
|
||||
#
|
||||
# Safety
|
||||
#
|
||||
let $wait_condition=
|
||||
select count(*) = 0 from information_schema.processlist
|
||||
where db='events_test' and command = 'Connect' and user=current_user();
|
||||
|
@ -16,10 +16,16 @@ lock tables t1 write;
|
||||
connection writer;
|
||||
send update low_priority t1 set n = 4;
|
||||
connection reader;
|
||||
--sleep 2
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "update low_priority t1 set n = 4";
|
||||
--source include/wait_condition.inc
|
||||
send select n from t1;
|
||||
connection locker;
|
||||
--sleep 2
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "select n from t1";
|
||||
--source include/wait_condition.inc
|
||||
unlock tables;
|
||||
connection writer;
|
||||
reap;
|
||||
@ -34,15 +40,15 @@ lock tables t1 read;
|
||||
connection writer;
|
||||
send update low_priority t1 set n = 4;
|
||||
connection reader;
|
||||
--sleep 2
|
||||
send select n from t1;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "update low_priority t1 set n = 4";
|
||||
--source include/wait_condition.inc
|
||||
select n from t1;
|
||||
connection locker;
|
||||
--sleep 2
|
||||
unlock tables;
|
||||
connection writer;
|
||||
reap;
|
||||
connection reader;
|
||||
reap;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
@ -58,13 +64,9 @@ insert into t1 values(2,2);
|
||||
insert into t2 values(1,2);
|
||||
lock table t1 read;
|
||||
connection writer;
|
||||
--sleep 2
|
||||
send update t1,t2 set c=a where b=d;
|
||||
update t1,t2 set c=a where b=d;
|
||||
connection reader;
|
||||
--sleep 2
|
||||
select c from t2;
|
||||
connection writer;
|
||||
reap;
|
||||
connection locker;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
@ -73,7 +75,7 @@ drop table t2;
|
||||
# Test problem when using locks on many tables and droping a table that
|
||||
# is to-be-locked by another thread
|
||||
#
|
||||
|
||||
#
|
||||
connection locker;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
@ -81,6 +83,10 @@ lock table t1 write, t2 write;
|
||||
connection reader;
|
||||
send insert t1 select * from t2;
|
||||
connection locker;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "insert t1 select * from t2";
|
||||
--source include/wait_condition.inc
|
||||
drop table t2;
|
||||
connection reader;
|
||||
--error 1146
|
||||
@ -99,6 +105,10 @@ lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
|
||||
connection reader;
|
||||
send insert t1 select * from t2;
|
||||
connection locker;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "insert t1 select * from t2";
|
||||
--source include/wait_condition.inc
|
||||
drop table t2;
|
||||
connection reader;
|
||||
--error 1146
|
||||
@ -107,7 +117,7 @@ connection locker;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# BUG#9998 - MySQL client hangs on USE "database"
|
||||
@ -131,15 +141,18 @@ connection locker;
|
||||
use mysql;
|
||||
LOCK TABLES columns_priv WRITE, db WRITE, host WRITE, user WRITE;
|
||||
FLUSH TABLES;
|
||||
--sleep 1
|
||||
#
|
||||
connection reader;
|
||||
use mysql;
|
||||
#NOTE: This must be a multi-table select, otherwise the deadlock will not occur
|
||||
send SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1;
|
||||
--sleep 1
|
||||
#
|
||||
connection locker;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info =
|
||||
"SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1";
|
||||
--source include/wait_condition.inc
|
||||
# Make test case independent from earlier grants.
|
||||
--replace_result "Table is already up to date" "OK"
|
||||
OPTIMIZE TABLES columns_priv, db, host, user;
|
||||
@ -163,10 +176,13 @@ LOCK TABLE t1 WRITE;
|
||||
# This waits until t1 is unlocked.
|
||||
connection locker;
|
||||
send FLUSH TABLES WITH READ LOCK;
|
||||
--sleep 1
|
||||
#
|
||||
# This must not block.
|
||||
connection writer;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
|
||||
--source include/wait_condition.inc
|
||||
# This must not block.
|
||||
CREATE TABLE t2 (c1 int);
|
||||
UNLOCK TABLES;
|
||||
#
|
||||
@ -187,10 +203,13 @@ LOCK TABLE t1 WRITE;
|
||||
# This waits until t1 is unlocked.
|
||||
connection locker;
|
||||
send FLUSH TABLES WITH READ LOCK;
|
||||
--sleep 1
|
||||
#
|
||||
# This must not block.
|
||||
connection writer;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Flushing tables" and info = "FLUSH TABLES WITH READ LOCK";
|
||||
--source include/wait_condition.inc
|
||||
--error 1100
|
||||
CREATE TABLE t2 AS SELECT * FROM t1;
|
||||
UNLOCK TABLES;
|
||||
@ -219,11 +238,15 @@ FLUSH TABLES WITH READ LOCK;
|
||||
# wait in wait_if_global_read_lock().
|
||||
connection con2;
|
||||
send DROP DATABASE mysqltest_1;
|
||||
--sleep 1
|
||||
#
|
||||
# With bug in place: try to acquire LOCK_mysql_create_table...
|
||||
# When fixed: Reject dropping db because of the read lock.
|
||||
connection con1;
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Waiting for release of readlock"
|
||||
and info = "DROP DATABASE mysqltest_1";
|
||||
--source include/wait_condition.inc
|
||||
--error ER_CANT_UPDATE_WITH_READLOCK
|
||||
DROP DATABASE mysqltest_1;
|
||||
UNLOCK TABLES;
|
||||
@ -249,17 +272,18 @@ create table t1 (f1 int(12) unsigned not null auto_increment, primary key(f1)) e
|
||||
--enable_warnings
|
||||
lock tables t1 write;
|
||||
connection writer;
|
||||
--sleep 2
|
||||
delimiter //;
|
||||
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
|
||||
delimiter ;//
|
||||
send alter table t1 auto_increment=0;
|
||||
connection reader;
|
||||
--sleep 2
|
||||
delimiter //;
|
||||
send alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; alter table t1 auto_increment=0; //
|
||||
delimiter ;//
|
||||
let $wait_condition=
|
||||
select count(*) = 1 from information_schema.processlist
|
||||
where state = "Locked" and info = "alter table t1 auto_increment=0";
|
||||
--source include/wait_condition.inc
|
||||
send alter table t1 auto_increment=0;
|
||||
connection locker;
|
||||
--sleep 2
|
||||
let $wait_condition=
|
||||
select count(*) = 2 from information_schema.processlist
|
||||
where state = "Locked" and info = "alter table t1 auto_increment=0";
|
||||
--source include/wait_condition.inc
|
||||
unlock tables;
|
||||
connection writer;
|
||||
reap;
|
||||
@ -267,8 +291,8 @@ connection reader;
|
||||
reap;
|
||||
connection locker;
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
#
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
#
|
||||
@ -304,4 +328,19 @@ unlock tables;
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#25856 - HANDLER table OPEN in one connection lock DROP TABLE in another one
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
create table t1 (a int) ENGINE=MEMORY;
|
||||
--echo --> client 2
|
||||
connection locker;
|
||||
--error 1031
|
||||
handler t1 open;
|
||||
--echo --> client 1
|
||||
connection default;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.1 tests
|
||||
|
@ -363,6 +363,28 @@ create table VAR_SAMP(a int);
|
||||
--error ER_PARSE_ERROR
|
||||
create table VAR_SAMP (a int);
|
||||
|
||||
#
|
||||
# Bug#25930 (CREATE TABLE x SELECT ... parses columns wrong when ran with
|
||||
# ANSI_QUOTES mode)
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS table_25930_a;
|
||||
DROP TABLE IF EXISTS table_25930_b;
|
||||
--enable_warnings
|
||||
|
||||
SET SQL_MODE = 'ANSI_QUOTES';
|
||||
CREATE TABLE table_25930_a ( "blah" INT );
|
||||
CREATE TABLE table_25930_b SELECT "blah" - 1 FROM table_25930_a;
|
||||
|
||||
# The lexer used to chop the first <">,
|
||||
# not marking the start of the token "blah" correctly.
|
||||
desc table_25930_b;
|
||||
|
||||
DROP TABLE table_25930_a;
|
||||
DROP TABLE table_25930_b;
|
||||
|
||||
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
|
||||
#=============================================================================
|
||||
|
@ -1249,13 +1249,40 @@ connection default;
|
||||
disconnect user1;
|
||||
disconnect user2;
|
||||
disconnect user3;
|
||||
|
||||
#
|
||||
# Bug #30269 Query cache eats memory
|
||||
#
|
||||
--disable_warnings
|
||||
DROP DATABASE IF EXISTS bug30269;
|
||||
--enable_warnings
|
||||
CREATE DATABASE bug30269;
|
||||
USE bug30269;
|
||||
CREATE TABLE test1 (id int, name varchar(23));
|
||||
CREATE VIEW view1 AS SELECT id FROM test1;
|
||||
INSERT INTO test1 VALUES (5, 'testit');
|
||||
GRANT SELECT (id) ON TABLE bug30269.test1 TO 'bug30269'@'localhost';
|
||||
GRANT SELECT ON TABLE bug30269.view1 TO 'bug30269'@'localhost';
|
||||
set global query_cache_size= 81920;
|
||||
connect (bug30269, localhost, bug30269,,);
|
||||
connection bug30269;
|
||||
USE bug30269;
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
SELECT id FROM test1 WHERE id>2;
|
||||
SELECT id FROM view1 WHERE id>2;
|
||||
show status like 'Qcache_queries_in_cache';
|
||||
|
||||
connection default;
|
||||
DROP DATABASE bug30269;
|
||||
disconnect bug30269;
|
||||
DROP USER 'bug30269'@'localhost';
|
||||
|
||||
set GLOBAL query_cache_type=default;
|
||||
set GLOBAL query_cache_limit=default;
|
||||
set GLOBAL query_cache_min_res_unit=default;
|
||||
set GLOBAL query_cache_size=default;
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
||||
#
|
||||
# Bug #28211 RENAME DATABASE and query cache don't play nicely together
|
||||
#
|
||||
|
@ -77,7 +77,7 @@ int main(int argc, char **argv) {
|
||||
_print_csinfo(cs);
|
||||
fflush(stdout);
|
||||
|
||||
#define NOT_USED_ANYMORE
|
||||
#ifdef NOT_USED_ANYMORE
|
||||
cs_list = list_charsets(MYF(MY_CS_COMPILED | MY_CS_CONFIG));
|
||||
printf("LIST OF CHARSETS (compiled + *.conf):\n%s\n", cs_list);
|
||||
my_free(cs_list,MYF(0));
|
||||
|
@ -20,6 +20,10 @@
|
||||
#include "event_db_repository.h"
|
||||
#include "sp_head.h"
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
|
||||
#define EVEX_MAX_INTERVAL_VALUE 1000000000L
|
||||
|
||||
@ -2082,3 +2086,7 @@ event_basic_identifier_equal(LEX_STRING db, LEX_STRING name, Event_basic *b)
|
||||
return !sortcmp_lex_string(name, b->name, system_charset_info) &&
|
||||
!sortcmp_lex_string(db, b->dbname, system_charset_info);
|
||||
}
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
@ -15,6 +15,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
|
||||
@file event_data_objects.h
|
||||
*/
|
||||
|
||||
#define EVEX_GET_FIELD_FAILED -2
|
||||
#define EVEX_BAD_PARAMS -5
|
||||
@ -280,5 +286,8 @@ event_basic_db_equal(LEX_STRING db, Event_basic *et);
|
||||
bool
|
||||
event_basic_identifier_equal(LEX_STRING db, LEX_STRING name, Event_basic *b);
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
||||
#endif /* _EVENT_DATA_OBJECTS_H_ */
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "events.h"
|
||||
#include "sql_show.h"
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
|
||||
static
|
||||
const TABLE_FIELD_W_TYPE event_table_fields[ET_FIELD_COUNT] =
|
||||
{
|
||||
@ -556,7 +561,7 @@ Event_db_repository::open_event_table(THD *thd, enum thr_lock_type lock_type,
|
||||
only creates a record on disk.
|
||||
@pre The thread handle has no open tables.
|
||||
|
||||
@param[in,out] THD
|
||||
@param[in,out] thd THD
|
||||
@param[in] parse_data Parsed event definition
|
||||
@param[in] create_if_not TRUE if IF NOT EXISTS clause was provided
|
||||
to CREATE EVENT statement
|
||||
@ -657,7 +662,7 @@ end:
|
||||
|
||||
@param[in,out] thd thread handle
|
||||
@param[in] parse_data parsed event definition
|
||||
@paran[in[ new_dbname not NULL if ALTER EVENT RENAME
|
||||
@param[in] new_dbname not NULL if ALTER EVENT RENAME
|
||||
points at a new database name
|
||||
@param[in] new_name not NULL if ALTER EVENT RENAME
|
||||
points at a new event name
|
||||
@ -812,7 +817,7 @@ end:
|
||||
|
||||
|
||||
@retval FALSE an event with such db/name key exists
|
||||
@reval TRUE no record found or an error occured.
|
||||
@retval TRUE no record found or an error occured.
|
||||
*/
|
||||
|
||||
bool
|
||||
@ -1112,3 +1117,7 @@ Event_db_repository::check_system_tables(THD *thd)
|
||||
|
||||
DBUG_RETURN(test(ret));
|
||||
}
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
@ -15,8 +15,14 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
@file
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
|
||||
@file event_db_repository.h
|
||||
|
||||
Data Dictionary related operations of Event Scheduler.
|
||||
|
||||
This is a private header file of Events module. Please do not include it
|
||||
directly. All public declarations of Events module should be stored in
|
||||
events.h and event_data_objects.h.
|
||||
@ -119,4 +125,7 @@ private:
|
||||
void operator=(Event_db_repository &);
|
||||
};
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
#endif /* _EVENT_DB_REPOSITORY_H_ */
|
||||
|
@ -17,6 +17,10 @@
|
||||
#include "event_queue.h"
|
||||
#include "event_data_objects.h"
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
|
||||
#define EVENT_QUEUE_INITIAL_SIZE 30
|
||||
#define EVENT_QUEUE_EXTENT 30
|
||||
@ -749,3 +753,7 @@ Event_queue::dump_internal_status()
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
@ -15,12 +15,26 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
|
||||
@file event_queue.h
|
||||
|
||||
Queue of events awaiting execution.
|
||||
*/
|
||||
|
||||
class Event_basic;
|
||||
class Event_queue_element;
|
||||
class Event_queue_element_for_exec;
|
||||
|
||||
class THD;
|
||||
|
||||
/**
|
||||
Queue of active events awaiting execution.
|
||||
*/
|
||||
|
||||
class Event_queue
|
||||
{
|
||||
public:
|
||||
@ -105,5 +119,8 @@ private:
|
||||
bool mutex_queue_data_attempting_lock;
|
||||
bool waiting_on_cond;
|
||||
};
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
||||
#endif /* _EVENT_QUEUE_H_ */
|
||||
|
@ -20,6 +20,11 @@
|
||||
#include "event_queue.h"
|
||||
#include "event_db_repository.h"
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
|
||||
#ifdef __GNUC__
|
||||
#if __GNUC__ >= 2
|
||||
#define SCHED_FUNC __FUNCTION__
|
||||
@ -790,3 +795,7 @@ Event_scheduler::dump_internal_status()
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
@ -15,11 +15,19 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
/**
|
||||
@file
|
||||
This file is internal to Events module. Please do not include it directly.
|
||||
All public declarations of Events module are in events.h and
|
||||
event_data_objects.h.
|
||||
|
||||
Declarations of the scheduler thread class
|
||||
and related functionality.
|
||||
|
||||
This file is internal to Event_Scheduler module. Please do not
|
||||
include it directly. All public declarations of Event_Scheduler
|
||||
module are in events.h and event_data_objects.h.
|
||||
*/
|
||||
|
||||
|
||||
@ -140,4 +148,8 @@ private:
|
||||
void operator=(Event_scheduler &);
|
||||
};
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
||||
#endif /* _EVENT_SCHEDULER_H_ */
|
||||
|
@ -21,6 +21,11 @@
|
||||
#include "event_scheduler.h"
|
||||
#include "sp_head.h" // for Stored_program_creation_ctx
|
||||
|
||||
/**
|
||||
@addtogroup Event_Scheduler
|
||||
@{
|
||||
*/
|
||||
|
||||
/*
|
||||
TODO list :
|
||||
- CREATE EVENT should not go into binary log! Does it now? The SQL statements
|
||||
@ -790,8 +795,7 @@ Events::show_create_event(THD *thd, LEX_STRING dbname, LEX_STRING name)
|
||||
Check access rights and fill INFORMATION_SCHEMA.events table.
|
||||
|
||||
@param[in,out] thd Thread context
|
||||
@param[in] table The temporary table to fill.
|
||||
cond Unused
|
||||
@param[in] tables The temporary table to fill.
|
||||
|
||||
In MySQL INFORMATION_SCHEMA tables are temporary tables that are
|
||||
created and filled on demand. In this function, we fill
|
||||
@ -1187,3 +1191,7 @@ end:
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@} (End of group Event_Scheduler)
|
||||
*/
|
||||
|
16
sql/events.h
16
sql/events.h
@ -15,9 +15,14 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/*
|
||||
@file
|
||||
A public interface of Events Scheduler module.
|
||||
/**
|
||||
@defgroup Event_Scheduler Event Scheduler
|
||||
@ingroup Runtime_Environment
|
||||
@{
|
||||
|
||||
@file events.h
|
||||
|
||||
A public interface of Events_Scheduler module.
|
||||
*/
|
||||
|
||||
class Event_parse_data;
|
||||
@ -42,7 +47,7 @@ int
|
||||
sortcmp_lex_string(LEX_STRING s, LEX_STRING t, CHARSET_INFO *cs);
|
||||
|
||||
/**
|
||||
@class Events -- a facade to the functionality of the Event Scheduler.
|
||||
@brief A facade to the functionality of the Event Scheduler.
|
||||
|
||||
Every public operation against the scheduler has to be executed via the
|
||||
interface provided by a static method of this class. No instance of this
|
||||
@ -152,5 +157,8 @@ private:
|
||||
void operator=(Events &);
|
||||
};
|
||||
|
||||
/**
|
||||
@} (end of group Event Scheduler)
|
||||
*/
|
||||
|
||||
#endif /* _EVENT_H_ */
|
||||
|
@ -7824,7 +7824,7 @@ uchar *Field_blob::pack(uchar *to, const uchar *from, uint max_length)
|
||||
|
||||
@param to Destination of the data
|
||||
@param from Source of the data
|
||||
@param param_data <not used>
|
||||
@param param_data not used
|
||||
|
||||
@return New pointer into memory based on from + length of the data
|
||||
*/
|
||||
|
@ -1803,7 +1803,12 @@ class Send_field {
|
||||
*/
|
||||
|
||||
class Copy_field :public Sql_alloc {
|
||||
void (*get_copy_func(Field *to,Field *from))(Copy_field *);
|
||||
/**
|
||||
Convenience definition of a copy function returned by
|
||||
get_copy_func.
|
||||
*/
|
||||
typedef void Copy_func(Copy_field*);
|
||||
Copy_func *get_copy_func(Field *to, Field *from);
|
||||
public:
|
||||
uchar *from_ptr,*to_ptr;
|
||||
uchar *from_null_ptr,*to_null_ptr;
|
||||
|
@ -620,7 +620,8 @@ void Copy_field::set(Field *to,Field *from,bool save)
|
||||
}
|
||||
|
||||
|
||||
void (*Copy_field::get_copy_func(Field *to,Field *from))(Copy_field*)
|
||||
Copy_field::Copy_func *
|
||||
Copy_field::get_copy_func(Field *to,Field *from)
|
||||
{
|
||||
bool compatible_db_low_byte_first= (to->table->s->db_low_byte_first ==
|
||||
from->table->s->db_low_byte_first);
|
||||
|
@ -2398,7 +2398,7 @@ default_set_param_func(Item_param *param,
|
||||
}
|
||||
|
||||
|
||||
Item_param::Item_param(unsigned pos_in_query_arg) :
|
||||
Item_param::Item_param(uint pos_in_query_arg) :
|
||||
strict_type(FALSE),
|
||||
state(NO_VALUE),
|
||||
item_result_type(STRING_RESULT),
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ public:
|
||||
@param item_list The list of arguments to the function, can be NULL
|
||||
@return An item representing the parsed function call, or NULL
|
||||
*/
|
||||
virtual Item* create(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
|
||||
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list) = 0;
|
||||
|
||||
protected:
|
||||
/** Constructor */
|
||||
@ -80,7 +80,7 @@ public:
|
||||
@param item_list The list of arguments to the function, can be NULL
|
||||
@return An item representing the parsed function call
|
||||
*/
|
||||
virtual Item* create(THD *thd, LEX_STRING name, List<Item> *item_list);
|
||||
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
|
||||
|
||||
/**
|
||||
The builder create method, for qualified functions.
|
||||
@ -127,7 +127,7 @@ extern Create_qfunc * find_qualified_function_builder(THD *thd);
|
||||
class Create_udf_func : public Create_func
|
||||
{
|
||||
public:
|
||||
virtual Item* create(THD *thd, LEX_STRING name, List<Item> *item_list);
|
||||
virtual Item *create(THD *thd, LEX_STRING name, List<Item> *item_list);
|
||||
|
||||
/**
|
||||
The builder create method, for User Defined Functions.
|
||||
@ -136,7 +136,7 @@ public:
|
||||
@param item_list The list of arguments to the function, can be NULL
|
||||
@return An item representing the parsed function call
|
||||
*/
|
||||
Item* create(THD *thd, udf_func *fct, List<Item> *item_list);
|
||||
Item *create(THD *thd, udf_func *fct, List<Item> *item_list);
|
||||
|
||||
/** Singleton. */
|
||||
static Create_udf_func s_singleton;
|
||||
|
@ -624,7 +624,7 @@ void Item_exists_subselect::print(String *str)
|
||||
}
|
||||
|
||||
|
||||
bool Item_in_subselect::test_limit(SELECT_LEX_UNIT *unit_arg)
|
||||
bool Item_in_subselect::test_limit(st_select_lex_unit *unit_arg)
|
||||
{
|
||||
if (unit_arg->fake_select_lex &&
|
||||
unit_arg->fake_select_lex->test_limit())
|
||||
|
23
sql/lock.cc
23
sql/lock.cc
@ -74,6 +74,11 @@ TODO:
|
||||
#include <hash.h>
|
||||
#include <assert.h>
|
||||
|
||||
/**
|
||||
@defgroup Locking Locking
|
||||
@{
|
||||
*/
|
||||
|
||||
extern HASH open_cache;
|
||||
|
||||
/* flags for get_lock_data */
|
||||
@ -472,6 +477,9 @@ void mysql_unlock_read_tables(THD *thd, MYSQL_LOCK *sql_lock)
|
||||
unlock_external() we call handler::external_lock(F_UNLCK) only
|
||||
if table->current_lock is not F_UNLCK.
|
||||
|
||||
@param thd thread context
|
||||
@param locked list of locked tables
|
||||
@param table the table to unlock
|
||||
@param always_unlock specify explicitly if the legacy side
|
||||
effect is desired.
|
||||
*/
|
||||
@ -849,6 +857,7 @@ static MYSQL_LOCK *get_lock_data(THD *thd, TABLE **table_ptr, uint count,
|
||||
if ((table=table_ptr[i])->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE)
|
||||
continue;
|
||||
lock_type= table->reginfo.lock_type;
|
||||
DBUG_ASSERT (lock_type != TL_WRITE_DEFAULT);
|
||||
if (lock_type >= TL_WRITE_ALLOW_WRITE)
|
||||
{
|
||||
*write_lock_used=table;
|
||||
@ -1174,8 +1183,9 @@ bool lock_table_names_exclusively(THD *thd, TABLE_LIST *table_list)
|
||||
/**
|
||||
@brief Test is 'table' is protected by an exclusive name lock.
|
||||
|
||||
@param[in] thd The current thread handler
|
||||
@param[in] table Table container containing the single table to be tested
|
||||
@param[in] thd The current thread handler
|
||||
@param[in] table_list Table container containing the single table to be
|
||||
tested
|
||||
|
||||
@note Needs to be protected by LOCK_open mutex.
|
||||
|
||||
@ -1201,8 +1211,9 @@ is_table_name_exclusively_locked_by_this_thread(THD *thd,
|
||||
/**
|
||||
@brief Test is 'table key' is protected by an exclusive name lock.
|
||||
|
||||
@param[in] thd The current thread handler.
|
||||
@param[in] table Table container containing the single table to be tested.
|
||||
@param[in] thd The current thread handler.
|
||||
@param[in] key
|
||||
@param[in] key_length
|
||||
|
||||
@note Needs to be protected by LOCK_open mutex
|
||||
|
||||
@ -1585,4 +1596,6 @@ void broadcast_refresh(void)
|
||||
VOID(pthread_cond_broadcast(&COND_global_read_lock));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@} (end of group Locking)
|
||||
*/
|
||||
|
@ -13,6 +13,15 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
@addtogroup Replication
|
||||
@{
|
||||
|
||||
@file
|
||||
|
||||
Binary log event definitions.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _log_event_h
|
||||
#define _log_event_h
|
||||
@ -2546,7 +2555,7 @@ protected:
|
||||
<caption>Incident event format</caption>
|
||||
<tr>
|
||||
<th>Symbol</th>
|
||||
<th>Size<br/>(bytes)</th>
|
||||
<th>Size<br>(bytes)</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -2631,4 +2640,8 @@ static inline bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache,
|
||||
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
@} (end of group Replication)
|
||||
*/
|
||||
|
||||
#endif /* _log_event_h */
|
||||
|
@ -177,6 +177,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols,
|
||||
record on the master side
|
||||
@param rw_set Pointer to bitmap that holds either the read_set or the
|
||||
write_set of the table
|
||||
@param event_type
|
||||
|
||||
|
||||
@retval 0 No error
|
||||
|
12
sql/slave.h
12
sql/slave.h
@ -16,6 +16,12 @@
|
||||
#ifndef SLAVE_H
|
||||
#define SLAVE_H
|
||||
|
||||
/**
|
||||
@defgroup Replication Replication
|
||||
@{
|
||||
|
||||
@file
|
||||
*/
|
||||
#ifdef HAVE_REPLICATION
|
||||
|
||||
#include "log.h"
|
||||
@ -213,6 +219,8 @@ extern I_List<THD> threads;
|
||||
#define SLAVE_IO 1
|
||||
#define SLAVE_SQL 2
|
||||
|
||||
/**
|
||||
@} (end of group Replication)
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -84,7 +84,7 @@ class Stored_routine_creation_ctx : public Stored_program_creation_ctx,
|
||||
{
|
||||
public:
|
||||
static Stored_routine_creation_ctx *
|
||||
load_from_db(THD *thd, const class sp_name *name, TABLE *proc_tbl);
|
||||
load_from_db(THD *thd, const sp_name *name, TABLE *proc_tbl);
|
||||
|
||||
public:
|
||||
virtual Stored_program_creation_ctx *clone(MEM_ROOT *mem_root)
|
||||
|
@ -23,6 +23,11 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
@defgroup Stored_Routines Stored Routines
|
||||
@ingroup Runtime_Environment
|
||||
@{
|
||||
*/
|
||||
// Values for the type enum. This reflects the order of the enum declaration
|
||||
// in the CREATE TABLE command.
|
||||
#define TYPE_ENUM_FUNCTION 1
|
||||
@ -186,7 +191,7 @@ public:
|
||||
LEX_STRING m_qname; // db.name
|
||||
/**
|
||||
Key representing routine in the set of stored routines used by statement.
|
||||
[routine_type]db.name\0
|
||||
[routine_type]db.name
|
||||
@sa sp_name::m_sroutines_key
|
||||
*/
|
||||
LEX_STRING m_sroutines_key;
|
||||
@ -1322,4 +1327,8 @@ sp_prepare_func_item(THD* thd, Item **it_addr);
|
||||
bool
|
||||
sp_eval_expr(THD *thd, Field *result_field, Item **expr_item_ptr);
|
||||
|
||||
/**
|
||||
@} (end of group Stored_Routines)
|
||||
*/
|
||||
|
||||
#endif /* _SP_HEAD_H_ */
|
||||
|
@ -668,7 +668,7 @@ void field_ulonglong::add()
|
||||
} // field_ulonglong::add
|
||||
|
||||
|
||||
int analyse::send_row(List<Item> &field_list __attribute__((unused)))
|
||||
int analyse::send_row(List<Item> & /* field_list */)
|
||||
{
|
||||
field_info **f = f_info;
|
||||
|
||||
|
@ -348,7 +348,7 @@ public:
|
||||
}
|
||||
virtual void add() {}
|
||||
virtual bool change_columns(List<Item> &fields);
|
||||
virtual int send_row(List<Item> &fields);
|
||||
virtual int send_row(List<Item> &field_list);
|
||||
virtual void end_group(void) {}
|
||||
virtual bool end_of_records(void);
|
||||
friend Procedure *proc_analyse_init(THD *thd, ORDER *param,
|
||||
|
@ -82,6 +82,10 @@ bool Prelock_error_handler::safely_trapped_errors()
|
||||
return ((m_handled_errors > 0) && (m_unhandled_errors == 0));
|
||||
}
|
||||
|
||||
/**
|
||||
@defgroup Data_Dictionary Data Dictionary
|
||||
@{
|
||||
*/
|
||||
|
||||
TABLE *unused_tables; /* Used by mysql_test */
|
||||
HASH open_cache; /* Used by mysql_test */
|
||||
@ -2141,9 +2145,9 @@ bool lock_table_name_if_not_cached(THD *thd, const char *db,
|
||||
@brief Check that table exists in table definition cache, on disk
|
||||
or in some storage engine.
|
||||
|
||||
@param thd Thread context
|
||||
@param table Table list element
|
||||
@param exists[out] Out parameter which is set to TRUE if table
|
||||
@param thd Thread context
|
||||
@param table Table list element
|
||||
@param[out] exists Out parameter which is set to TRUE if table
|
||||
exists and to FALSE otherwise.
|
||||
|
||||
@note This function assumes that caller owns LOCK_open mutex.
|
||||
@ -2244,7 +2248,6 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
HASH_SEARCH_STATE state;
|
||||
DBUG_ENTER("open_table");
|
||||
|
||||
DBUG_ASSERT (table_list->lock_type != TL_WRITE_DEFAULT);
|
||||
/* find a unused table in the open table cache */
|
||||
if (refresh)
|
||||
*refresh=0;
|
||||
@ -3548,11 +3551,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
{
|
||||
safe_to_ignore_table= FALSE;
|
||||
|
||||
if (tables->lock_type == TL_WRITE_DEFAULT)
|
||||
{
|
||||
tables->lock_type= thd->update_lock_default;
|
||||
DBUG_ASSERT (tables->lock_type >= TL_WRITE_ALLOW_WRITE);
|
||||
}
|
||||
/*
|
||||
Ignore placeholders for derived tables. After derived tables
|
||||
processing, link to created temporary table will be put here.
|
||||
@ -3697,7 +3695,8 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
|
||||
}
|
||||
|
||||
if (tables->lock_type != TL_UNLOCK && ! thd->locked_tables)
|
||||
tables->table->reginfo.lock_type=tables->lock_type;
|
||||
tables->table->reginfo.lock_type= tables->lock_type == TL_WRITE_DEFAULT ?
|
||||
thd->update_lock_default : tables->lock_type;
|
||||
tables->table->grant= tables->grant;
|
||||
|
||||
process_view_routines:
|
||||
@ -7795,3 +7794,6 @@ void close_performance_schema_table(THD *thd, Open_tables_state *backup)
|
||||
thd->restore_backup_open_tables_state(backup);
|
||||
}
|
||||
|
||||
/**
|
||||
@} (end of group Data_Dictionary)
|
||||
*/
|
||||
|
@ -3222,14 +3222,31 @@ void Query_cache::double_linked_list_join(Query_cache_block *head_tail,
|
||||
>0 number of tables
|
||||
*/
|
||||
|
||||
static TABLE_COUNTER_TYPE process_and_count_tables(TABLE_LIST *tables_used,
|
||||
uint8 *tables_type)
|
||||
TABLE_COUNTER_TYPE
|
||||
Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
|
||||
uint8 *tables_type)
|
||||
{
|
||||
DBUG_ENTER("process_and_count_tables");
|
||||
TABLE_COUNTER_TYPE table_count = 0;
|
||||
for (; tables_used; tables_used= tables_used->next_global)
|
||||
{
|
||||
table_count++;
|
||||
#ifdef HAVE_QUERY_CACHE
|
||||
/*
|
||||
Disable any attempt to store this statement if there are
|
||||
column level grants on any referenced tables.
|
||||
The grant.want_privileges flag was set to 1 in the
|
||||
check_grant() function earlier if the TABLE_LIST object
|
||||
had any associated column privileges.
|
||||
*/
|
||||
if (tables_used->grant.want_privilege)
|
||||
{
|
||||
DBUG_PRINT("qcache", ("Don't cache statement as it refers to "
|
||||
"tables with column privileges."));
|
||||
thd->lex->safe_to_cache_query= 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
#endif
|
||||
if (tables_used->view)
|
||||
{
|
||||
DBUG_PRINT("qcache", ("view: %s db: %s",
|
||||
@ -3307,7 +3324,8 @@ Query_cache::is_cacheable(THD *thd, uint32 query_len, char *query, LEX *lex,
|
||||
(long) lex->select_lex.options,
|
||||
(int) thd->variables.query_cache_type));
|
||||
|
||||
if (!(table_count= process_and_count_tables(tables_used, tables_type)))
|
||||
if (!(table_count= process_and_count_tables(thd, tables_used,
|
||||
tables_type)))
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if ((thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
|
||||
|
@ -409,10 +409,12 @@ protected:
|
||||
If query is cacheable return number tables in query
|
||||
(query without tables not cached)
|
||||
*/
|
||||
static
|
||||
TABLE_COUNTER_TYPE is_cacheable(THD *thd, uint32 query_len, char *query,
|
||||
LEX *lex, TABLE_LIST *tables_used,
|
||||
uint8 *tables_type);
|
||||
LEX *lex, TABLE_LIST *tables_used,
|
||||
uint8 *tables_type);
|
||||
TABLE_COUNTER_TYPE process_and_count_tables(THD *thd,
|
||||
TABLE_LIST *tables_used,
|
||||
uint8 *tables_type);
|
||||
|
||||
static my_bool ask_handler_allowance(THD *thd, TABLE_LIST *tables_used);
|
||||
public:
|
||||
|
@ -2423,6 +2423,10 @@ bool Security_context::set_user(char *user_arg)
|
||||
Initialize this security context from the passed in credentials
|
||||
and activate it in the current thread.
|
||||
|
||||
@param thd
|
||||
@param definer_user
|
||||
@param definer_host
|
||||
@param db
|
||||
@param[out] backup Save a pointer to the current security context
|
||||
in the thread. In case of success it points to the
|
||||
saved old context, otherwise it points to NULL.
|
||||
|
@ -1350,7 +1350,7 @@ static void mysql_change_db_impl(THD *thd,
|
||||
@brief Change the current database.
|
||||
|
||||
@param thd thread handle
|
||||
@param name database name
|
||||
@param new_db_name database name
|
||||
@param force_switch if this flag is set (TRUE), mysql_change_db() will
|
||||
switch to NULL db if the specified database is not
|
||||
available anymore. Corresponding warning will be
|
||||
|
@ -119,6 +119,44 @@ static void mysql_ha_hash_free(TABLE_LIST *tables)
|
||||
my_free((char*) tables, MYF(0));
|
||||
}
|
||||
|
||||
/**
|
||||
Close a HANDLER table.
|
||||
|
||||
@param thd Thread identifier.
|
||||
@param tables A list of tables with the first entry to close.
|
||||
|
||||
@note Though this function takes a list of tables, only the first list entry
|
||||
will be closed.
|
||||
@note Broadcasts refresh if it closed the table.
|
||||
*/
|
||||
|
||||
static void mysql_ha_close_table(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
TABLE **table_ptr;
|
||||
|
||||
/*
|
||||
Though we could take the table pointer from hash_tables->table,
|
||||
we must follow the thd->handler_tables chain anyway, as we need the
|
||||
address of the 'next' pointer referencing this table
|
||||
for close_thread_table().
|
||||
*/
|
||||
for (table_ptr= &(thd->handler_tables);
|
||||
*table_ptr && (*table_ptr != tables->table);
|
||||
table_ptr= &(*table_ptr)->next)
|
||||
;
|
||||
|
||||
if (*table_ptr)
|
||||
{
|
||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (close_thread_table(thd, table_ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
broadcast_refresh();
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Open a HANDLER table.
|
||||
@ -145,7 +183,7 @@ static void mysql_ha_hash_free(TABLE_LIST *tables)
|
||||
|
||||
bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE_LIST *hash_tables = NULL;
|
||||
char *db, *name, *alias;
|
||||
uint dblen, namelen, aliaslen, counter;
|
||||
int error;
|
||||
@ -197,7 +235,6 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
{
|
||||
if (! reopen)
|
||||
my_error(ER_ILLEGAL_HA, MYF(0), tables->alias);
|
||||
mysql_ha_close(thd, tables);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@ -225,11 +262,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
|
||||
/* add to hash */
|
||||
if (my_hash_insert(&thd->handler_tables_hash, (uchar*) hash_tables))
|
||||
{
|
||||
my_free((char*) hash_tables, MYF(0));
|
||||
mysql_ha_close(thd, tables);
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (! reopen)
|
||||
@ -238,13 +271,17 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
err:
|
||||
if (hash_tables)
|
||||
my_free((char*) hash_tables, MYF(0));
|
||||
if (tables->table)
|
||||
mysql_ha_close_table(thd, tables);
|
||||
DBUG_PRINT("exit",("ERROR"));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Close a HANDLER table.
|
||||
Close a HANDLER table by alias or table name
|
||||
|
||||
SYNOPSIS
|
||||
mysql_ha_close()
|
||||
@ -252,9 +289,8 @@ err:
|
||||
tables A list of tables with the first entry to close.
|
||||
|
||||
DESCRIPTION
|
||||
Though this function takes a list of tables, only the first list entry
|
||||
will be closed.
|
||||
Broadcasts refresh if it closed the table.
|
||||
Closes the table that is associated (on the handler tables hash) with the
|
||||
name (table->alias) of the specified table.
|
||||
|
||||
RETURN
|
||||
FALSE ok
|
||||
@ -264,7 +300,6 @@ err:
|
||||
bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
TABLE_LIST *hash_tables;
|
||||
TABLE **table_ptr;
|
||||
DBUG_ENTER("mysql_ha_close");
|
||||
DBUG_PRINT("enter",("'%s'.'%s' as '%s'",
|
||||
tables->db, tables->table_name, tables->alias));
|
||||
@ -273,28 +308,7 @@ bool mysql_ha_close(THD *thd, TABLE_LIST *tables)
|
||||
(uchar*) tables->alias,
|
||||
strlen(tables->alias) + 1)))
|
||||
{
|
||||
/*
|
||||
Though we could take the table pointer from hash_tables->table,
|
||||
we must follow the thd->handler_tables chain anyway, as we need the
|
||||
address of the 'next' pointer referencing this table
|
||||
for close_thread_table().
|
||||
*/
|
||||
for (table_ptr= &(thd->handler_tables);
|
||||
*table_ptr && (*table_ptr != hash_tables->table);
|
||||
table_ptr= &(*table_ptr)->next)
|
||||
;
|
||||
|
||||
if (*table_ptr)
|
||||
{
|
||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (close_thread_table(thd, table_ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
broadcast_refresh();
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
}
|
||||
mysql_ha_close_table(thd, hash_tables);
|
||||
hash_delete(&thd->handler_tables_hash, (uchar*) hash_tables);
|
||||
}
|
||||
else
|
||||
|
@ -173,7 +173,7 @@ void Lex_input_stream::body_utf8_start(THD *thd, const char *begin_ptr)
|
||||
}
|
||||
|
||||
/**
|
||||
The operation appends unprocessed part of pre-processed buffer till
|
||||
@brief The operation appends unprocessed part of pre-processed buffer till
|
||||
the given pointer (ptr) and sets m_cpp_utf8_processed_ptr to end_ptr.
|
||||
|
||||
The idea is that some tokens in the pre-processed buffer (like character
|
||||
@ -1400,6 +1400,19 @@ int MYSQLlex(void *arg, void *yythd)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Construct a copy of this object to be used for mysql_alter_table
|
||||
and mysql_create_table.
|
||||
|
||||
Historically, these two functions modify their Alter_info
|
||||
arguments. This behaviour breaks re-execution of prepared
|
||||
statements and stored procedures and is compensated by always
|
||||
supplying a copy of Alter_info to these functions.
|
||||
|
||||
@return You need to use check the error in THD for out
|
||||
of memory condition after calling this function.
|
||||
*/
|
||||
|
||||
Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
|
||||
:drop_list(rhs.drop_list, mem_root),
|
||||
alter_list(rhs.alter_list, mem_root),
|
||||
@ -1737,7 +1750,7 @@ void st_select_lex_unit::exclude_tree()
|
||||
'last' should be reachable from this st_select_lex_node
|
||||
*/
|
||||
|
||||
void st_select_lex::mark_as_dependent(SELECT_LEX *last)
|
||||
void st_select_lex::mark_as_dependent(st_select_lex *last)
|
||||
{
|
||||
/*
|
||||
Mark all selects from resolved to 1 before select where was
|
||||
@ -2355,7 +2368,7 @@ st_lex::copy_db_to(char **p_db, size_t *p_db_length) const
|
||||
values - SELECT_LEX with initial values for counters
|
||||
*/
|
||||
|
||||
void st_select_lex_unit::set_limit(SELECT_LEX *sl)
|
||||
void st_select_lex_unit::set_limit(st_select_lex *sl)
|
||||
{
|
||||
ha_rows select_limit_val;
|
||||
|
||||
@ -2885,7 +2898,7 @@ bool st_select_lex::add_index_hint (THD *thd, char *str, uint length)
|
||||
partitioning or if only partitions to add or to split.
|
||||
|
||||
@note This needs to be outside of WITH_PARTITION_STORAGE_ENGINE since it
|
||||
is used from the sql parser that doesn't have any #ifdef's
|
||||
is used from the sql parser that doesn't have any ifdef's
|
||||
|
||||
@retval TRUE Yes, it is part of a management partition command
|
||||
@retval FALSE No, not a management partition command
|
||||
|
@ -13,6 +13,9 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
@defgroup Semantic_Analysis Semantic Analysis
|
||||
*/
|
||||
|
||||
/* YACC and LEX Definitions */
|
||||
|
||||
@ -859,8 +862,8 @@ public:
|
||||
uint no_parts;
|
||||
enum_alter_table_change_level change_level;
|
||||
Create_field *datetime_field;
|
||||
bool error_if_not_empty;
|
||||
|
||||
bool error_if_not_empty;
|
||||
|
||||
|
||||
Alter_info() :
|
||||
flags(0),
|
||||
@ -887,16 +890,6 @@ public:
|
||||
datetime_field= 0;
|
||||
error_if_not_empty= FALSE;
|
||||
}
|
||||
/**
|
||||
Construct a copy of this object to be used for mysql_alter_table
|
||||
and mysql_create_table. Historically, these two functions modify
|
||||
their Alter_info arguments. This behaviour breaks re-execution of
|
||||
prepared statements and stored procedures and is compensated by
|
||||
always supplying a copy of Alter_info to these functions.
|
||||
|
||||
@return You need to use check the error in THD for out
|
||||
of memory condition after calling this function.
|
||||
*/
|
||||
Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root);
|
||||
private:
|
||||
Alter_info &operator=(const Alter_info &rhs); // not implemented
|
||||
@ -1102,8 +1095,9 @@ enum enum_comment_state
|
||||
|
||||
|
||||
/**
|
||||
This class represents the character input stream consumed during
|
||||
@brief This class represents the character input stream consumed during
|
||||
lexical analysis.
|
||||
|
||||
In addition to consuming the input stream, this class performs some
|
||||
comment pre processing, by filtering out out of bound special text
|
||||
from the query input stream.
|
||||
@ -1113,6 +1107,7 @@ enum enum_comment_state
|
||||
is the pre-processed buffer that contains only the query text that
|
||||
should be seen once out-of-bound data is removed.
|
||||
*/
|
||||
|
||||
class Lex_input_stream
|
||||
{
|
||||
public:
|
||||
@ -1121,6 +1116,7 @@ public:
|
||||
|
||||
/**
|
||||
Set the echo mode.
|
||||
|
||||
When echo is true, characters parsed from the raw input stream are
|
||||
preserved. When false, characters parsed are silently ignored.
|
||||
@param echo the echo mode.
|
||||
@ -1516,9 +1512,9 @@ typedef struct st_lex : public Query_tables_list
|
||||
/** End of SELECT of CREATE VIEW statement */
|
||||
const char* create_view_select_end;
|
||||
|
||||
/** Start of 'ON <table>', in trigger statements. */
|
||||
/** Start of 'ON table', in trigger statements. */
|
||||
const char* raw_trg_on_table_name_begin;
|
||||
/** End of 'ON <table>', in trigger statements. */
|
||||
/** End of 'ON table', in trigger statements. */
|
||||
const char* raw_trg_on_table_name_end;
|
||||
|
||||
/* Partition info structure filled in by PARTITION BY parse part */
|
||||
@ -1830,4 +1826,8 @@ extern void trim_whitespace(CHARSET_INFO *cs, LEX_STRING *str);
|
||||
|
||||
extern bool is_lex_native_function(const LEX_STRING *name);
|
||||
|
||||
/**
|
||||
@} (End of group Semantic_Analysis)
|
||||
*/
|
||||
|
||||
#endif /* MYSQL_SERVER */
|
||||
|
@ -28,6 +28,11 @@
|
||||
#include "events.h"
|
||||
#include "sql_trigger.h"
|
||||
|
||||
/**
|
||||
@defgroup Runtime_Environment Runtime Environment
|
||||
@{
|
||||
*/
|
||||
|
||||
/* Used in error handling only */
|
||||
#define SP_TYPE_STRING(LP) \
|
||||
((LP)->sphead->m_type == TYPE_ENUM_FUNCTION ? "FUNCTION" : "PROCEDURE")
|
||||
@ -5375,11 +5380,12 @@ void mysql_init_multi_delete(LEX *lex)
|
||||
|
||||
/**
|
||||
Parse a query.
|
||||
@param thd Current thread
|
||||
@param inBuf Begining of the query text
|
||||
@param length Length of the query text
|
||||
@param [out] semicolon For multi queries, position of the character of
|
||||
the next query in the query text.
|
||||
|
||||
@param thd Current thread
|
||||
@param inBuf Begining of the query text
|
||||
@param length Length of the query text
|
||||
@param[out] found_semicolon For multi queries, position of the character of
|
||||
the next query in the query text.
|
||||
*/
|
||||
|
||||
void mysql_parse(THD *thd, const char *inBuf, uint length,
|
||||
@ -7246,3 +7252,7 @@ bool parse_sql(THD *thd,
|
||||
|
||||
return err_status;
|
||||
}
|
||||
|
||||
/**
|
||||
@} (end of group Runtime_Environment)
|
||||
*/
|
||||
|
@ -2444,7 +2444,7 @@ void plugin_thdvar_cleanup(THD *thd)
|
||||
/**
|
||||
@brief Free values of thread variables of a plugin.
|
||||
|
||||
@detail This must be called before a plugin is deleted. Otherwise its
|
||||
This must be called before a plugin is deleted. Otherwise its
|
||||
variables are no longer accessible and the value space is lost. Note
|
||||
that only string values with PLUGIN_VAR_MEMALLOC are allocated and
|
||||
must be freed.
|
||||
|
@ -112,7 +112,6 @@ public:
|
||||
/****************************************************************************/
|
||||
|
||||
/**
|
||||
@class Prepared_statement
|
||||
@brief Prepared_statement: a statement that can contain placeholders
|
||||
*/
|
||||
|
||||
|
@ -13,6 +13,10 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||
|
||||
/**
|
||||
@defgroup Query_Optimizer Query Optimizer
|
||||
@{
|
||||
*/
|
||||
|
||||
/* mysql_select and join optimization */
|
||||
|
||||
@ -16199,3 +16203,7 @@ bool JOIN::change_result(select_result *res)
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
@} (end of group Query_Optimizer)
|
||||
*/
|
||||
|
@ -2459,8 +2459,8 @@ static COND * make_cond_for_info_schema(COND *cond, TABLE_LIST *table)
|
||||
|
||||
@param[in] thd thread handler
|
||||
@param[in] cond WHERE condition
|
||||
@param[in] table I_S table
|
||||
@param[in, out] lookup_field_vals Struct which holds lookup values
|
||||
@param[in] tables I_S table
|
||||
@param[in, out] lookup_field_values Struct which holds lookup values
|
||||
|
||||
@return void
|
||||
*/
|
||||
|
@ -1882,7 +1882,7 @@ end:
|
||||
|
||||
@param thd
|
||||
@param event
|
||||
@param time_type,
|
||||
@param time_type
|
||||
@param old_row_is_record1
|
||||
|
||||
@return Error status.
|
||||
@ -2074,9 +2074,9 @@ process_unknown_string(char *&unknown_key, uchar* base, MEM_ROOT *mem_root,
|
||||
/**
|
||||
Contruct path to TRN-file.
|
||||
|
||||
@param thd[in] Thread context.
|
||||
@param trg_name[in] Trigger name.
|
||||
@param trn_path[out] Variable to store constructed path
|
||||
@param[in] thd Thread context.
|
||||
@param[in] trg_name Trigger name.
|
||||
@param[out] trn_path Variable to store constructed path
|
||||
*/
|
||||
|
||||
void build_trn_path(THD *thd, const sp_name *trg_name, LEX_STRING *trn_path)
|
||||
@ -2109,10 +2109,10 @@ bool check_trn_exists(const LEX_STRING *trn_path)
|
||||
/**
|
||||
Retrieve table name for given trigger.
|
||||
|
||||
@param thd[in] Thread context.
|
||||
@param trg_name[in] Trigger name.
|
||||
@param trn_path[in] Path to the corresponding TRN-file.
|
||||
@param tbl_name[out] Variable to store retrieved table name.
|
||||
@param[in] thd Thread context.
|
||||
@param[in] trg_name Trigger name.
|
||||
@param[in] trn_path Path to the corresponding TRN-file.
|
||||
@param[out] tbl_name Variable to store retrieved table name.
|
||||
|
||||
@return Error status.
|
||||
@retval FALSE on success.
|
||||
|
@ -86,10 +86,10 @@ static bool check_fields(THD *thd, List<Item> &items)
|
||||
/**
|
||||
@brief Re-read record if more columns are needed for error message.
|
||||
|
||||
@detail If we got a duplicate key error, we want to write an error
|
||||
message containing the value of the duplicate key. If we do not have
|
||||
all fields of the key value in record[0], we need to re-read the
|
||||
record with a proper read_set.
|
||||
If we got a duplicate key error, we want to write an error
|
||||
message containing the value of the duplicate key. If we do not have
|
||||
all fields of the key value in record[0], we need to re-read the
|
||||
record with a proper read_set.
|
||||
|
||||
@param[in] error error number
|
||||
@param[in] table table
|
||||
|
13557
sql/sql_yacc.yy
13557
sql/sql_yacc.yy
File diff suppressed because it is too large
Load Diff
10
sql/table.h
10
sql/table.h
@ -157,7 +157,7 @@ enum enum_table_category
|
||||
- FLUSH TABLES WITH READ LOCK
|
||||
- SET GLOBAL READ_ONLY = ON
|
||||
do not apply to this table.
|
||||
Note that LOCK TABLE <t> FOR READ/WRITE
|
||||
Note that LOCK TABLE t FOR READ/WRITE
|
||||
can be used on temporary tables.
|
||||
Temporary tables are not part of the table cache.
|
||||
*/
|
||||
@ -166,7 +166,7 @@ enum enum_table_category
|
||||
/**
|
||||
User table.
|
||||
These tables do honor:
|
||||
- LOCK TABLE <t> FOR READ/WRITE
|
||||
- LOCK TABLE t FOR READ/WRITE
|
||||
- FLUSH TABLES WITH READ LOCK
|
||||
- SET GLOBAL READ_ONLY = ON
|
||||
User tables are cached in the table cache.
|
||||
@ -176,7 +176,7 @@ enum enum_table_category
|
||||
/**
|
||||
System table, maintained by the server.
|
||||
These tables do honor:
|
||||
- LOCK TABLE <t> FOR READ/WRITE
|
||||
- LOCK TABLE t FOR READ/WRITE
|
||||
- FLUSH TABLES WITH READ LOCK
|
||||
- SET GLOBAL READ_ONLY = ON
|
||||
Typically, writes to system tables are performed by
|
||||
@ -190,7 +190,7 @@ enum enum_table_category
|
||||
These tables are an interface provided by the system
|
||||
to inspect the system metadata.
|
||||
These tables do *not* honor:
|
||||
- LOCK TABLE <t> FOR READ/WRITE
|
||||
- LOCK TABLE t FOR READ/WRITE
|
||||
- FLUSH TABLES WITH READ LOCK
|
||||
- SET GLOBAL READ_ONLY = ON
|
||||
as there is no point in locking explicitely
|
||||
@ -212,7 +212,7 @@ enum enum_table_category
|
||||
These tables are an interface provided by the system
|
||||
to inspect the system performance data.
|
||||
These tables do *not* honor:
|
||||
- LOCK TABLE <t> FOR READ/WRITE
|
||||
- LOCK TABLE t FOR READ/WRITE
|
||||
- FLUSH TABLES WITH READ LOCK
|
||||
- SET GLOBAL READ_ONLY = ON
|
||||
as there is no point in locking explicitely
|
||||
|
Loading…
x
Reference in New Issue
Block a user