diff options
author | unknown <jani@hynda.mysql.fi> | 2002-04-03 13:36:01 +0300 |
---|---|---|
committer | unknown <jani@hynda.mysql.fi> | 2002-04-03 13:36:01 +0300 |
commit | 5b8b8fcef622b8e0df0814a969e254907ba74840 (patch) | |
tree | 80d1640ef13b0e5d39eceb94b803a956c9613896 /client/mysqlimport.c | |
parent | 48f6e65624a4c522ef10224f6f67988c79e07d55 (diff) | |
download | mariadb-git-5b8b8fcef622b8e0df0814a969e254907ba74840.tar.gz |
merge
Diffstat (limited to 'client/mysqlimport.c')
-rw-r--r-- | client/mysqlimport.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 9eb93dc4808..e8403abe8c1 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -47,6 +47,7 @@ static char *opt_password=0, *current_user=0, *escaped=0, *opt_columns=0, *default_charset; static uint opt_mysql_port=0; static my_string opt_mysql_unix_port=0; +static my_string opt_ignore_lines=0; #include "sslopt-vars.h" static struct my_option my_long_options[] = @@ -89,6 +90,8 @@ static struct my_option my_long_options[] = (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-lines", OPT_IGN_LINES, "Ignore first n lines of data infile.", 0, 0, + 0, GET_LL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"lines-terminated-by", OPT_LTB, "Lines in the i.file are terminated by ...", (gptr*) &lines_terminated, (gptr*) &lines_terminated, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -227,6 +230,9 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), case (int) OPT_ESC: escaped= argument; break; + case (int) OPT_IGN_LINES: + opt_ignore_lines= argument; + break; #include "sslopt-case.h" } return 0; @@ -327,6 +333,8 @@ static int write_to_table(char *filename, MYSQL *sock) " OPTIONALLY ENCLOSED BY"); end= add_load_option(end, escaped, " ESCAPED BY"); end= add_load_option(end, lines_terminated, " LINES TERMINATED BY"); + if (opt_ignore_lines) + end= strmov(strmov(strmov(end, " IGNORE "), opt_ignore_lines), " LINES"); if (opt_columns) end= strmov(strmov(strmov(end, " ("), opt_columns), ")"); *end= '\0'; @@ -379,6 +387,9 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd) mysql_init(&mysql_connection); if (opt_compress) mysql_options(&mysql_connection,MYSQL_OPT_COMPRESS,NullS); + if (opt_local_file) + mysql_options(&mysql_connection,MYSQL_OPT_LOCAL_INFILE, + (char*) &opt_local_file); #ifdef HAVE_OPENSSL if (opt_use_ssl) mysql_ssl_set(&mysql_connection, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, |