mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Adding a test for TABLE_TYPE=BIN
added: mysql-test/suite/connect/r/bin.result mysql-test/suite/connect/std_data/Testbal.dat mysql-test/suite/connect/t/bin.test
This commit is contained in:
51
mysql-test/suite/connect/r/bin.result
Normal file
51
mysql-test/suite/connect/r/bin.result
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Testing errors
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ID INT
|
||||
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
|
||||
SELECT * FROM t1;
|
||||
ID
|
||||
Warnings:
|
||||
Warning 1105 Open(rb) error 2 on DATADIR/test/nonexistent.txt: No such file or directory
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
fig INT(4) NOT NULL FIELD_FORMAT='C',
|
||||
name CHAR(10) not null,
|
||||
birth DATE NOT NULL,
|
||||
id CHAR(5) NOT NULL FIELD_FORMAT='S',
|
||||
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
|
||||
dept INT(4) NOT NULL FIELD_FORMAT='S'
|
||||
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
|
||||
SELECT * FROM t1;
|
||||
fig name birth id salary dept
|
||||
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
|
||||
123 OLIVER 1953-08-10 23456 3400.68 2158
|
||||
3123 FOO 2002-07-23 888 0.00 318
|
||||
INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555);
|
||||
ERROR HY000: Got error 122 'Value too long for field fig (5 --> 4)' from CONNECT
|
||||
INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
|
||||
SELECT * FROM t1;
|
||||
fig name birth id salary dept
|
||||
5500 ARCHIBALD 1980-01-25 3789 4380.50 318
|
||||
123 OLIVER 1953-08-10 23456 3400.68 2158
|
||||
3123 FOO 2002-07-23 888 0.00 318
|
||||
5555 RONALD 1980-02-26 3333 4444.44 555
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Testing that the underlying file is created
|
||||
#
|
||||
CREATE TABLE t1
|
||||
(
|
||||
c CHAR(4) NOT NULL FIELD_FORMAT='C'
|
||||
) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
|
||||
INSERT INTO t1 VALUES (10),(20),(300),(4000);
|
||||
SELECT * FROM t1;
|
||||
c
|
||||
10
|
||||
20
|
||||
300
|
||||
4000
|
||||
DROP TABLE t1;
|
BIN
mysql-test/suite/connect/std_data/Testbal.dat
Normal file
BIN
mysql-test/suite/connect/std_data/Testbal.dat
Normal file
Binary file not shown.
51
mysql-test/suite/connect/t/bin.test
Normal file
51
mysql-test/suite/connect/t/bin.test
Normal file
@ -0,0 +1,51 @@
|
||||
let $MYSQLD_DATADIR= `select @@datadir`;
|
||||
--copy_file $MYSQL_TEST_DIR/suite/connect/std_data/Testbal.dat $MYSQLD_DATADIR/test/Testbal.dat
|
||||
|
||||
--echo #
|
||||
--echo # Testing errors
|
||||
--echo #
|
||||
CREATE TABLE t1
|
||||
(
|
||||
ID INT
|
||||
) Engine=CONNECT TABLE_TYPE=BIN FILE_NAME='nonexistent.txt';
|
||||
--replace_regex /on .*test.nonexistent.txt/on DATADIR\/test\/nonexistent.txt/
|
||||
# TODO: check why this is needed for Windows
|
||||
--replace_result Open(rt) Open(rb)
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
CREATE TABLE t1
|
||||
(
|
||||
fig INT(4) NOT NULL FIELD_FORMAT='C',
|
||||
name CHAR(10) not null,
|
||||
birth DATE NOT NULL,
|
||||
id CHAR(5) NOT NULL FIELD_FORMAT='S',
|
||||
salary DOUBLE(9,2) NOT NULL DEFAULT 0.00 FIELD_FORMAT='F',
|
||||
dept INT(4) NOT NULL FIELD_FORMAT='S'
|
||||
) ENGINE=CONNECT TABLE_TYPE=BIN BLOCK_SIZE=5 FILE_NAME='Testbal.dat';
|
||||
SELECT * FROM t1;
|
||||
|
||||
--error ER_GET_ERRMSG
|
||||
INSERT INTO t1 VALUES (55555,'RONALD','1980-02-26','3333',4444.44,555);
|
||||
INSERT INTO t1 VALUES (5555,'RONALD','1980-02-26','3333',4444.44,555);
|
||||
SELECT * FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Testing that the underlying file is created
|
||||
--echo #
|
||||
CREATE TABLE t1
|
||||
(
|
||||
c CHAR(4) NOT NULL FIELD_FORMAT='C'
|
||||
) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='bin2.dat';
|
||||
INSERT INTO t1 VALUES (10),(20),(300),(4000);
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Clean up
|
||||
#
|
||||
--remove_file $MYSQLD_DATADIR/test/Testbal.dat
|
||||
--remove_file $MYSQLD_DATADIR/test/bin2.dat
|
Reference in New Issue
Block a user