Home | Trees | Index | Help |
---|
object
--+ |connection
--+ | Connection
MySQL Database Connection Object
Method Summary | |
---|---|
Create a connection to the database. | |
__enter__(self)
| |
__exit__(self,
exc,
value,
tb)
| |
Explicitly begin a connection. | |
Create a cursor on which queries may be performed. | |
If cursor is not None, (errorclass, errorvalue) is appended to cursor.messages; otherwise it is appended to connection.messages. | |
If o is a single object, returns an SQL literal as a string. | |
Set the connection character set to charset. | |
Set the connection sql_mode. | |
Return detailed information about warnings as a sequence of tuples of (Level, Code, Message). | |
Inherited from connection | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
x.__repr__() <==> repr(x) | |
Return number of rows affected by the last query. | |
Set the autocommit mode. | |
Changes the user and causes the database specified by db to become the default (current) database on the connection specified by mysql. | |
Returns the default character set for the current connection. | |
Close the connection. | |
Commits the current transaction | |
Instructs the server to write some debug information to the log. | |
Returns the error code for the most recently invoked API function that can succeed or fail. | |
Returns the error message for the most recently invoked API function that can succeed or fail. | |
using mapping dict to provide quoting functions for each type. | |
Use connection.escape_string(s), if you use it at all. | |
Returns the number of columns for the most recent query on the connection. | |
Returns a dict with information about the current character set: | |
Returns a string that represents the MySQL client library version. | |
Returns an unsigned integer representing the protocol version used by the current connection. | |
Returns a string that represents the server version number. | |
Retrieves a string providing information about the most recently executed query. | |
Returns the ID generated for an AUTO_INCREMENT column by the previous query. | |
Asks the server to kill the thread specified by pid. | |
If more query results exist, next_result() reads the next query results and returns the status back to application. | |
Checks whether or not the connection to the server is working. | |
Execute a query. | |
Rolls backs the current transaction | |
Causes the database specified by db to become the default (current) database on the connection specified by mysql. | |
for the connection. | |
Asks the database server to shut down. | |
Returns a string containing the SQLSTATE error code for the last error. | |
Returns a character string containing information similar to that provided by the mysqladmin status command. | |
Returns a result object acquired by mysql_store_result (results stored in the client). | |
This means, any special SQL characters are escaped, and it is enclosed within single quotes. | |
Returns the thread ID of the current connection. | |
Returns a result object acquired by mysql_use_result (results stored in the server). | |
Returns the number of warnings generated during execution of the previous SQL statement. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
helper for pickle | |
helper for pickle | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Class Variable Summary | |
---|---|
type |
default_cursor = MySQLdb.cursors.Cursor |
classobj |
DatabaseError = _mysql_exceptions.DatabaseError |
classobj |
DataError = _mysql_exceptions.DataError |
classobj |
Error = _mysql_exceptions.Error |
classobj |
IntegrityError = _mysql_exceptions.IntegrityError |
classobj |
InterfaceError = _mysql_exceptions.InterfaceError |
classobj |
InternalError = _mysql_exceptions.InternalError |
classobj |
NotSupportedError = _mysql_exceptions.NotSupportedError |
classobj |
OperationalError = _mysql_exceptions.OperationalError |
classobj |
ProgrammingError = _mysql_exceptions.ProgrammingError |
classobj |
Warning = _mysql_exceptions.Warning |
Inherited from connection | |
member_descriptor |
client_flag = <member 'client_flag' of '_mysql.connectio...
|
member_descriptor |
converter = <member 'converter' of '_mysql.connection' o...
|
member_descriptor |
open = <member 'open' of '_mysql.connection' objects>
|
member_descriptor |
port = <member 'port' of '_mysql.connection' objects>
|
member_descriptor |
server_capabilities = <member 'server_capabilities' of '...
|
Method Details |
---|
Create a connection to the database. It is strongly recommended that you only use keyword parameters. Consult the MySQL C API documentation for more information.
There are a number of undocumented, non-standard methods. See the documentation for the MySQL C API for some hints on what they do.
_mysql.connection.__init__
Explicitly begin a connection. Non-standard. DEPRECATED: Will be removed in 1.3. Use an SQL BEGIN statement instead.
Create a cursor on which queries may be performed. The optional cursorclass parameter is used to create the Cursor. By default, self.cursorclass=cursors.Cursor is used.
If cursor is not None, (errorclass, errorvalue) is appended to cursor.messages; otherwise it is appended to connection.messages. Then errorclass is raised with errorvalue as the value.
You can override this with your own error handler by assigning it to the instance.
If o is a single object, returns an SQL literal as a string. If o is a non-string sequence, the items of the sequence are converted and returned as a sequence.
Non-standard. For internal use; do not use this in your applications.
Set the connection character set to charset. The character set can only be changed in MySQL-4.1 and newer. If you try to change the character set from the current value in an older version, NotSupportedError will be raised.
_mysql.connection.set_character_set
Set the connection sql_mode. See MySQL documentation for legal values.
Return detailed information about warnings as a sequence of tuples of (Level, Code, Message). This is only supported in MySQL-4.1 and up. If your server is an earlier version, an empty sequence is returned.
Home | Trees | Index | Help |
---|