mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
copy from test-extra-5.1 to main tree
BitKeeper/etc/ignore: Added mysql-test/suite/funcs_1/r/innodb_views.warnings mysql-test/suite/funcs_1/r/memory_trig_03e.warnings mysql-test/suite/funcs_1/r/memory_views.warnings mysql-test/suite/funcs_1/r/myisam_trig_03e.warnings mysql-test/suite/funcs_1/r/myisam_views.warnings mysql-test/suite/funcs_1/r/ndb_trig_03e.warnings mysql-test/suite/funcs_1/r/ndb_views.warnings mysql-test/suite/partitions/r/diff mysql-test/suite/partitions/r/partition_bit_ndb.warnings mysql-test/suite/partitions/r/partition_special_innodb.warnings mysql-test/suite/partitions/r/partition_special_myisam.warnings storage/archive/archive_reader mysql-test/suite/funcs_1/r/innodb_trig_03e.warnings to the ignore list mysql-test/suite/funcs_2/include/check_charset.inc: inserted newline at the end of file. mysql-test/suite/objects/include/drop_all.inc: inserted newline at the end of file. mysql-test/suite/partitions/include/partition_key_32col.inc: inserted newline at the end of file. mysql-test/suite/rpl/data/rpl_mixed.dat: inserted newline at the end of file. mysql-test/suite/rpl/include/rpl_mixed_check_event.inc: inserted newline at the end of file. mysql-test/suite/rpl/include/rpl_mixed_check_select.inc: inserted newline at the end of file. mysql-test/suite/rpl/include/rpl_mixed_check_user.inc: inserted newline at the end of file. mysql-test/suite/rpl/include/rpl_mixed_check_view.inc: inserted newline at the end of file.
This commit is contained in:
172
mysql-test/suite/funcs_1/r/innodb_storedproc_07.result
Normal file
172
mysql-test/suite/funcs_1/r/innodb_storedproc_07.result
Normal file
@ -0,0 +1,172 @@
|
||||
|
||||
--source suite/funcs_1/storedproc/load_sp_tb.inc
|
||||
--------------------------------------------------------------------------------
|
||||
SET @@global.max_heap_table_size=4294967295;
|
||||
SET @@session.max_heap_table_size=4294967295;
|
||||
|
||||
--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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 = innodb;
|
||||
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 +++
|
||||
--------------------------------------------------------------------------------
|
Reference in New Issue
Block a user