1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00
This commit is contained in:
Patrick Crews
2008-11-26 16:52:53 -05:00
14 changed files with 291 additions and 190 deletions

View File

@ -1,7 +1,8 @@
CREATE DATABASE IF NOT EXISTS events_test;
USE events_test;
SET @event_scheduler=@@global.event_scheduler;
SET GLOBAL event_scheduler=OFF;
Try agian to make sure it's allowed
Try again to make sure it's allowed
SET GLOBAL event_scheduler=OFF;
SHOW VARIABLES LIKE 'event_scheduler';
Variable_name Value
@ -64,8 +65,8 @@ INSERT INTO table_4 VALUES (1);
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_1;
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
SELECT IF(SUM(a) >= 5, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >= 5, 'OK', 'ERROR')
SELECT IF(SUM(a) >= 4, 'OK', 'ERROR') FROM table_2;
IF(SUM(a) >= 4, 'OK', 'ERROR')
OK
SELECT IF(SUM(a) >= 1, 'OK', 'ERROR') FROM table_3;
IF(SUM(a) >= 1, 'OK', 'ERROR')
@ -94,4 +95,4 @@ DROP TABLE table_2;
DROP TABLE table_3;
DROP TABLE table_4;
DROP DATABASE events_test;
SET GLOBAL event_scheduler=OFF;
SET GLOBAL event_scheduler=@event_scheduler;

View File

@ -14,6 +14,7 @@ RETURN FLOOR((i % (step * n) + 0.1) / step);
END//
SET @step3= @step * 3;
SET @step6= @step * 6;
SET @unix_time= UNIX_TIMESTAMP() - 1;
SET @unix_time= @unix_time - @unix_time % @step6;
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
SET @tzid= LAST_INSERT_ID();
@ -21,7 +22,7 @@ INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 0, 0, 0, 'b16420_0');
INSERT INTO mysql.time_zone_transition_type
VALUES (@tzid, 1, @step3 - @step, 1, 'b16420_1');
INSERT INTO mysql.time_zone_name VALUES ('bug16420', @tzid);
INSERT INTO mysql.time_zone_name VALUES ('<TZ_NAME_1>', @tzid);
CREATE TABLE t1 (count INT, unix_time INT, local_time INT, comment CHAR(80));
CREATE TABLE t2 (count INT);
INSERT INTO t2 VALUES (1);
@ -48,7 +49,7 @@ END//
SET TIME_ZONE= '+00:00';
CREATE EVENT e1 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e1>");
SET TIME_ZONE= 'bug16420';
SET TIME_ZONE= '<TZ_NAME_1>';
CREATE EVENT e2 ON SCHEDULE EVERY @step SECOND
STARTS FROM_UNIXTIME(@unix_time) DO SELECT f1("<e2>");
SET GLOBAL EVENT_SCHEDULER= ON;
@ -86,6 +87,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
SET TIME_ZONE= '+00:00';
CREATE TABLE t1 (event CHAR(2), dt DATE, offset INT);
INSERT INTO mysql.time_zone VALUES (NULL, 'N');
@ -111,8 +113,8 @@ INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 7 * @step, 2);
INSERT INTO mysql.time_zone_transition
VALUES (@tzid, @now + 12 * @step, 3);
INSERT INTO mysql.time_zone_name VALUES ('bug16420_2', @tzid);
SET TIME_ZONE= 'bug16420_2';
INSERT INTO mysql.time_zone_name VALUES ('<TZ_NAME_2>', @tzid);
SET TIME_ZONE= '<TZ_NAME_2>';
SET GLOBAL EVENT_SCHEDULER= ON;
SET GLOBAL EVENT_SCHEDULER= OFF;
Below we should see the following:
@ -143,6 +145,7 @@ DELETE FROM mysql.time_zone_name WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition_type WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone_transition WHERE time_zone_id = @tzid;
DELETE FROM mysql.time_zone WHERE time_zone_id = @tzid;
ALTER TABLE mysql.time_zone AUTO_INCREMENT = 6;
DROP FUNCTION round_to_step;
DROP TABLE t_step;
DROP DATABASE mysqltest_db1;

View File

@ -1,31 +1,41 @@
SET @save = @@global.group_concat_max_len;
drop table if exists t1;
DROP TABLE IF EXISTS t1;
## Creating new table t1 ##
CREATE TABLE t1
(
id INT NOT NULL auto_increment,
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY (id),
rollno int NOT NULL,
rollno INT NOT NULL,
name VARCHAR(30)
);
'#--------------------FN_DYNVARS_034_01-------------------------#'
## Setting initial value of variable to 4 ##
## Setting initial value of variable to 4 ##
SET @@global.group_concat_max_len = 4;
## Inserting some rows in table ##
INSERT into t1(rollno, name) values(1, 'Record_1');
INSERT into t1(rollno, name) values(2, 'Record_2');
INSERT into t1(rollno, name) values(1, 'Record_3');
INSERT into t1(rollno, name) values(3, 'Record_4');
INSERT into t1(rollno, name) values(1, 'Record_5');
INSERT into t1(rollno, name) values(3, 'Record_6');
INSERT into t1(rollno, name) values(4, 'Record_7');
INSERT into t1(rollno, name) values(4, 'Record_8');
## Creating two new connections ##
## Inserting some rows in table ##
INSERT INTO t1(rollno, name) VALUES(1, 'Record_1');
INSERT INTO t1(rollno, name) VALUES(2, 'Record_2');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_3');
INSERT INTO t1(rollno, name) VALUES(3, 'Record_4');
INSERT INTO t1(rollno, name) VALUES(1, 'Record_5');
INSERT INTO t1(rollno, name) VALUES(3, 'Record_6');
INSERT INTO t1(rollno, name) VALUES(4, 'Record_7');
INSERT INTO t1(rollno, name) VALUES(4, 'Record_8');
SELECT * FROM t1 ORDER BY id;
id rollno name
1 1 Record_1
2 2 Record_2
3 1 Record_3
4 3 Record_4
5 1 Record_5
6 3 Record_6
7 4 Record_7
8 4 Record_8
## Creating two new connections ##
'#--------------------FN_DYNVARS_034_02-------------------------#'
## Connecting with test_con1 ##
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
id rollno group_concat(name)
## Accessing data and using group_concat on column whose value is greater than 4 ##
SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
id rollno GROUP_CONCAT(name)
1 1 Reco
2 2 Reco
4 3 Reco
@ -33,10 +43,10 @@ id rollno group_concat(name)
Warnings:
Warning 1260 4 line(s) were cut by GROUP_CONCAT()
## Changing session value of variable and verifying its behavior, ##
## warning should come here ##
## warning should come here ##
SET @@session.group_concat_max_len = 10;
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
id rollno group_concat(name)
SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
id rollno GROUP_CONCAT(name)
1 1 Record_1,R
2 2 Record_2
4 3 Record_4,R
@ -44,18 +54,18 @@ id rollno group_concat(name)
Warnings:
Warning 1260 3 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_03-------------------------#'
## Connecting with new connection test_con2 ##
## Verifying initial value of variable. It should be 4 ##
## Connecting with new connection test_con2 ##
## Verifying initial value of variable. It should be 4 ##
SELECT @@session.group_concat_max_len = 4;
@@session.group_concat_max_len = 4
1
## Setting session value of variable to 20 and verifying variable is concating ##
## column's value to 20 or not ##
## Setting session value of variable to 20 and verifying variable is concating ##
## column's value to 20 or not ##
SET @@session.group_concat_max_len = 20;
## Verifying value of name column, it should not me more than 20 characters ##
## Warning should come here ##
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
id rollno group_concat(name)
SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
id rollno GROUP_CONCAT(name)
1 1 Record_1,Record_3,Re
2 2 Record_2
4 3 Record_4,Record_6
@ -63,17 +73,17 @@ id rollno group_concat(name)
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
'#--------------------FN_DYNVARS_034_04-------------------------#'
## Setting session value of variable to 26. No warning should appear here ##
## because the value after concatination is less than 30 ##
## Setting session value of variable to 26. No warning should appear here ##
## because the value after concatination is less than 30 ##
SET @@session.group_concat_max_len = 26;
## Verifying value of name column, it should not give warning now ##
SELECT id, rollno, group_concat(name) FROM t1 GROUP BY rollno;
id rollno group_concat(name)
## Verifying value of name column, it should not give warning now ##
SELECT id, rollno, GROUP_CONCAT(name) FROM t1 GROUP BY rollno;
id rollno GROUP_CONCAT(name)
1 1 Record_1,Record_3,Record_5
2 2 Record_2
4 3 Record_4,Record_6
7 4 Record_7,Record_8
## Dropping table t1 ##
DROP table t1;
DROP TABLE t1;
## Disconnecting both the connection ##
SET @@global.group_concat_max_len = @save;

View File

@ -378,29 +378,6 @@ where 0=1;
delete t1, t2 from t2,t1
where t1.id1=t2.id2 and 0=1;
drop table t1,t2;
create table t1 ( a int not null, b int not null) ;
alter table t1 add index i1(a);
delete from t1 where a > 2000000;
create table t2 like t1;
insert into t2 select * from t1;
select 't2 rows before small delete', count(*) from t1;
t2 rows before small delete count(*)
t2 rows before small delete 2000000
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 2;
select 't2 rows after small delete', count(*) from t2;
t2 rows after small delete count(*)
t2 rows after small delete 1999999
select 't1 rows after small delete', count(*) from t1;
t1 rows after small delete count(*)
t1 rows after small delete 1999999
delete t1,t2 from t1,t2 where t1.b=t2.a and t1.a < 100*1000;
select 't2 rows after big delete', count(*) from t2;
t2 rows after big delete count(*)
t2 rows after big delete 1900001
select 't1 rows after big delete', count(*) from t1;
t1 rows after big delete count(*)
t1 rows after big delete 1900001
drop table t1,t2;
CREATE TABLE t1 ( a int );
CREATE TABLE t2 ( a int );
DELETE t1 FROM t1, t2 AS t3;

View File

@ -0,0 +1,25 @@
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 ( a INT NOT NULL, b INT NOT NULL) ;
# The protocolling of many inserts into t1 is suppressed.
ALTER TABLE t1 ADD INDEX i1(a);
DELETE FROM t1 WHERE a > 2000000;
CREATE TABLE t2 LIKE t1;
INSERT INTO t2 SELECT * FROM t1;
SELECT 't2 rows before small delete', COUNT(*) FROM t1;
t2 rows before small delete COUNT(*)
t2 rows before small delete 2000000
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 2;
SELECT 't2 rows after small delete', COUNT(*) FROM t2;
t2 rows after small delete COUNT(*)
t2 rows after small delete 1999999
SELECT 't1 rows after small delete', COUNT(*) FROM t1;
t1 rows after small delete COUNT(*)
t1 rows after small delete 1999999
DELETE t1,t2 FROM t1,t2 WHERE t1.b=t2.a AND t1.a < 100*1000;
SELECT 't2 rows after big delete', COUNT(*) FROM t2;
t2 rows after big delete COUNT(*)
t2 rows after big delete 1900001
SELECT 't1 rows after big delete', COUNT(*) FROM t1;
t1 rows after big delete COUNT(*)
t1 rows after big delete 1900001
DROP TABLE t1,t2;

View File

@ -148,16 +148,16 @@ DROP TABLE t1;
End of 5.0 tests
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data/mysql';
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/test';
ERROR HY000: Incorrect arguments to DATA DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
DATA DIRECTORY='TEST_DIR/master-data/';
ERROR HY000: Incorrect arguments to DATA DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data';
ERROR HY000: Incorrect arguments to INDEX DIRECTORY
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(a INT)
INDEX DIRECTORY='TEST_DIR/master-data_var';
ERROR HY000: Can't create/write to file 'TEST_DIR/master-data_var/t1.MYI' (Errcode: 2)