diff options
author | Alexander Nozdrin <alik@sun.com> | 2009-11-06 17:20:27 +0300 |
---|---|---|
committer | Alexander Nozdrin <alik@sun.com> | 2009-11-06 17:20:27 +0300 |
commit | 7cd11f45beeb162db84dea423a040a296ac2856e (patch) | |
tree | 3fcae3d99a56ba99d825ae4457901d49e4b474e3 /sql/sql_load.cc | |
parent | 5462a6dbcc68d51a89356255fb4f398be7d62c27 (diff) | |
parent | 3e2c9aac11a95d8cbb61e1937e4ebe18c7e86698 (diff) | |
download | mariadb-git-7cd11f45beeb162db84dea423a040a296ac2856e.tar.gz |
Manual merge from mysql-trunk-merge.
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r-- | sql/sql_load.cc | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 9c7433a5f82..34e899fc536 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -117,7 +117,7 @@ static int read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list, #ifndef EMBEDDED_LIBRARY static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, - const char* db_arg, + const char* db_arg, /* table's database */ const char* table_name_arg, enum enum_duplicates duplicates, bool ignore, @@ -538,7 +538,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, if (thd->transaction.stmt.modified_non_trans_table) write_execute_load_query_log_event(thd, ex, - tdb, table_list->table_name, + table_list->db, + table_list->table_name, handle_duplicates, ignore, transactional_table, errcode); @@ -586,7 +587,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, { int errcode= query_error_code(thd, killed_status == THD::NOT_KILLED); write_execute_load_query_log_event(thd, ex, - tdb, table_list->table_name, + table_list->db, table_list->table_name, handle_duplicates, ignore, transactional_table, errcode); @@ -611,7 +612,7 @@ err: /* Not a very useful function; just to avoid duplication of code */ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, - const char* db_arg, + const char* db_arg, /* table's database */ const char* table_name_arg, enum enum_duplicates duplicates, bool ignore, @@ -628,8 +629,27 @@ static bool write_execute_load_query_log_event(THD *thd, sql_exchange* ex, Item *item, *val; String pfield, pfields; int n; + const char *tbl= table_name_arg; + const char *tdb= (thd->db != NULL ? thd->db : db_arg); + String string_buf; - Load_log_event lle(thd, ex, db_arg, table_name_arg, fv, duplicates, + if (!thd->db || strcmp(db_arg, thd->db)) + { + /* + If used database differs from table's database, + prefix table name with database name so that it + becomes a FQ name. + */ + string_buf.set_charset(system_charset_info); + string_buf.append(db_arg); + string_buf.append("`"); + string_buf.append("."); + string_buf.append("`"); + string_buf.append(table_name_arg); + tbl= string_buf.c_ptr_safe(); + } + + Load_log_event lle(thd, ex, tdb, tbl, fv, duplicates, ignore, transactional_table); /* |