DBQueryTable of Contents

Entity-Relationship Database Package Query IteratorIntroductionPublic MethodsFetchUtility Methodsnew (internal)Entity-Relationship Database Package Query IteratorIntroductionThis package defines the Iteration object for an Entity-Relationship Database. The iteration objec represents a filtered SELECT statement against an Entity-Relationship Database, and provide methods for getting the appropriate records.

There are two common ways an iteration object can be created. An entity iterator is created when th client asks for objects of a given entity type. A relationship iterator is created when th client asks for objects across a relationship starting from a specific entity instance. Th entity iterator returns a single object at each position; the relationship iterator returns two objects at each position-- one for the target entity, and one for the relationship instanc that connects it to the source entity.

For example, a client could ask for all Feature instances that are marked active. This would return an entity iterator. Each position in the iteration would consist of a singl Feature instance. From a specific Feature instance, the client could decide to cross th IsLocatedIn relationship to get all the Contig instances which contain residues tha participate in the feature. This would return a relationship iterator. Each position in th iterator would contain a single IsLocatedIn instance and a single Contig instance.

At each point in the result set, the iterator returns a ERDBObject. The ERDBObject allows th client to access the fields of the current entity or relationship instance.

It is also possible to ask for many different objects in a single iterator by chaining lon sequences of entities together by relationships. This is discussed in the documentation for the ERDB object's Get method.

Finally, objects of this type should never by created directly. Instead, they are create by the aforementioned Get method and the ERDBObject's Cross method.

Public MethodsFetchmy $dbObject = $dbQuery->Fetch();

Retrieve a record from this query. The record returned will be a ERDBObject, whic may represent a single entity instance or a list of entity instances joined by relationships The first time this method is called it will return the first result from query. After that i will continue sequentially. It will return an undefined value if we've reached the end of th result set.

Utility Methodsnew (internal)Create a new query object.

This is a static method.

databaseERDB object for the relevant database.

sthStatement handle for the SELECT clause generated by the query.

relationMapReference to a list of 2-tuples. Each tuple consists of an object name as used in th query followed by the actual name of that object. This enables the ERDBObject t determine the order of the tables in the query and which object name belongs to eac mapped object name. Most of the time these two values are the same; however, fo particularly complex queries, a table may appear two or more times with a differen name each time.

searchObject (optional)If specified, then the query is a full-text search.