Commit 1267a7fb authored by unknown's avatar unknown
Browse files

Bug#17498 failed to put data file in custom directory use "data directory" option

- Using DATA/INDEX DIRECTORY option on Windows put data/index file into
  default directory because the OS doesn't support readlink().
- The procedure for changing data/index file directory is 
  different under Windows.
- With this fix we report a warning if DATA/INDEX option is used,
  but OS doesn't support readlink().


mysql-test/r/windows.result:
  - updated result file.
mysql-test/t/windows.test:
  - Added test case to verify we get warnings if we specify DATA/INDEX
    DIRECTORY on a platform which doesn't support readlink().
sql/sql_parse.cc:
  - Added warnings if DATA/INDEX DIRECTORY option is used but not supported
    by the target platform.
parent b121562b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6,3 +6,9 @@ use prn;
ERROR 42000: Unknown database 'prn'
create table nu (a int);
drop table nu;
drop table if exists t1;
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
Warnings:
Warning	0	DATA DIRECTORY option ignored
Warning	0	INDEX DIRECTORY option ignored
drop table t1;
+9 −0
Original line number Diff line number Diff line
@@ -17,4 +17,13 @@ use prn;
create table nu (a int);
drop table nu;

#
# Bug17489: ailed to put data file in custom directory use "data directory" option
#
--disable_warnings
drop table if exists t1;
--enable_warnings
CREATE TABLE t1 ( `ID` int(6) ) data directory 'c:/tmp/' index directory 'c:/tmp/' engine=MyISAM;
drop table t1;

# End of 4.1 tests
+6 −0
Original line number Diff line number Diff line
@@ -2485,6 +2485,12 @@ mysql_execute_command(THD *thd)
      goto unsent_create_error;

#ifndef HAVE_READLINK
    if (lex->create_info.data_file_name)
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
                   "DATA DIRECTORY option ignored");
    if (lex->create_info.index_file_name)
      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, 0,
                   "INDEX DIRECTORY option ignored");
    lex->create_info.data_file_name=lex->create_info.index_file_name=0;
#else
    /* Fix names if symlinked tables */