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';
32SELECT @@sql_mode;
33@@sql_mode
34NO_DIR_IN_CREATE
35CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
36ENGINE archive DATA DIRECTORY = 'MYSQL_TMP_DIR/archive';
37Warnings:
38Warning	1618	<DATA DIRECTORY> option ignored
39INSERT INTO t1 VALUES (NULL, "blue");
40INSERT INTO t1 VALUES (NULL, "red");
41INSERT INTO t1 VALUES (NULL, "yellow");
42# Checking if archive file exists in --datadir since DATA DIRECTORY was ignored.
43DROP TABLE t1;
44set @@sql_mode=@org_mode;
45#
46# MySQL engine does not allow DATA DIRECTORY to be
47# within --datadir for any engine, including Archive
48#
49CREATE TABLE t1 (a int AUTO_INCREMENT KEY, b char(30))
50ENGINE archive DATA DIRECTORY 'MYSQLD_DATADIR/test';
51ERROR HY000: Incorrect arguments to DATA DIRECTORY
52CREATE TABLE t1 (c1 int(10), PRIMARY KEY (c1))
53ENGINE archive INDEX DIRECTORY 'MYSQLD_DATADIR/test';
54ERROR HY000: Incorrect arguments to INDEX DIRECTORY
55#
56# Cleanup
57#
58