Home | Trees | Indices | Help |
|
---|
|
Version: $Revision: 1.90 $
Author: H.Herb <hherb@gnumed.net>, I.Haywood <i.haywood@ugrad.unimelb.edu.au>, K.Hilbert <Karsten.Hilbert@gmx.net>
License: GPL v2 or later (details at http://www.gnu.org)
Classes | |
ConnectionPool maintains a static dictionary of available database connections |
Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Variables | |
tz = time.timezone
|
|
QTablePrimaryKeyIndex =
|
|
query_pkey_name =
|
|
query_fkey_names =
|
|
query_table_col_defs = """sel
|
|
query_table_attributes = """sel
|
|
query_child_tables =
|
|
last_ro_cursor_desc = None
|
Imports: sys
Function Details |
Convenience function for running a transaction that is supposed to get committed. <link_obj> can be either: - a cursor - a connection - a service name <queries> is a list of (query, [args]) tuples to be executed as a single transaction, the last query may usefully return rows (such as a "select currval('some_sequence')" statement) <end_tx> - controls whether the transaction is finalized (eg. committed/rolled back) or not, this allows the call to run_commit2() to be part of a framing transaction - if <link_obj> is a service name the transaction is always finalized regardless of what <end_tx> says - if link_obj is a connection then <end_tx> will default to False unless it is explicitly set to True which is taken to mean "yes, you do have full control over the transaction" in which case the transaction is properly finalized <max_tries> - controls the number of times a transaction is retried after a concurrency error - note that *all* <queries> are rerun if a concurrency error occurrs - max_tries is honored if and only if link_obj is a service name such that we have full control over the transaction <get_col_idx> - if true, the returned data will include a dictionary mapping field names to column positions - if false, the returned data returns an empty dict method result: - returns a tuple (status, data) - <status>: * True - if all queries succeeded (also if there were 0 queries) * False - if *any* error occurred - <data> if <status> is True: * (None, {}) if last query did not return rows * ("fetchall() result", <index>) if last query returned any rows * for <index> see <get_col_idx> - <data> if <status> is False: * a tuple (error, message) where <error> can be: * 1: unspecified error * 2: concurrency error * 3: constraint violation (non-primary key) * 4: access violation |
Convenience function for running a transaction that is supposed to get committed. - link_obj can be - a cursor: rollback/commit must be done by the caller - a connection: rollback/commit is handled - a service name: rollback/commit is handled - queries is a list of (query, [args]) tuples - executed as a single transaction - returns: - a tuple (<value>, error) if return_err_msg is True - a scalar <value> if return_err_msg is False - <value> will be - None: if any query failed - 1: if all queries succeeded (also 0 queries) - data: if the last query returned rows |
Runs a read-only query. - link_obj can be a service name, connection or cursor object - return status: - return data if get_col_idx is False - return (data, idx) if get_col_idx is True - if query fails: data is None - if query is not a row-returning SQL statement: data is None - data is a list of tuples [(w,x,y,z), (a,b,c,d), ...] where each tuple is a table row - idx is a map of column name to their position in the row tuples e.g. { 'name': 3, 'id':0, 'job_description': 2, 'location':1 } usage: e.g. data[0][idx['name']] would return z from [(w,x,y,z ),(a,b,c,d)] |
Returns a dictionary of referenced foreign keys. key = column name of this table value = (referenced table name, referenced column name) tuple |
Variables Details |
QTablePrimaryKeyIndex
|
query_pkey_name
|
query_fkey_names
|
query_table_col_defs
|
query_table_attributes
|
query_child_tables
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Aug 3 03:55:54 2013 | http://epydoc.sourceforge.net |