mirror of
https://github.com/MariaDB/server.git
synced 2026-05-17 20:37:12 +02:00
Merge branch '10.6' into 10.11
This commit is contained in:
commit
0707dac202
22 changed files with 204 additions and 46 deletions
|
|
@ -1870,6 +1870,26 @@ static char *cover_definer_clause(const char *stmt_str,
|
|||
return query_str;
|
||||
}
|
||||
|
||||
|
||||
static const char* build_path_for_table(char *to, const char *dir,
|
||||
const char *table, const char *ext)
|
||||
{
|
||||
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
convert_dirname(tmp_path, path, NULL);
|
||||
my_load_path(tmp_path, tmp_path, NULL);
|
||||
if (check_if_legal_tablename(table))
|
||||
strxnmov(filename, sizeof(filename) - 1, table, "@@@", NULL);
|
||||
else
|
||||
{
|
||||
uint errors, len;
|
||||
len= my_convert(filename, sizeof(filename) - 1, &my_charset_filename,
|
||||
table, (uint32)strlen(table), charset_info, &errors);
|
||||
filename[len]= 0;
|
||||
}
|
||||
return fn_format(to, filename, tmp_path, ext, MYF(MY_UNPACK_FILENAME));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Open a new .sql file to dump the table or view into
|
||||
|
||||
|
|
@ -1884,12 +1904,9 @@ static char *cover_definer_clause(const char *stmt_str,
|
|||
*/
|
||||
static FILE* open_sql_file_for_table(const char* table, int flags)
|
||||
{
|
||||
FILE* res;
|
||||
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
convert_dirname(tmp_path,path,NullS);
|
||||
res= my_fopen(fn_format(filename, table, tmp_path, ".sql", 4),
|
||||
flags, MYF(MY_WME));
|
||||
return res;
|
||||
char filename[FN_REFLEN];
|
||||
return my_fopen(build_path_for_table(filename, path, table, ".sql"),
|
||||
flags, MYF(MY_WME));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -4135,14 +4152,9 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
|
|||
|
||||
if (path)
|
||||
{
|
||||
char filename[FN_REFLEN], tmp_path[FN_REFLEN];
|
||||
/*
|
||||
Convert the path to native os format
|
||||
and resolve to the full filepath.
|
||||
*/
|
||||
convert_dirname(tmp_path,path,NullS);
|
||||
my_load_path(tmp_path, tmp_path, NULL);
|
||||
fn_format(filename, table, tmp_path, ".txt", MYF(MY_UNPACK_FILENAME));
|
||||
char filename[FN_REFLEN];
|
||||
|
||||
build_path_for_table(filename, path, table, ".txt");
|
||||
|
||||
/* Must delete the file that 'INTO OUTFILE' will write to */
|
||||
my_delete(filename, MYF(0));
|
||||
|
|
@ -4151,7 +4163,6 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
|
|||
to_unix_path(filename);
|
||||
|
||||
/* now build the query string */
|
||||
|
||||
dynstr_append_checked(&query_string, "SELECT /*!40001 SQL_NO_CACHE */ ");
|
||||
dynstr_append_checked(&query_string, select_field_names.str);
|
||||
dynstr_append_checked(&query_string, " INTO OUTFILE '");
|
||||
|
|
|
|||
|
|
@ -339,7 +339,17 @@ static int write_to_table(char *filename, MYSQL *mysql)
|
|||
DBUG_ENTER("write_to_table");
|
||||
DBUG_PRINT("enter",("filename: %s",filename));
|
||||
|
||||
fn_format(tablename, filename, "", "", 1 | 2); /* removes path & ext. */
|
||||
fn_format(tablename, filename, "", "", MYF(MY_REPLACE_DIR | MY_REPLACE_EXT));
|
||||
if (strchr(tablename, '@'))
|
||||
{
|
||||
uint errors, len;
|
||||
CHARSET_INFO *cs=
|
||||
get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(0));
|
||||
len= my_convert(escaped_name, sizeof(escaped_name) - 1, cs, tablename,
|
||||
(uint32)strlen(tablename), &my_charset_filename, &errors);
|
||||
if (!errors)
|
||||
strmake(tablename, escaped_name, len);
|
||||
}
|
||||
if (!opt_local_file)
|
||||
strmov(hard_path,filename);
|
||||
else
|
||||
|
|
@ -489,7 +499,7 @@ static MYSQL *db_connect(char *host, char *database,
|
|||
if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME))
|
||||
default_charset= (char *)my_default_csname();
|
||||
my_set_console_cp(default_charset);
|
||||
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname());
|
||||
mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0);
|
||||
mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD,
|
||||
"program_name", "mysqlimport");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue