Package qm :: Module db :: Class Connection
[hide private]
[frames] | no frames]

Class Connection

source code

A wrapper around a DB 2.0 connection.

Provides a minimal but consistent interface to an underlying database connection. In particular, a 'Connection' quotes SQL queries as necessary for the underlying DB 2.0 connection.

Instance Methods [hide private]
 
__init__(self, module_name, *args, **more_args)
Uses the given DB 2.0 module to connect to a database.
source code
 
close(self) source code
 
commit(self) source code
 
rollback(self) source code
 
execute(self, sql)
Execute a SQL statement in this database.
source code
Method Details [hide private]

__init__(self, module_name, *args, **more_args)
(Constructor)

source code 

Uses the given DB 2.0 module to connect to a database.

'module_name' -- The DB 2.0-compliant module to use to connect, for example "pgdb".

'args' -- Positional arguments to pass to the module's 'connect' method.

'more_args' -- Keyword arguments to pass to the module's 'connect' method.

execute(self, sql)

source code 

Execute a SQL statement in this database.

If this database requires any overall quoting of the given SQL (for instance, doubling of %'s), it will be performed by this method.

returns -- A database cursor.