4.11.1Class DataManager

Base data manager. This is just an abstract class of definitions to be implemented by the real data managers.

Class DataManager( name, location )
Methods
addEntityPuts an entity in the data manager.
configureConfigure this data manager.
countCount records from an entity.
createCreate the database.
createDBCreates the physical underlying DatabaseResource.
createEntityCreates an entity in the database. Called back by DataManager.create.
deleteModifies the values of an entity in the database.
entityLoads an entity definition.
insertInserts a new item in the data pool.
queryQuery multiple records from an entity.
queryItemQuery an entity -- for a single item.
updateModifies the values of an entity in the database.

Methods

addEntity

Puts an entity in the data manager.

addEntity( Entity, entity )
Entity an instance to be added.

configure

Configure this data manager.

configure( vars )
vars an array of variables to be configured.
Raise
CodeError if the configuration is not coherent with the type of data manager.

The subclasses must override this mehtod.

count

Count records from an entity.

count( entity, view )
entity The entity to be queried.
view A field list or DBView eventually filtering this count

The subclasses must override this mehtod.

create

Create the database.

create( cond )
cond True if the database should be created only if not found (conditional), false to re-create it.

This performs a self.createDB( cond ) call right after loading all the entities, and then invokes create() onthe entities in the right order.

So, the upstream DB manager should be re-implementing the createDB method to create a new empty DB.

createDB

Creates the physical underlying DatabaseResource.

createDB( cond )
cond if true should create the database only if not alredy existing.

The subclasses must override this mehtod.

createEntity

Creates an entity in the database. Called back by DataManager.create.

createEntity( entity, cond )
entity The DBEntity to be created in the database.
cond True to create only if the entity doesn't exist.

delete

Modifies the values of an entity in the database.

delete( entity, data, eid )
entity The entity to be added.
data A dictionary of data to be stored.
ReturnThe new entity ID.

The subclasses must override this mehtod.

entity

Loads an entity definition.

entity( ename )
ename The name of the entity to be loaded.

insert

Inserts a new item in the data pool.

insert( entity, data )
entity The entity to be added.
data A dictionary of data to be stored.
ReturnThe new entity ID.

The subclasses must override this mehtod.

query

Query multiple records from an entity.

query( entity, view, start, count )
entity The entity to be queried.
view A field list or DBView configuring this query (nil for all).
start Start after N fetched records (nil for 0).
count Get N records in the returned data (nil for all).
ReturnAn array of DBRecord entity containing the retreived data.

The view parameter can be an array of field names that should be retrieved from this entity, or a View that will select just part of the elements.

The subclasses must override this mehtod.

queryItem

Query an entity -- for a single item.

queryItem( entity, key_fields, view )
entity The entity to be queried.
key_fields The ID of the entity to retreive.
view A view shaping the fields to be retreived (or nil)
ReturnA DBRecord entity containing the retreived data.

The subclasses must override this mehtod.

update

Modifies the values of an entity in the database.

update( entity, data, eid )
entity The entity to be added.
data A dictionary of data to be stored.
ReturnThe new entity ID.

The subclasses must override this mehtod.

Made with http://www.falconpl.org