summaryrefslogtreecommitdiff
path: root/client/mysqlimport.c
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-05-19 20:55:37 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2019-05-19 20:55:37 +0200
commitc07325f932abef2032b2e56532f6cb615e2a1161 (patch)
tree754ca158e45ebc014e5cbeaf4c3e7581f9575d76 /client/mysqlimport.c
parent7f8187bc432f79afe4c0549d68845a68e6c159ab (diff)
parent2ae83affef5a4d89f38272db31a400f968279a7a (diff)
downloadmariadb-git-c07325f932abef2032b2e56532f6cb615e2a1161.tar.gz
Merge branch '10.3' into 10.4
Diffstat (limited to 'client/mysqlimport.c')
-rw-r--r--client/mysqlimport.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 977e0e6ca1e..3e250bdd9ed 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
*/
/*
@@ -48,8 +48,8 @@ static char *add_load_option(char *ptr,const char *object,
const char *statement);
static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0,
- replace=0,silent=0,ignore=0,opt_compress=0,
- opt_low_priority= 0, tty_password= 0;
+ replace, silent, ignore, ignore_foreign_keys,
+ opt_compress, opt_low_priority, tty_password;
static my_bool debug_info_flag= 0, debug_check_flag= 0;
static uint opt_use_threads=0, opt_local_file=0, my_end_arg= 0;
static char *opt_password=0, *current_user=0,
@@ -119,6 +119,10 @@ static struct my_option my_long_options[] =
&current_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"ignore", 'i', "If duplicate unique key was found, keep old row.",
&ignore, &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+ {"ignore-foreign-keys", 'k',
+ "Disable foreign key checks while importing the data.",
+ &ignore_foreign_keys, &ignore_foreign_keys, 0, GET_BOOL, NO_ARG,
+ 0, 0, 0, 0, 0, 0},
{"ignore-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.",
&opt_ignore_lines, &opt_ignore_lines, 0, GET_LL,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -477,6 +481,9 @@ static MYSQL *db_connect(char *host, char *database,
ignore_errors=0;
db_error(mysql);
}
+ if (ignore_foreign_keys)
+ mysql_query(mysql, "set foreign_key_checks= 0;");
+
return mysql;
}
@@ -502,8 +509,8 @@ static void safe_exit(int error, MYSQL *mysql)
if (mysql)
mysql_close(mysql);
- free_defaults(argv_to_free);
mysql_library_end();
+ free_defaults(argv_to_free);
my_free(opt_password);
if (error)
sf_leaking_memory= 1; /* dirty exit, some threads are still running */