@@ -99,18 +99,18 @@ class Connection:
99
99
Establish a connection to the MySQL database. Accepts several
100
100
arguments:
101
101
102
- :param host: Host where the database server is located
103
- :param user: Username to log in as
102
+ :param host: Host where the database server is located.
103
+ :param user: Username to log in as.
104
104
:param password: Password to use.
105
105
:param database: Database to use, None to not use a particular one.
106
106
:param port: MySQL port to use, default is usually OK. (default: 3306)
107
107
:param bind_address: When the client has multiple network interfaces, specify
108
108
the interface from which to connect to the host. Argument can be
109
109
a hostname or an IP address.
110
- :param unix_socket: Optionally, you can use a unix socket rather than TCP/IP.
110
+ :param unix_socket: Optionally, a unix socket rather than TCP/IP can be used .
111
111
:param read_timeout: The timeout for reading from the connection in seconds (default: None - no timeout)
112
112
:param write_timeout: The timeout for writing to the connection in seconds (default: None - no timeout)
113
- :param charset: Charset you want to use.
113
+ :param charset: Charset to use.
114
114
:param sql_mode: Default SQL_MODE to use.
115
115
:param read_default_file:
116
116
Specifies my.cnf file to read these parameters from under the [client] section.
@@ -124,16 +124,15 @@ class Connection:
124
124
:param client_flag: Custom flags to send to MySQL. Find potential values in constants.CLIENT.
125
125
:param cursorclass: Custom cursor class to use.
126
126
:param init_command: Initial SQL statement to run when connection is established.
127
- :param connect_timeout: Timeout before throwing an exception when connecting .
127
+ :param connect_timeout: The timeout for connecting to the database in seconds .
128
128
(default: 10, min: 1, max: 31536000)
129
- :param ssl:
130
- A dict of arguments similar to mysql_ssl_set()'s parameters.
131
- :param ssl_ca: Path to the file that contains a PEM-formatted CA certificate
132
- :param ssl_cert: Path to the file that contains a PEM-formatted client certificate
133
- :param ssl_disabled: A boolean value that disables usage of TLS
134
- :param ssl_key: Path to the file that contains a PEM-formatted private key for the client certificate
135
- :param ssl_verify_cert: Set to true to check the validity of server certificates
136
- :param ssl_verify_identity: Set to true to check the server's identity
129
+ :param ssl: A dict of arguments similar to mysql_ssl_set()'s parameters.
130
+ :param ssl_ca: Path to the file that contains a PEM-formatted CA certificate.
131
+ :param ssl_cert: Path to the file that contains a PEM-formatted client certificate.
132
+ :param ssl_disabled: A boolean value that disables usage of TLS.
133
+ :param ssl_key: Path to the file that contains a PEM-formatted private key for the client certificate.
134
+ :param ssl_verify_cert: Set to true to check the server certificate's validity.
135
+ :param ssl_verify_identity: Set to true to check the server's identity.
137
136
:param read_default_group: Group to read from in the configuration file.
138
137
:param autocommit: Autocommit mode. None means use server default. (default: False)
139
138
:param local_infile: Boolean to enable the use of LOAD DATA LOCAL command. (default: False)
@@ -148,8 +147,8 @@ class Connection:
148
147
(if no authenticate method) for returning a string from the user. (experimental)
149
148
:param server_public_key: SHA256 authentication plugin public key value. (default: None)
150
149
:param binary_prefix: Add _binary prefix on bytes and bytearray. (default: False)
151
- :param compress: Not supported
152
- :param named_pipe: Not supported
150
+ :param compress: Not supported.
151
+ :param named_pipe: Not supported.
153
152
:param db: **DEPRECATED** Alias for database.
154
153
:param passwd: **DEPRECATED** Alias for password.
155
154
@@ -415,11 +414,11 @@ def close(self):
415
414
416
415
@property
417
416
def open (self ):
418
- """Return True if the connection is open"""
417
+ """Return True if the connection is open. """
419
418
return self ._sock is not None
420
419
421
420
def _force_close (self ):
422
- """Close connection without QUIT message"""
421
+ """Close connection without QUIT message. """
423
422
if self ._sock :
424
423
try :
425
424
self ._sock .close ()
@@ -448,7 +447,7 @@ def _read_ok_packet(self):
448
447
return ok
449
448
450
449
def _send_autocommit_mode (self ):
451
- """Set whether or not to commit after every execute()"""
450
+ """Set whether or not to commit after every execute(). """
452
451
self ._execute_command (
453
452
COMMAND .COM_QUERY , "SET AUTOCOMMIT = %s" % self .escape (self .autocommit_mode )
454
453
)
@@ -496,7 +495,7 @@ def select_db(self, db):
496
495
self ._read_ok_packet ()
497
496
498
497
def escape (self , obj , mapping = None ):
499
- """Escape whatever value you pass to it .
498
+ """Escape whatever value is passed .
500
499
501
500
Non-standard, for internal use; do not use this in your applications.
502
501
"""
@@ -510,7 +509,7 @@ def escape(self, obj, mapping=None):
510
509
return converters .escape_item (obj , self .charset , mapping = mapping )
511
510
512
511
def literal (self , obj ):
513
- """Alias for escape()
512
+ """Alias for escape().
514
513
515
514
Non-standard, for internal use; do not use this in your applications.
516
515
"""
@@ -530,9 +529,8 @@ def cursor(self, cursor=None):
530
529
"""
531
530
Create a new cursor to execute queries with.
532
531
533
- :param cursor: The type of cursor to create; one of :py:class:`Cursor`,
534
- :py:class:`SSCursor`, :py:class:`DictCursor`, or :py:class:`SSDictCursor`.
535
- None means use Cursor.
532
+ :param cursor: The type of cursor to create. None means use Cursor.
533
+ :type cursor: :py:class:`Cursor`, :py:class:`SSCursor`, :py:class:`DictCursor`, or :py:class:`SSDictCursor`.
536
534
"""
537
535
if cursor :
538
536
return cursor (self )
@@ -565,6 +563,8 @@ def ping(self, reconnect=True):
565
563
Check if the server is alive.
566
564
567
565
:param reconnect: If the connection is closed, reconnect.
566
+ :type reconnect: boolean
567
+
568
568
:raise Error: If the connection is closed and reconnect=False.
569
569
"""
570
570
if self ._sock is None :
0 commit comments