mysql.connection

Package mysql :: Module connection |
[hide private]
[frames] | no frames]

# Module connection

Connection object used to communicate with the MySQL server.

The Connection object is the basic primitive you use to connect to the MySQL server and communicate with it. You can issue queries directly with the Connection.execute method. Alternatively, you can call Connection.new_statement to use the statement API (see mysql.stmt for more detail).

MySQL is generally a state-based API. In other words, you can only do one thing at a time. For example, if you fetch results from a SELECT query with server-side buffering, you can have only 1 result set live per Connection object. In some situations you can work around this, by retrieving all results on the client-side, for example. If you try to create multiple "live" result objects, newer result objects will forcefully (and silently!) close previous result objects (rendering the old ones useless and will raise mysql.exceptions.Result_Closed_Error whenever accessed).

Various methods may indicate they raise mysql.exceptions.MySQL_Error. This is a generic error to indicate that there are various MySQL-related exceptions that may get raised. Some typical exceptions are:

- mysql.exceptions.Commands_Out_Of_Sync: Commands were executed in an improper order.
- mysql.exceptions.Out_Of_Memory: Out of memory.
- mysql.exceptions.Server_Gone_Error: The MySQL server has gone away.
- mysql.exceptions.Server_Lost: The connection to the server was lost during the query.
- mysql.exceptions.Unknown_Error: An unknown error occurred.
- mysql.exceptions.Unknown_Com_Error: The MySQL server doesn't implement this command (probably an old server).

Classes | [hide private]
`` | Character_Set Information about a character set.
`` | Connection MySQL connection object.
`` | _Statement_Cleaner Statement cleaning object.

Variables | [hide private]
`` | __version__ = `'$Revision: 1.9 $'`

Variables Details | [hide private]

    ### __version__ Value:
        '$Revision: 1.9 $'