1#
2# Archive can only use an existing directory for DATA DIRECTORY.
3#
4CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
5ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive';
6ERROR HY000: Can't find file: 't1' (errno: 2 - No such file or directory)
7#
8# mkdir MYSQL_TMP_DIR/archive and try again...
9# Archive will use a symlink for DATA DIRECTORY but ignore INDEX DIRECTORY.
10#
11CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
12ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive' INDEX DIRECTORY = 'MYSQL_TMP_DIR/archive';
13Warnings:
14Warning	1618	<INDEX DIRECTORY> option ignored
15INSERT INTO t1 VALUES (NULL, "blue");
16INSERT INTO t1 VALUES (NULL, "red");
17INSERT INTO t1 VALUES (NULL, "yellow");
18# Checking if archive file exists where we specified in DATA DIRECTORY
19SHOW CREATE TABLE t1;
20Table	Create Table
21t1	CREATE TABLE `t1` (
22  `a` int(11) NOT NULL AUTO_INCREMENT,
23  `b` char(30) DEFAULT NULL,
24  PRIMARY KEY (`a`)
25) ENGINE=ARCHIVE AUTO_INCREMENT=4 DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TMP_DIR/archive/'
26DROP TABLE t1;
27#
28# Be sure SQL MODE "NO_DIR_IN_CREATE" prevents the use of DATA DIRECTORY
29#
30SET @org_mode=@@sql_mode;
31SET @@sql_mode='NO_DIR_IN_CREATE';
32Warnings:
33Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
34SELECT @@sql_mode;
35@@sql_mode
36NO_DIR_IN_CREATE
37CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
38ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive';
39Warnings:
40Warning	1618	<DATA DIRECTORY> option ignored
41INSERT INTO t1 VALUES (NULL, "blue");
42INSERT INTO t1 VALUES (NULL, "red");
43INSERT INTO t1 VALUES (NULL, "yellow");
44# Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
45DROP TABLE t1;
46set @@sql_mode=@org_mode;
47Warnings:
48Warning	3090	Changing sql mode 'NO_AUTO_CREATE_USER' is deprecated. It will be removed in a future release.
49#
50# MySQL engine does not allow DATA DIRECTORY to be
51# within --datadir for any engine, including Archive
52#
53CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
54ENGINE archive DATA DIRECTORY 'MYSQLD_DATADIR/test';
55ERROR HY000: Incorrect arguments to DATA DIRECTORY
56CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1))
57ENGINE archive INDEX DIRECTORY 'MYSQLD_DATADIR/test';
58ERROR HY000: Incorrect arguments to INDEX DIRECTORY
59#
60# Cleanup
61#
62