mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 12:27:03 +08:00
add load_infile option and more doc cleanups
This commit is contained in:
@ -106,6 +106,9 @@ class Connection(_mysql.connection):
|
||||
(mysql_ssl_set()). If this is set, and the client does not
|
||||
support SSL, UnsupportedError will be raised.
|
||||
|
||||
local_infile
|
||||
integer, non-zero enables LOAD LOCAL INFILE; zero disables
|
||||
|
||||
There are a number of undocumented, non-standard methods. See the
|
||||
documentation for the MySQL C API for some hints on what they do.
|
||||
|
||||
@ -162,7 +165,8 @@ class Connection(_mysql.connection):
|
||||
If o is a non-string sequence, the items of the sequence are
|
||||
converted and returned as a sequence.
|
||||
|
||||
Non-standard.
|
||||
Non-standard. For internal use; do not use this in your
|
||||
applications.
|
||||
|
||||
"""
|
||||
return self.escape(o, self.converter)
|
||||
@ -174,7 +178,8 @@ class Connection(_mysql.connection):
|
||||
character set as the encoding. If that's not available,
|
||||
latin1 is used.
|
||||
|
||||
Non-standard.
|
||||
Non-standard. For internal use; do not use this in your
|
||||
applications.
|
||||
|
||||
"""
|
||||
return self.literal(u.encode(self.charset))
|
||||
|
@ -440,9 +440,10 @@ _mysql_ConnectionObject_Initialize(
|
||||
"named_pipe", "init_command",
|
||||
"read_default_file", "read_default_group",
|
||||
"client_flag", "ssl",
|
||||
"local_infile",
|
||||
NULL } ;
|
||||
int connect_timeout = 0;
|
||||
int compress = -1, named_pipe = -1;
|
||||
int compress = -1, named_pipe = -1, local_infile = -1;
|
||||
char *init_command=NULL,
|
||||
*read_default_file=NULL,
|
||||
*read_default_group=NULL;
|
||||
@ -450,7 +451,7 @@ _mysql_ConnectionObject_Initialize(
|
||||
self->converter = NULL;
|
||||
self->open = 0;
|
||||
check_server_init(-1);
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssisOiiisssiO:connect",
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ssssisOiiisssiOi:connect",
|
||||
kwlist,
|
||||
&host, &user, &passwd, &db,
|
||||
&port, &unix_socket, &conv,
|
||||
@ -458,7 +459,9 @@ _mysql_ConnectionObject_Initialize(
|
||||
&compress, &named_pipe,
|
||||
&init_command, &read_default_file,
|
||||
&read_default_group,
|
||||
&client_flag, &ssl))
|
||||
&client_flag, &ssl,
|
||||
&local_infile
|
||||
))
|
||||
return -1;
|
||||
|
||||
if (!conv)
|
||||
@ -510,6 +513,9 @@ _mysql_ConnectionObject_Initialize(
|
||||
if (read_default_group != NULL)
|
||||
mysql_options(&(self->connection), MYSQL_READ_DEFAULT_GROUP, read_default_group);
|
||||
|
||||
if (local_infile != -1)
|
||||
mysql_options(&(self->connection), MYSQL_OPT_LOCAL_INFILE, (char *) &local_infile);
|
||||
|
||||
#if HAVE_OPENSSL
|
||||
if (ssl)
|
||||
mysql_ssl_set(&(self->connection),
|
||||
@ -580,6 +586,13 @@ read_default_file\n\
|
||||
\n\
|
||||
read_default_group\n\
|
||||
see the MySQL documentation for mysql_options()\n\
|
||||
\n\
|
||||
client_flag\n\
|
||||
client flags from MySQLdb.constants.CLIENT\n\
|
||||
\n\
|
||||
load_infile\n\
|
||||
int, non-zero enables LOAD LOCAL INFILE, zero disables\n\
|
||||
\n\
|
||||
";
|
||||
|
||||
static PyObject *
|
||||
|
Reference in New Issue
Block a user