--- mysql.cc 2007-05-31 14:38:09.000000000 +0300 +++ ../../mysql-5.0.27/client/mysql.cc 2007-05-31 15:06:57.000000000 +0300 @@ -127,7 +127,7 @@ typedef enum enum_info_type INFO_TYPE; static MYSQL mysql; /* The connection */ -static my_bool info_flag=0,ignore_errors=0,wait_flag=0,quick=0, +static my_bool info_flag=0,ignore_errors=0,ignore_foreign_keys=0,wait_flag=0,quick=0, connected=0,opt_raw_data=0,unbuffered=0,output_tables=0, rehash=1,skip_updates=0,safe_updates=0,one_database=0, opt_compress=0, using_opt_local_infile=0, @@ -436,6 +436,12 @@ mysql_thread_id(&mysql),mysql_get_server_info(&mysql)); put_info((char*) glob_buffer.ptr(),INFO_INFO); + if (ignore_foreign_keys){ + mysql_query(&mysql, "SET FOREIGN_KEY_CHECKS = 0;"); + put_info("Foreign key checks are disabled! \\g.", + INFO_INFO); + } + #ifdef HAVE_READLINE initialize_readline((char*) my_progname); if (!status.batch && !quick && !opt_html && !opt_xml) @@ -601,6 +607,10 @@ {"force", 'f', "Continue even if we get an sql error.", (gptr*) &ignore_errors, (gptr*) &ignore_errors, 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}, {"named-commands", 'G', "Enable named commands. Named commands mean this program's internal commands; see mysql> help . When enabled, the named commands can be used from any line of the query, otherwise only from the first line, before an enter. Disable with --disable-named-commands. This option is disabled by default.", (gptr*) &named_cmds, (gptr*) &named_cmds, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,