Package CHEM :: Package DB :: Module BaseDBPopulator :: Class RowInserter
[hide private]
[frames] | no frames]

Class RowInserter



BaseProcessor --+
                |
               RowInserter

Assume the objects data to insert has all been set, including any parent foreign key IDs. Need to know what are the key columns in the object to identify it uniquely in the database. Inserts the respective record in the database if one with the same key column values does not already exist. The objects id column field will receive the new (or existing) value and the isNew attribute will be set to indicate whether it was just inserted or a record already existed.

Instance Methods [hide private]
 
__init__(self, conn, tableName, keyColumns, forceUpdate=False)
Constructor needs to know the key columns in the object to identify it uniquely in the database.
 
process(self, parentObj, currObj)
Method Details [hide private]

__init__(self, conn, tableName, keyColumns, forceUpdate=False)
(Constructor)

 

Constructor needs to know the key columns in the object to identify it uniquely in the database. May be a list / tuple of more than one key column for composite identifiers.

Pass on forceUpdate parameter to findOrInsertItem function to force an update even if the row already exists, instead of skipping it.
Overrides: BaseProcessor.__init__

process(self, parentObj, currObj)

 
Overrides: BaseProcessor.process