--- ../../mysql-5.0.27/client/mysqlimport.c 2006-10-21 03:22:52.000000000 +0300 +++ mysqlimport.c 2007-05-31 15:12:41.000000000 +0300 @@ -36,7 +36,7 @@ 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, +static my_bool verbose=0,lock_tables=0,ignore_errors=0,opt_delete=0, ignore_foreign_keys=0, replace=0,silent=0,ignore=0,opt_compress=0, opt_low_priority= 0, tty_password= 0; static uint opt_local_file=0; @@ -100,6 +100,10 @@ (gptr*) ¤t_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"ignore", 'i', "If duplicate unique key was found, keep old row.", (gptr*) &ignore, (gptr*) &ignore, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"ignore-foreign-keys", 'k', + "Ignore foreign key checks while importing data.", + (gptr*) &ignore_foreign_keys, (gptr*) &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.", (gptr*) &opt_ignore_lines, (gptr*) &opt_ignore_lines, 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -408,6 +412,9 @@ ignore_errors=0; db_error(&mysql_connection); } + if (ignore_foreign_keys){ + mysql_query(sock, "SET FOREIGN_KEY_CHECKS = 0;"); + } return sock; } @@ -542,3 +549,4 @@ my_end(0); return(exitcode); } +