Bug #6660 mysqldump creates bad pathnames on Windows
This is a modifiction of my previous patch after receiving feedback. This is a better way to fix the problem. With this patch, data directory and index directory will use only forward slashes (/) when on Windows. mysqldump.c: Removed fixPaths routine. Was improper fix for bug #6660 sql_show.cc: Changed append_directory to convert backslashes to foward slashes when on Windows.
This commit is contained in:
parent
75e1b9e765
commit
887f2a53fe
@ -1081,26 +1081,6 @@ static void print_xml_row(FILE *xml_file, const char *row_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* fixPaths -- on Windows only, this function will iterate through the output
|
|
||||||
of show create table and change any \ characters that appear in the data directory
|
|
||||||
or index directory elements to be /
|
|
||||||
|
|
||||||
RETURN
|
|
||||||
void
|
|
||||||
*/
|
|
||||||
static void fixPaths(char *buf, int buflen)
|
|
||||||
{
|
|
||||||
#ifdef __WIN__
|
|
||||||
int i = 0;
|
|
||||||
for (i=0; i < buflen; i++)
|
|
||||||
{
|
|
||||||
if (buf[i] != '\\') continue;
|
|
||||||
if (i != 0 && buf[i-1] == '\\') continue;
|
|
||||||
if (i != (buflen-1) && buf[i+1] == '\\') continue;
|
|
||||||
buf[i] = '/';}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
getStructure -- retrievs database structure, prints out corresponding
|
getStructure -- retrievs database structure, prints out corresponding
|
||||||
CREATE statement and fills out insert_pat.
|
CREATE statement and fills out insert_pat.
|
||||||
@ -1180,7 +1160,6 @@ static uint getTableStructure(char *table, char* db)
|
|||||||
|
|
||||||
tableRes=mysql_store_result(sock);
|
tableRes=mysql_store_result(sock);
|
||||||
row=mysql_fetch_row(tableRes);
|
row=mysql_fetch_row(tableRes);
|
||||||
fixPaths(row[1], strlen(row[1])); // this really only does something on Windows
|
|
||||||
fprintf(sql_file, "%s;\n", row[1]);
|
fprintf(sql_file, "%s;\n", row[1]);
|
||||||
check_io(sql_file);
|
check_io(sql_file);
|
||||||
mysql_free_result(tableRes);
|
mysql_free_result(tableRes);
|
||||||
|
@ -1227,7 +1227,16 @@ static void append_directory(THD *thd, String *packet, const char *dir_type,
|
|||||||
packet->append(' ');
|
packet->append(' ');
|
||||||
packet->append(dir_type);
|
packet->append(dir_type);
|
||||||
packet->append(" DIRECTORY='", 12);
|
packet->append(" DIRECTORY='", 12);
|
||||||
|
#ifdef __WIN__
|
||||||
|
char *winfilename = strdup(filename);
|
||||||
|
for (uint i=0; i < length; i++)
|
||||||
|
if (winfilename[i] == '\\')
|
||||||
|
winfilename[i] = '/';
|
||||||
|
packet->append(winfilename, length);
|
||||||
|
free(winfilename);
|
||||||
|
#else
|
||||||
packet->append(filename, length);
|
packet->append(filename, length);
|
||||||
|
#endif
|
||||||
packet->append('\'');
|
packet->append('\'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user