Commit 49e3bb02 authored by Alexander Barkov's avatar Alexander Barkov

Adding tests for ALTER TABLE

modified:
  mysql-test/suite/connect/r/dbf.result
  mysql-test/suite/connect/t/dbf.test
parent a38ae869
......@@ -401,5 +401,119 @@ Dec 5
Flags 00
-------- --------
DROP TABLE IF EXISTS t1;
#
# Testing ALTER
#
CREATE TABLE t1
(
a VARCHAR(10)
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10');
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
FileSize 77
DBF_Version 03
NRecords 1
FirstRecPos 66
RecLength 11
TableFlags 0000
CodePageMark 00
--- ---
FieldN 0
Name a
Type C
Offset 0
Length 10
Dec 0
Flags 00
-------- --------
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf'
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
FileSize 77
DBF_Version 03
NRecords 1
FirstRecPos 66
RecLength 11
TableFlags 0000
CodePageMark 00
--- ---
FieldN 0
Name a
Type C
Offset 0
Length 10
Dec 0
Flags 00
-------- --------
ALTER TABLE t1 MODIFY a INT(10) NOT NULL;
Warnings:
Warning 1366 Incorrect integer value: '' for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(10) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf'
SELECT * FROM t1;
a
10
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
FileSize 77
DBF_Version 03
NRecords 1
FirstRecPos 66
RecLength 11
TableFlags 0000
CodePageMark 00
--- ---
FieldN 0
Name a
Type C
Offset 0
Length 10
Dec 0
Flags 00
-------- --------
ALTER TABLE t1 MODIFY a INT(8) NOT NULL;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(8) NOT NULL
) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=DBF `FILE_NAME`='t1.dbf'
SELECT * FROM t1;
ERROR HY000: Got error 174 'DBF file t1.dbf is corrupted' from CONNECT
CALL dbf_header('MYSQLD_DATADIR/test/t1.dbf');
-------- --------
FileSize 77
DBF_Version 03
NRecords 1
FirstRecPos 66
RecLength 11
TableFlags 0000
CodePageMark 00
--- ---
FieldN 0
Name a
Type C
Offset 0
Length 10
Dec 0
Flags 00
-------- --------
DROP TABLE IF EXISTS t1;
DROP PROCEDURE test.dbf_field;
DROP PROCEDURE test.dbf_header;
......@@ -375,6 +375,44 @@ DROP TABLE IF EXISTS t1;
# on /opt/mariadb-5.5/data/: Is a directory' from CONNECT
#CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=DBF;
--echo #
--echo # Testing ALTER
--echo #
CREATE TABLE t1
(
a VARCHAR(10)
) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.dbf';
INSERT INTO t1 VALUES ('10');
SELECT * FROM t1;
--chmod 0777 $MYSQLD_DATADIR/test/t1.dbf
--vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results
ALTER TABLE t1 MODIFY a VARCHAR(10) NOT NULL;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
--vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results
ALTER TABLE t1 MODIFY a INT(10) NOT NULL;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
--vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results
ALTER TABLE t1 MODIFY a INT(8) NOT NULL;
SHOW CREATE TABLE t1;
--error ER_GET_ERRMSG
SELECT * FROM t1;
--vertical_results
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
eval CALL dbf_header('$MYSQLD_DATADIR/test/t1.dbf');
--horizontal_results
DROP TABLE IF EXISTS t1;
--remove_file $MYSQLD_DATADIR/test/t1.dbf
DROP PROCEDURE test.dbf_field;
DROP PROCEDURE test.dbf_header;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment