summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <tsmith@ramayana.hindu.god>2007-08-14 15:35:19 -0600
committerunknown <tsmith@ramayana.hindu.god>2007-08-14 15:35:19 -0600
commit3925c3feee67aaf1efeb08610b68b5c360b955b7 (patch)
treeaceeea849924bc93c34127d19abe9261b8e78a7a /sql/sql_table.cc
parent5dc6ba8255361053243010ff7ee24bfeb84d255d (diff)
downloadmariadb-git-3925c3feee67aaf1efeb08610b68b5c360b955b7.tar.gz
Updates to allow innodb.test to be run with --embedded-server,
including a small change to build_table_filename(). mysql-test/mysql-test-run.pl: Remove unused bad merge bitrot code. This chunk of code is a repeat copy of an earlier chunk, and should never have been here. mysql-test/r/innodb.result: Updates to allow innodb.test to be run with --embedded-server mysql-test/suite/binlog/r/binlog_innodb.result: Updates to allow innodb.test to be run with --embedded-server mysql-test/suite/binlog/t/binlog_innodb.test: Updates to allow innodb.test to be run with --embedded-server mysql-test/t/innodb.test: Updates to allow innodb.test to be run with --embedded-server sql/sql_table.cc: build_table_filename(): Don't add FN_ROOTDIR to mysql_data_home if it's already there. This is done to make it easier to write tests which check the output of various error messages, and work with both the embedded server (mysql_data_home is full path, including trailing FN_ROOTDIR) and normal server (mysql_data_home is just ".").
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index eb81e7647eb..17544b8ccde 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -157,6 +157,7 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
SYNOPSIS
build_table_filename()
buff Where to write result in my_charset_filename.
+ This may be the same as table_name.
bufflen buff size
db Database name in system_charset_info.
table_name Table name in system_charset_info.
@@ -186,10 +187,11 @@ uint tablename_to_filename(const char *from, char *to, uint to_length)
uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table_name, const char *ext, uint flags)
{
- uint length;
char dbbuff[FN_REFLEN];
char tbbuff[FN_REFLEN];
DBUG_ENTER("build_table_filename");
+ DBUG_PRINT("enter", ("db: '%s' table_name: '%s' ext: '%s' flags: %x",
+ db, table_name, ext, flags));
if (flags & FN_IS_TMP) // FN_FROM_IS_TMP | FN_TO_IS_TMP
strnmov(tbbuff, table_name, sizeof(tbbuff));
@@ -197,10 +199,18 @@ uint build_table_filename(char *buff, size_t bufflen, const char *db,
VOID(tablename_to_filename(table_name, tbbuff, sizeof(tbbuff)));
VOID(tablename_to_filename(db, dbbuff, sizeof(dbbuff)));
- length= strxnmov(buff, bufflen, mysql_data_home, FN_ROOTDIR, dbbuff,
- FN_ROOTDIR, tbbuff, ext, NullS) - buff;
+
+ char *end = buff + bufflen;
+ /* Don't add FN_ROOTDIR if mysql_data_home already includes it */
+ char *pos = strnmov(buff, mysql_data_home, bufflen);
+ int rootdir_len= strlen(FN_ROOTDIR);
+ if (pos - rootdir_len >= buff &&
+ memcmp(pos - rootdir_len, FN_ROOTDIR, rootdir_len) != 0)
+ pos= strnmov(pos, FN_ROOTDIR, end - pos);
+ pos= strxnmov(pos, end - pos, dbbuff, FN_ROOTDIR, tbbuff, ext, NullS);
+
DBUG_PRINT("exit", ("buff: '%s'", buff));
- DBUG_RETURN(length);
+ DBUG_RETURN(pos - buff);
}