mirror of
https://github.com/MariaDB/server.git
synced 2025-11-21 06:21:35 +03:00
WL#4203 Reorganize and fix the data dictionary tests of
testsuite funcs_1
because the goal to fix
Bug#34532 Some funcs_1 tests do not clean up at end of testing
was partially missed.
Some minor additional modifications are for
WL#4304 Cleanup in funcs_1 tests
BitKeeper/deleted/.del-innodb_triggers.result:
Rename: mysql-test/suite/funcs_1/r/innodb_triggers.result -> BitKeeper/deleted/.del-innodb_triggers.result
BitKeeper/deleted/.del-memory_triggers.result:
Rename: mysql-test/suite/funcs_1/r/memory_triggers.result -> BitKeeper/deleted/.del-memory_triggers.result
BitKeeper/deleted/.del-myisam_triggers.result:
Rename: mysql-test/suite/funcs_1/r/myisam_triggers.result -> BitKeeper/deleted/.del-myisam_triggers.result
mysql-test/suite/funcs_1/r/innodb_storedproc_02.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/innodb_storedproc_03.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/innodb_storedproc_07.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/innodb_storedproc_08.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/innodb_storedproc_10.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/memory_storedproc_02.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/memory_storedproc_03.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/memory_storedproc_07.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/memory_storedproc_08.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/memory_storedproc_10.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/myisam_storedproc_02.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/myisam_storedproc_03.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/myisam_storedproc_07.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/myisam_storedproc_08.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/r/myisam_storedproc_10.result:
Change mode to -rw-rw-r--
mysql-test/suite/funcs_1/cursors/cursors_master.test:
Backport of file in 5.1
mysql-test/suite/funcs_1/datadict/datadict_load.inc:
Cleanup
mysql-test/suite/funcs_1/r/innodb_views.result:
Updated results
mysql-test/suite/funcs_1/r/is_columns_innodb.result:
Updated results
mysql-test/suite/funcs_1/r/is_columns_memory.result:
Updated results
mysql-test/suite/funcs_1/r/is_columns_myisam.result:
Updated results
mysql-test/suite/funcs_1/r/is_columns_ndb.result:
Updated results
mysql-test/suite/funcs_1/r/is_tables_innodb.result:
Updated results
mysql-test/suite/funcs_1/r/is_tables_memory.result:
Updated results
mysql-test/suite/funcs_1/r/is_tables_myisam.result:
Updated results
mysql-test/suite/funcs_1/r/is_tables_ndb.result:
Updated results
mysql-test/suite/funcs_1/r/memory_views.result:
Updated results
mysql-test/suite/funcs_1/r/myisam_views.result:
Updated results
mysql-test/suite/funcs_1/t/innodb_storedproc.test:
Backport of file in 5.1
mysql-test/suite/funcs_1/t/memory_storedproc.test:
Backport of file in 5.1
mysql-test/suite/funcs_1/t/myisam_storedproc.test:
Backport of file in 5.1
mysql-test/suite/funcs_1/t/myisam_trig_1011ext.test:
Cleanup
mysql-test/suite/funcs_1/views/views_master.inc:
Backport of file in 5.1 which got many fixes for instabilities
and other improvements
171 lines
7.4 KiB
Plaintext
171 lines
7.4 KiB
Plaintext
|
|
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
|
--------------------------------------------------------------------------------
|
|
|
|
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
|
--------------------------------------------------------------------------------
|
|
DROP DATABASE IF EXISTS db_storedproc;
|
|
DROP DATABASE IF EXISTS db_storedproc_1;
|
|
CREATE DATABASE db_storedproc;
|
|
CREATE DATABASE db_storedproc_1;
|
|
USE db_storedproc;
|
|
create table t1(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t1;
|
|
create table t2(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t2;
|
|
create table t3(f1 char(20),f2 char(20),f3 integer) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t3.txt' into table t3;
|
|
create table t4(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t4;
|
|
USE db_storedproc_1;
|
|
create table t6(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t6;
|
|
USE db_storedproc;
|
|
create table t7 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t7;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'f3' at row 1
|
|
Warning 1265 Data truncated for column 'f3' at row 2
|
|
Warning 1265 Data truncated for column 'f3' at row 3
|
|
Warning 1265 Data truncated for column 'f3' at row 4
|
|
Warning 1265 Data truncated for column 'f3' at row 5
|
|
Warning 1265 Data truncated for column 'f3' at row 6
|
|
Warning 1265 Data truncated for column 'f3' at row 7
|
|
Warning 1265 Data truncated for column 'f3' at row 8
|
|
Warning 1265 Data truncated for column 'f3' at row 9
|
|
Warning 1265 Data truncated for column 'f3' at row 10
|
|
create table t8 (f1 char(20), f2 char(25), f3 date, f4 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t7.txt' into table t8;
|
|
Warnings:
|
|
Warning 1265 Data truncated for column 'f3' at row 1
|
|
Warning 1265 Data truncated for column 'f3' at row 2
|
|
Warning 1265 Data truncated for column 'f3' at row 3
|
|
Warning 1265 Data truncated for column 'f3' at row 4
|
|
Warning 1265 Data truncated for column 'f3' at row 5
|
|
Warning 1265 Data truncated for column 'f3' at row 6
|
|
Warning 1265 Data truncated for column 'f3' at row 7
|
|
Warning 1265 Data truncated for column 'f3' at row 8
|
|
Warning 1265 Data truncated for column 'f3' at row 9
|
|
Warning 1265 Data truncated for column 'f3' at row 10
|
|
create table t9(f1 int, f2 char(25), f3 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t9.txt' into table t9;
|
|
create table t10(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t10;
|
|
create table t11(f1 char(20),f2 char(25),f3 date,f4 int,f5 char(25),f6 int) engine = myisam;
|
|
load data infile 'MYSQL_TEST_DIR/suite/funcs_1/data/t4.txt' into table t11;
|
|
|
|
Section 3.1.7 - SQL mode checks:
|
|
--------------------------------------------------------------------------------
|
|
USE db_storedproc;
|
|
|
|
Testcase 3.1.7.1:
|
|
-----------------
|
|
Ensure that the sql_mode setting in effect at the time a stored procedure is
|
|
created is the same setting under which the stored procedure runs when it is
|
|
called/executed.
|
|
--------------------------------------------------------------------------------
|
|
DROP PROCEDURE IF EXISTS sp1;
|
|
DROP TABLE IF EXISTS temp_tbl;
|
|
DROP TABLE IF EXISTS result;
|
|
CREATE TABLE temp_tbl (f1 tinyint);
|
|
CREATE TABLE result (f1 text(200), f2 char(20));
|
|
set @@sql_mode='traditional';
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
|
CREATE PROCEDURE sp1()
|
|
BEGIN
|
|
declare a tinyint;
|
|
declare count_ int default 1;
|
|
declare continue handler for sqlstate '22003' set count_=1000;
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
SELECT @@sql_mode into @cur_val_sql_mode;
|
|
insert into temp_tbl values (1000);
|
|
if count_ = 1000 THEN
|
|
INSERT INTO result VALUES (@cur_val_sql_mode, 'value restored');
|
|
ELSE
|
|
INSERT INTO result VALUES (@cur_val_sql_mode, 'value not restored');
|
|
END if;
|
|
END//
|
|
SHOW CREATE PROCEDURE sp1;
|
|
Procedure sql_mode Create Procedure
|
|
sp1 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
|
|
BEGIN
|
|
declare a tinyint;
|
|
declare count_ int default 1;
|
|
declare continue handler for sqlstate '22003' set count_=1000;
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
SELECT @@sql_mode into @cur_val_sql_mode;
|
|
insert into temp_tbl values (1000);
|
|
if count_ = 1000 THEN
|
|
INSERT INTO result VALUES (@cur_val_sql_mode, 'value restored');
|
|
ELSE
|
|
INSERT INTO result VALUES (@cur_val_sql_mode, 'value not restored');
|
|
END if;
|
|
END
|
|
set @@sql_mode='';
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode
|
|
CALL sp1();
|
|
Variable_name Value
|
|
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
|
SELECT * from result;
|
|
f1 f2
|
|
STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER value restored
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode
|
|
SELECT @@sql_mode;
|
|
@@sql_mode
|
|
|
|
SET @@sql_mode='TRADITIONAL';
|
|
DROP PROCEDURE sp1;
|
|
DROP TABLE temp_tbl;
|
|
DROP TABLE result;
|
|
|
|
Testcase 3.1.7.2:
|
|
-----------------
|
|
Ensure that if the sql_mode setting is changed when a stored procedure is run,
|
|
that the original setting is restored as soon as the stored procedure execution
|
|
is complete.
|
|
--------------------------------------------------------------------------------
|
|
DROP PROCEDURE IF EXISTS sp2;
|
|
... show initial value
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
|
CREATE PROCEDURE sp2()
|
|
BEGIN
|
|
SET @@sql_mode='MAXDB';
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
END//
|
|
SHOW CREATE PROCEDURE sp2;
|
|
Procedure sql_mode Create Procedure
|
|
sp2 STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER CREATE DEFINER=`root`@`localhost` PROCEDURE `sp2`()
|
|
BEGIN
|
|
SET @@sql_mode='MAXDB';
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
END
|
|
... show value prior calling procedure
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
|
... call procedure that changes sql_mode
|
|
CALL sp2();
|
|
Variable_name Value
|
|
sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,MAXDB,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER
|
|
... check whether old value is re-set
|
|
SHOW VARIABLES LIKE 'sql_mode';
|
|
Variable_name Value
|
|
sql_mode STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER
|
|
DROP PROCEDURE sp2;
|
|
|
|
--source suite/funcs_1/storedproc/cleanup_sp_tb.inc
|
|
--------------------------------------------------------------------------------
|
|
DROP DATABASE IF EXISTS db_storedproc;
|
|
DROP DATABASE IF EXISTS db_storedproc_1;
|
|
|
|
. +++ END OF SCRIPT +++
|
|
--------------------------------------------------------------------------------
|