IStream Class Reference
[Public API]

IStream represents Object Input stream from Archive. More...

#include <istream.h>

Inheritance diagram for IStream:

Inheritance graph
[legend]
Collaboration diagram for IStream:

Collaboration graph
[legend]
List of all members.

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);
For retrieving subset of data you should use setWherePart to set condition for retieval.
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 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

The documentation for this class was generated from the following file:

Documentation
Quick start
Examples
Search

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Sun Nov 9 02:08:22 2008