1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00
This commit is contained in:
jani@hynda.mysql.fi
2002-04-03 13:36:01 +03:00
parent 6980eafe08
commit 22a35da68c
4 changed files with 352 additions and 120 deletions

View File

@@ -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*) &current_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,