IStream Class ReferenceIStream represents Object Input stream from Archive.
More...
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| virtual bool | get (CollectionFilterBase *pFilter, const char *pRootTable=NULL) |
| Get list of objects from database with its relations. | |
| virtual bool | get (Storeable *pObject, const char *pRootTable=NULL) |
| Get single Storeable derived object from database. | |
| virtual bool | getNext (Storeable *pObject)=0 |
| Get next object from stream. | |
| IStream () | |
| Constructor. | |
| virtual bool | updateVars ()=0 |
| Update binded vars without retrieving current object. | |
| virtual | ~IStream () |
| Destructor. | |
Protected Member Functions | |
| virtual void | setIdsCondition (const char *pFKeyName, id pRelationId, const std::vector< id > &pIds) |
| configure stream to open for records that have one of values from array in field named pFKeyName. | |
Detailed Description
IStream represents Object Input stream from Archive.IStream can be opened for any class that inherits from Storeable class. Notice that unlike Output stream, Input stream can be opened only for single class so you cannot get objects of different classes using getNext() from one stream. To do this, you have to reopen stream for new class that you want to load.
Before opening stream variables to additional columns can be binded. Then when stream is opened query is constructed and send (or data is prepared in other way if backend database is not SQL based database). You can get objects by creating empty object and calling get() on that object. After that object data members and all binded vars are updated by values from query result.
If you use getNext(), then there is also possibility to updateVars without updating object. This is useful if you are manually reconstructing referenced to other objects. Then you want to get variables first, find referenced objects and and then create object using getNext().
As getNext is useful when fetching single Storeable objects, you can use get() to load particular Storeable derived object and all subobjects that are specified using BIND_COL or BIND_CLA macros.
You can open stream by using Stream::open() method.
Member Function Documentation
| virtual bool get | ( | CollectionFilterBase * | pFilter, | |
| const char * | pRootTable = NULL | |||
| ) | [virtual] |
Get list of objects from database with its relations.
You should use adequate filter for given collection:
std::list<MyObject> lst; dba::IStream istream(archive->getIStream()); dba::stdList<MyObject> filter(lst); istream.get(&filter);
- Parameters:
-
pFilter CollectionFilter that contains Storeable object to modify pRootTable name of relation of root Storeable object passed to pFilter.
| virtual bool get | ( | Storeable * | pObject, | |
| const char * | pRootTable = NULL | |||
| ) | [virtual] |
Get single Storeable derived object from database.
If id of object is not set then random one is retrieved. Stream must not be open for any other object to call this method.
If pRootTable is specified then it overrides name of root table of last store table.
All objects in collections binded by BIND_COL are erased before collections are filled with database records.
- Parameters:
-
pObject object to retrieve pRootTable ovverided name of relation to retrieve from
| virtual bool getNext | ( | Storeable * | pObject | ) | [pure virtual] |
Get next object from stream.
- Parameters:
-
pObject object to be updated from stream
- Returns:
- true if object was retrieved or false if there is no more data in stream
Implemented in CSVIStream, and SQLIStream.
| virtual void setIdsCondition | ( | const char * | pFKeyName, | |
| id | pRelationId, | |||
| const std::vector< id > & | pIds | |||
| ) | [protected, virtual] |
configure stream to open for records that have one of values from array in field named pFKeyName.
Used by getChildren to retrieve reference data for BIND_COL collections.
- Parameters:
-
pFKeyName name of foreign key field pRelationId collection identification from BIND_CLA or Storeable::Invalid if not used pIds values of foreign key
| virtual bool updateVars | ( | ) | [pure virtual] |
Update binded vars without retrieving current object.
- Returns:
- true vars were updated or false if there is no more data in stream
Implemented in CSVIStream, and SQLIStream.
The documentation for this class was generated from the following file:
| Documentation |
|---|
| Quick start |
| Examples |
| API Documentation |
|---|
| Class hierarchy |
| Member index |
| API Reference |
| Store filters |
| Store table macros |
Generated by doxygen at Fri Oct 22 23:15:45 2010


