Class HelperRowCreator.

Inherits EventHandler. Inherited by AddressCreator, AnnotationNameCreator, FieldNameCreator and FlagCreator.

The HelperRowCreator class contains common logic and some code to add rows to the helper tables flag_names, annotation_names and header_fields. It's inherited by one class per table.

In theory this could handle bodyparts and addresses, but I think not. Those are different. Those tables grow to be big. These three tables frequently contain less than one row per thousand messages, so we need to optimise this class for inserting zero, one or at most a few rows.

HelperRowCreator::HelperRowCreator( const EString & table, Transaction * transaction, const EString & constraint )

Constructs an empty HelperRowCreator refering to table, using transaction. If an error related to constraint occurs, execute() will roll back to a savepoint and try again.

void HelperRowCreator::add( const EString & s, uint id )

Remembers that the given name s corresponds to the id.

bool HelperRowCreator::done() const

Returns true if this object is done with the Transaction, and false if it will use the Transaction for one or more queries.

uint HelperRowCreator::id( const EString & s )

Returns the id stored earlier with add() for the name s.

bool HelperRowCreator::inserted() const

Returns true if this creator inserted at least one row, and false if lookup alone was enough to do the work.

Query * HelperRowCreator::makeCopy()

This pure virtual function is called to make a query to insert the necessary rows to the table.

If nothing needs to be inserted, makeCopy() can return 0.

If makeCopy() returns non-null, the returned Query should have this object as owner.

Query * HelperRowCreator::makeSelect()

This pure virtual function is called to make a query to return the IDs of rows already in the database, or of newly inserted rows.

If nothing needs to be done, the makeSelect() can return a null pointer.

If makeSelect() returns non-null, the returned Query should have this object as owner.

void HelperRowCreator::processSelect( Query * q )

This virtual function is called to process the result of the makeSelect() Query. q is the Query returned by makeSelect() (never 0).

This web page based on source code belonging to The Archiveopteryx Developers. All rights reserved.