Package gnue :: Package common :: Package datasources :: Package drivers :: Package file :: Module inifile :: Class Connection
[show private | hide private]

Class Connection

Connection --+    
             |    
    Connection --+
                 |
                Connection


Connection class for INI style configuration file backends.
Method Summary
  __init__(self, *params, **kwargs)
  _commit_(self)
Commit pending changes in the backend (to be implemented by descendants).
  _delete_(self, table, oldfields)
Delete a record from the backend (to be implemented by descendants).
  _insert_(self, table, oldfields, newfields)
Insert a new record in the backend (to be implemented by descendants).
  _listFields_(self, table)
List all the field names available for a table.
  _loadFile_(self, filename, table)
Load data from a file.
  _rollback_(self)
Undo any uncommitted changes in the backend (to be implemented by descendants).
  _update_(self, table, oldfields, newfields)
Update an existing record in the backend.
    Inherited from Connection
  _listConstraints_(self, table)
List all available constraints for a table.
  _listIndices_(self, table)
List all available indices for a table.
  _listPrimaryKey_(self, table)
List the primary key for a table.
  _listTables_(self, filename)
List all the table names contained in the given file.
  _requery_(self, table, oldfields, fields)
Requery an existing record to reflect changes done by the backend (to be implemented by descendants).
    Inherited from Connection
  __repr__(self)
  _beginTransaction_(self)
Start a new transaction (to be implemented by descendants).
  _call_(self, table, oldfields, methodname, parameters)
Call a function of the backend (to be implemented by descendants).
  _close_(self)
Close the connection to the backend (to be implemented by descendants).
  _connect_(self, connectData)
Connect to the backend (to be implemented by descendants).
  _getLoginFields_(self)
Return information about the necessary login parameters for the connect method (to be implemented by descendants).
  _initialize_(self, table, fields)
Return default values for new records (can be overwritten by descendants).
  call(self, table, oldfields, methodname, parameters)
Call a function of the backend.
  close(self)
Close the connection to the backend.
  commit(self)
Commit pending changes in the backend and start a new transaction.
  connect(self, connectData)
Connect to the backend.
  createDatabase(self)
Create the database in the backend.
  delete(self, table, oldfields)
Delete a record from the backend.
  getLoginFields(self)
Return information about the necessary login parameters for the connect method.
  initialize(self, table, fields)
Return default values for new records.
  insert(self, table, oldfields, newfields)
Insert a new record in the backend.
  isPending(self)
Check whether there are changes that have been posted (via insert, update, or delete) but not yet committed.
  readSchema(self)
Return the schema information of the connection's backend or None if no behavior instance is available.
  requery(self, table, oldfields, fields)
Requery an existing record to reflect changes done by the backend.
  rollback(self)
Undo any uncommitted changes in the backend and start a new transaction.
  update(self, table, oldfields, newfields)
Update an existing record in the backend.
  writeSchema(self, schema, simulate)
Update the connection's backend database schema with the given schema object tree.

Instance Variable Summary
    Inherited from Connection
  manager: The connection manager (GConnections) instance responsible for this connection.
  name: Name of the connection from connections.conf.
  parameters: Parameters from connections.conf.

Class Variable Summary
NoneType _primarykeyFields_: Field names of the primary key.
    Inherited from Connection
NoneType _behavior_: Schema introspector class for this type of connection.
NoneType _defaultBehavior_: Standard schema introspector class for this type of connection.
bool _need_rollback_after_exception_: Can be set to False if the backend does not require to rollback after an exception has happened.
NoneType _resultSetClass_: implementation of the ResultSet class to be used with the connection.
NoneType _rowidField_: Field name of the rowid generated by the backend.

Method Details

__init__(self, *params, **kwargs)
(Constructor)

Overrides:
gnue.common.datasources.drivers.file.Base.Connection.__init__

_commit_(self)

Commit pending changes in the backend (to be implemented by descendants).

This method can be overwritten by the database drivers to commit data to the backend. If it is not overwritten, it does nothing.
Overrides:
gnue.common.datasources.drivers.Base.Connection.Connection._commit_ (inherited documentation)

_delete_(self, table, oldfields)

Delete a record from the backend (to be implemented by descendants).

Database drivers can overwrite this method to send removals of data records to the backend.
Parameters:
table - Table name.
oldfields - Fieldname/Value dictionary of fields to find the existing record (aka where-clause)
Overrides:
gnue.common.datasources.drivers.Base.Connection.Connection._delete_ (inherited documentation)

_insert_(self, table, oldfields, newfields)

Insert a new record in the backend (to be implemented by descendants).

Database drivers can overwrite this method to send new data records to the backend. If the backend supports rowids, the rowid of the newly inserted record must be returned from this method.
Parameters:
table - Table name.
oldfields - Fieldname/Value dictionary of fields to find the existing record (aka where-clause)
newfields - Fieldname/Value dictionary of data to insert.
Returns:
The rowid of the newly inserted record, or None if no rowid's are supported.
Overrides:
gnue.common.datasources.drivers.Base.Connection.Connection._insert_ (inherited documentation)

_listFields_(self, table)

List all the field names available for a table.

This function must return either None if there are no fields available, or a GSFields instance containing all fields. The GSFields instance must *not* have a parent.

Field names can be mixed case.

This method is used for introspection.
Parameters:
table - GSTable instance to get the fields for
Returns:
GSFields instance or None
Overrides:
gnue.common.datasources.drivers.file.Base.Connection._listFields_ (inherited documentation)

_loadFile_(self, filename, table)

Load data from a file.
Parameters:
filename - Filename
table - Table name (only useful if a file can contain more than one table)
Returns:
iterable object of fieldname/value dictionaries containing the records of the file. This object must implement __len__ ().
Overrides:
gnue.common.datasources.drivers.file.Base.Connection._loadFile_ (inherited documentation)

_rollback_(self)

Undo any uncommitted changes in the backend (to be implemented by descendants).

This can should be overwritten by the database drivers to abort and roll back any running transaction. If it is not overwritten, it does nothing.
Overrides:
gnue.common.datasources.drivers.Base.Connection.Connection._rollback_ (inherited documentation)

_update_(self, table, oldfields, newfields)

Update an existing record in the backend.

Database drivers can overwrite this method to send changes of existing data records to the backend (to be implemented by descendants).
Parameters:
table - Table name.
oldfields - Fieldname/Value dictionary of fields to find the existing record (aka where-clause)
newfields - Fieldname/Value dictionary of data to change.
Overrides:
gnue.common.datasources.drivers.Base.Connection.Connection._update_ (inherited documentation)

Class Variable Details

_primarykeyFields_

Field names of the primary key. Can be overwritten by descendants if the backend has a fixed fieldname for the primary key.
Type:
NoneType
Value:
['_section_name']                                                      


GNUe Home

Public API

Developer's Corner