diff options
author | kostja@bodhi.local <> | 2006-07-26 23:33:25 +0400 |
---|---|---|
committer | kostja@bodhi.local <> | 2006-07-26 23:33:25 +0400 |
commit | 73189969f358be1530a1421fe38ea5cd183cfe10 (patch) | |
tree | 9127bb933b3774974a321dce0ca111f0e8ac8991 /storage/myisam/mi_create.c | |
parent | bea330494ce2ef65fcdb0c74c646af7df8a0d778 (diff) | |
parent | bd183d42dcf66432d2e8051e030919a4669eaf8c (diff) | |
download | mariadb-git-73189969f358be1530a1421fe38ea5cd183cfe10.tar.gz |
Merge bodhi.local:/opt/local/work/tmp_merge
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
Diffstat (limited to 'storage/myisam/mi_create.c')
-rw-r--r-- | storage/myisam/mi_create.c | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index c5a9af08def..a0b3f657867 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -574,9 +574,22 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, { char *iext= strrchr(ci->index_file_name, '.'); int have_iext= iext && !strcmp(iext, MI_NAME_IEXT); - - fn_format(filename, ci->index_file_name, "", MI_NAME_IEXT, - MY_UNPACK_FILENAME| (have_iext ? MY_REPLACE_EXT :MY_APPEND_EXT)); + if (options & HA_OPTION_TMP_TABLE) + { + char *path; + /* chop off the table name, tempory tables use generated name */ + if ((path= strrchr(ci->index_file_name, FN_LIBCHAR))) + *path= '\0'; + fn_format(filename, name, ci->index_file_name, MI_NAME_IEXT, + MY_REPLACE_DIR | MY_UNPACK_FILENAME | + (have_iext ? MY_REPLACE_EXT : MY_APPEND_EXT)); + } + else + { + fn_format(filename, ci->index_file_name, "", MI_NAME_IEXT, + MY_UNPACK_FILENAME | (have_iext ? MY_REPLACE_EXT : + MY_APPEND_EXT)); + } fn_format(linkname, name, "", MI_NAME_IEXT, MY_UNPACK_FILENAME|MY_APPEND_EXT); linkname_ptr=linkname; @@ -639,9 +652,23 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs, char *dext= strrchr(ci->data_file_name, '.'); int have_dext= dext && !strcmp(dext, MI_NAME_DEXT); - fn_format(filename, ci->data_file_name, "", MI_NAME_DEXT, - MY_UNPACK_FILENAME | - (have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT)); + if (options & HA_OPTION_TMP_TABLE) + { + char *path; + /* chop off the table name, tempory tables use generated name */ + if ((path= strrchr(ci->data_file_name, FN_LIBCHAR))) + *path= '\0'; + fn_format(filename, name, ci->data_file_name, MI_NAME_DEXT, + MY_REPLACE_DIR | MY_UNPACK_FILENAME | + (have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT)); + } + else + { + fn_format(filename, ci->data_file_name, "", MI_NAME_DEXT, + MY_UNPACK_FILENAME | + (have_dext ? MY_REPLACE_EXT : MY_APPEND_EXT)); + } + fn_format(linkname, name, "",MI_NAME_DEXT, MY_UNPACK_FILENAME | MY_APPEND_EXT); linkname_ptr=linkname; |