Debea Library 1.4.2

OStream Class Reference
[Public API]

OStream represents Object Stream to Archive. More...

#include <ostream.h>

Inheritance diagram for OStream:
Collaboration diagram for OStream:

List of all members.


Public Member Functions

virtual void assignId (Storeable *pObject)=0 throw (Exception)
 Assign object identifier.
virtual void begin ()=0
 Open stream. If stream is opened no vars can be binded anymore.
virtual void commit ()=0
 Commit all changes made to stream from point where begin() was called.
virtual void open (const char *pRootTable=NULL)
 Prepare stream to put Storeable objects in it.
 OStream ()
 Constructor.
virtual bool put (Storeable *pObject)
 Put object into stream and update all data from binded variables that are binded to rows in database that are affected by putting pObject.
virtual void rollback ()=0
 Cancel all changes to stream from point where begin() was called.
virtual ~OStream ()
 Destructor.

Protected Member Functions

virtual bool eraseChildren (const std::vector< id > &pRefData, Storeable &pObj, const char *pRootTableName)
 Erase all objects that are related to Storeable pObj object using BIND_COL entries in store table.
virtual bool putChildren (Storeable *pObject)
 Store all Storeable objects on sublists listed as BIND_COL in store table.
virtual bool putMemberChildren (Storeable *pObject, ColMemberEntry &pMember, CollectionFilterBase &pFilter, const char *pTableName)
 Default implementation for BIND_COL store that works on data stored in relations and linked using foreign keys.

Detailed Description

OStream represents Object Stream to Archive.

You can put any class that inherits from Storeable class into OStream.


Member Function Documentation

virtual void assignId ( Storeable pObject  )  throw (Exception) [pure virtual]

Assign object identifier.

Parameters:
pObject Object which id should be set. This object must not have its id set

virtual void begin (  )  [pure virtual]

Open stream. If stream is opened no vars can be binded anymore.

Create transaction on stream. Changes in database will be all commited only after calling close().

Implemented in CSVOStream, and SQLOStream.

virtual void commit (  )  [pure virtual]

Commit all changes made to stream from point where begin() was called.

Note:
You should use dba::Transaction object instead of calling this method

Implemented in CSVOStream, and SQLOStream.

virtual bool eraseChildren ( const std::vector< id > &  pRefData,
Storeable pObj,
const char *  pRootTableName 
) [protected, virtual]

Erase all objects that are related to Storeable pObj object using BIND_COL entries in store table.

Parameters:
pRefData list of object identifiers
pObj instance of object that will be erased. Used for extractiin ColTable recursively
pRootTableName altered name of root store table of pObj or NULL if root table was not altered

virtual void open ( const char *  pRootTable = NULL  )  [virtual]

Prepare stream to put Storeable objects in it.

If there is problem with object store then dba::DataException is thrown. If there is problem with database connection then dba::DatabaseExcption is thrown.

Parameters:
pRootTable new root relation name for each Storeable object that is put into stream. If NULL then \ name from store table is used
Returns:
true if at least one object was stored or erased in database, false if no store was performed (all objects are in OK state)

Reimplemented in CSVOStream, and SQLOStream.

virtual bool put ( Storeable pObject  )  [virtual]

Put object into stream and update all data from binded variables that are binded to rows in database that are affected by putting pObject.

Depending on state of pObject store, erase or update is called.

Note:
You should use dba::Transaction object instead of calling this method
Parameters:
pObject object to store

virtual bool putChildren ( Storeable pObject  )  [protected, virtual]

Store all Storeable objects on sublists listed as BIND_COL in store table.

Parameters:
pObject object that will be examined

virtual bool putMemberChildren ( Storeable pObject,
ColMemberEntry &  pMember,
CollectionFilterBase pFilter,
const char *  pTableName 
) [protected, virtual]

Default implementation for BIND_COL store that works on data stored in relations and linked using foreign keys.

For data formats that are not layed out in this kind of structures you should override this method providing different alghoritm

Parameters:
pObject pointer to root object
pMember member from collection table
pFilter filter that should be used to create instance of object
pTableName name of root relation
Returns:
true if at least one subobject object was stored in archive, false otherwise

virtual void rollback (  )  [pure virtual]

Cancel all changes to stream from point where begin() was called.

Note:
You should use dba::Transaction object instead of calling this method

Implemented in CSVOStream, and SQLOStream.


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
Back

Generated by doxygen at Fri Oct 22 23:15:45 2010