summaryrefslogtreecommitdiff
path: root/libmysql/libmysql.c
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-02-14 18:58:24 +0200
committerunknown <monty@hundin.mysql.fi>2002-02-14 18:58:24 +0200
commit03facd7d8e7f30581892e0467469c1c562b3f86f (patch)
tree9f6476af645cdeb53eefe6ca4f6bc6f4ac04bf84 /libmysql/libmysql.c
parent866e38069061f44dbd1fe7a9b0fdc7e1ee7a0e58 (diff)
parent9d5d3834c076edcd398ee3834a7c62db030a6bdf (diff)
downloadmariadb-git-03facd7d8e7f30581892e0467469c1c562b3f86f.tar.gz
merge with 3.23.49
BitKeeper/etc/logging_ok: auto-union acconfig.h: Auto merged Docs/manual.texi: Auto merged client/client_priv.h: Auto merged include/mysql.h: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/row/row0mysql.c: Auto merged mysql-test/t/comments.test: Auto merged sql/sql_lex.cc: Auto merged sql/sql_load.cc: Auto merged sql/sql_parse.cc: Auto merged sql/unireg.cc: Auto merged sql/unireg.h: Auto merged
Diffstat (limited to 'libmysql/libmysql.c')
-rw-r--r--libmysql/libmysql.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index 0e9a163a5b5..32aa8e59888 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -60,7 +60,7 @@ static my_bool mysql_client_init=0;
uint mysql_port=0;
my_string mysql_unix_port=0;
-#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES | CLIENT_TRANSACTIONS)
+#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_TRANSACTIONS)
#ifdef __WIN__
#define CONNECT_TIMEOUT 20
@@ -694,12 +694,14 @@ mysql_free_result(MYSQL_RES *result)
****************************************************************************/
static const char *default_options[]=
-{"port","socket","compress","password","pipe", "timeout", "user",
- "init-command", "host", "database", "debug", "return-found-rows",
- "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath", "ssl-cipher"
- "character-set-dir", "default-character-set", "interactive-timeout",
- "connect_timeout", "replication-probe", "enable-reads-from-master",
- "repl-parse-query",
+{
+ "port","socket","compress","password","pipe", "timeout", "user",
+ "init-command", "host", "database", "debug", "return-found-rows",
+ "ssl-key" ,"ssl-cert" ,"ssl-ca" ,"ssl-capath",
+ "character-set-dir", "default-character-set", "interactive-timeout",
+ "connect-timeout", "local-infile", "disable-local-infile",
+ "replication-probe", "enable-reads-from-master", "repl-parse-query",
+ "ssl-chiper",
NullS
};
@@ -734,6 +736,9 @@ static void mysql_read_default_options(struct st_mysql_options *options,
opt_arg=end+1;
*end=0; /* Remove '=' */
}
+ /* Change all '_' in variable name to '-' */
+ for (end= *option ; (end= strcend(end,'_')) ; )
+ *end= '-';
switch (find_type(*option+2,&option_types,2)) {
case 1: /* port */
if (opt_arg)
@@ -831,15 +836,24 @@ static void mysql_read_default_options(struct st_mysql_options *options,
options->charset_name = my_strdup(opt_arg, MYF(MY_WME));
break;
case 19: /* Interactive-timeout */
- options->client_flag|=CLIENT_INTERACTIVE;
+ options->client_flag|= CLIENT_INTERACTIVE;
+ break;
+ case 21:
+ if (!opt_arg || atoi(opt_arg) != 0)
+ options->client_flag|= CLIENT_LOCAL_FILES;
+ else
+ options->client_flag&= ~CLIENT_LOCAL_FILES;
break;
- case 21: /* replication probe */
+ case 22:
+ options->client_flag&= CLIENT_LOCAL_FILES;
+ break;
+ case 23: /* replication probe */
options->rpl_probe = 1;
break;
- case 22: /* enable-reads-from-master */
+ case 24: /* enable-reads-from-master */
options->rpl_parse = 1;
break;
- case 23: /* repl-parse-query */
+ case 25: /* repl-parse-query */
options->no_master_reads = 0;
break;
default:
@@ -1321,6 +1335,14 @@ mysql_init(MYSQL *mysql)
if (!((mysql)->client_flag & CLIENT_IGNORE_SIGPIPE))
(void) signal(SIGPIPE,pipe_sig_handler);
#endif
+
+/*
+ Only enable LOAD DATA INFILE by default if configured with
+ --with-enabled-local-inflile
+*/
+#ifdef ENABLED_LOCAL_INFILE
+ mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+#endif
return mysql;
}
@@ -1770,7 +1792,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
if (mysql->options.use_ssl)
client_flag|=CLIENT_SSL;
#endif /* HAVE_OPENSSL */
-
if (db)
client_flag|=CLIENT_CONNECT_WITH_DB;
#ifdef HAVE_COMPRESS
@@ -2714,11 +2735,17 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const char *arg)
mysql->options.connect_timeout= *(uint*) arg;
break;
case MYSQL_OPT_COMPRESS:
- mysql->options.compress=1; /* Remember for connect */
+ mysql->options.compress= 1; /* Remember for connect */
break;
case MYSQL_OPT_NAMED_PIPE:
mysql->options.named_pipe=1; /* Force named pipe */
break;
+ case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
+ if (!arg || test(*(uint*) arg))
+ mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+ else
+ mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
+ break;
case MYSQL_INIT_COMMAND:
my_free(mysql->options.init_command,MYF(MY_ALLOW_ZERO_PTR));
mysql->options.init_command=my_strdup(arg,MYF(MY_WME));