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: