Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

DBOBJSetStreamer Class Reference

#include <dbobjsetstreamer.hpp>

Inheritance diagram for DBOBJSetStreamer:

Inheritance graph
[legend]
Collaboration diagram for DBOBJSetStreamer:

Collaboration graph
[legend]
List of all members.

Detailed Description

Implements a XMLStreamBuffer using temporary files.

Definition at line 74 of file dbobjsetstreamer.hpp.

Public Methods

 DBOBJSetStreamer (const XMLStreamerFactory *p_pParent, StreamerParams *p_pParameters, XMLFlowContext *p_pContext, XMLStreamConsumer *p_pOutput)
 ~DBOBJSetStreamer ()
 Destructor. Releases private data members.

bool initStream ()
 Stream beginning notifier.
This function is called before receiving any byte of the input XML stream. It should performs init tasks.


void writeData (const char *p_pszData, unsigned int p_uiDataLen)
 XML Stream reception function.
This function is called to write input XML stream to the Streamer.


bool commitStream (bool p_fFinal=false)
 xML Stream commit function.
This function is called to commit a chunk or the whole of the input XML stream.
A partial commit means that the data provided since last commit is OK for processing.
A final commit means that the whole input stream has been provided and that the streamer should consider the input XML document as complete.


virtual void makeReport ()
 Called after request processing.

virtual bool transformObject (DBObjectNode *p_pDBObjectNode)
 Transforms object and returns TRUE if it is to be mapped on DB.

virtual void processObject (DBObjectNode *p_pDBObjectNode)
 Builds mapping SQL statements for given object, stacks it and launches SQL execution if pack is full. If no object is provided, lauches mapping for left stacked objects.

virtual void commitObjects ()
void rollBackObjects ()

Protected Methods

void processNode (DBObjectNode *p_pDBObjectNode, DBOBJSetAction p_intParentAction)
void sendNodeToDB (DBObjectNode *p_pDBObjectNode, DBOBJSetAction l_iCurAction)
void sendRecordToDB (DBObjectNode *p_pDBObjectNode, otl_stream *p_pOTLStream, const char *p_pszFieldList, int p_iDescLen, otl_var_desc *p_varsDesc)
bool buildINSERTStatement (DBObjectNode *p_pDBObjectNode, char **l_ppszStatement, char **l_ppszFields)
 Builds INSERT SQL statement corresponding to the provided node.

bool buildUPDATEStatement (DBObjectNode *p_pDBObjectNode, char **l_ppszStatement, char **l_ppszFields)
 Builds UPDATE SQL statement corresponding to the provided node.

bool buildDELETEStatement (DBObjectNode *p_pDBObjectNode, char **l_ppszStatement, char **l_ppszFields)
 Builds DELETE SQL statement corresponding to the provided node.

bool buildWHEREclause (DBObjectNode *p_pDBObjectNode, char **l_ppszStatement, char **l_ppszFields)
 Builds WHERE clause to modify the provided node.

bool buildCHECKStatement (DBObjectNode *p_pDBObjectNode, char **l_ppszStatement, char **l_ppszFields, bool p_boolPre)
 Builds check SQL statements given by the provided node's definition.

bool buildEventStatement (DBObjectNode *p_pDBObjectNode, const char *l_pszEnventString, char **l_ppszStatement, char **l_ppszFields)
char * getSQLInsert (DBObjectField *l_pDBObjectField, bool *p_pfCachable, char **p_ppszFields)
char * getFieldValue (DBObjectField *p_pDBObjectField)
 Extract field value.

char * getFieldBindVar (DBObjectField *l_pDBObjectField)
void stackObject (DBObjectNode *p_pDBObjectNode)
 Stacks an object.

void deStackObjects (XMLStreamConsumer *p_pBufferXML, bool l_fCount)
 Destacks objects and serializes them in given buffer.

void countObjectNodes (DBObjectNode *p_pDBObjectNode)
 Count the number of ecach node type in the given object.


Protected Attributes

StreamSAX2Parserm_pStreamParser
XDFLSaxErrorReporterm_pErrorReporter
DBStreamerFactorym_pParent
DBObjectSAXBuilderm_pHandler


Constructor & Destructor Documentation

BEGIN_XDFLENGINE_NS DBOBJSetStreamer::DBOBJSetStreamer const XMLStreamerFactory   p_pParent,
StreamerParams   p_pParameters,
XMLFlowContext   p_pContext,
XMLStreamConsumer   p_pOutput
 

Definition at line 57 of file dbobjsetstreamer.cpp.

References DEBUG_CREATE, m_pErrorReporter, m_pHandler, and m_pStreamParser.

DBOBJSetStreamer::~DBOBJSetStreamer  
 

Destructor. Releases private data members.

Definition at line 73 of file dbobjsetstreamer.cpp.

References DEBUG_DEL, DEBUG_ECHO, VAarray< int >::empty(), VAarray< stream_cache * >::empty(), VAarray< DBObjectNode * >::empty(), _stream_cache::fieldList, XMLFlowContext::getThreadId(), m_pErrorReporter, m_pHandler, m_pParent, m_pStreamParser, OTL_releaseDataStream(), _stream_cache::otlStream, VAarray< int >::pop(), VAarray< stream_cache * >::pop(), VAarray< DBObjectNode * >::pop(), releaseCharBuffer(), and _stream_cache::varDesc.


Member Function Documentation

bool DBOBJSetStreamer::buildCHECKStatement DBObjectNode   p_pDBObjectNode,
char **    l_ppszStatement,
char **    l_ppszFields,
bool    p_boolPre
[protected]
 

Builds check SQL statements given by the provided node's definition.

Parameters:
p_pDBObjectNode (DBObjectNode*) Node to map.
p_boolPre (bool) if true, generates the check_pre statement, else the check_post statement.
Returns:
(string) statement.

Definition at line 966 of file dbobjsetstreamer.cpp.

References buildEventStatement(), DEBUG_FUNC, DBOBJDefinitionNode::getCheckPost(), DBOBJDefinitionNode::getCheckPre(), and DBObjectNode::getDefinition().

Referenced by sendNodeToDB().

bool DBOBJSetStreamer::buildDELETEStatement DBObjectNode   p_pDBObjectNode,
char **    l_ppszStatement,
char **    l_ppszFields
[protected]
 

Builds DELETE SQL statement corresponding to the provided node.

Parameters:
p_pDBObjectNode (DBObjectNode*) Node to map.
Returns:
(string) statement.

Definition at line 879 of file dbobjsetstreamer.cpp.

References buildEventStatement(), buildWHEREclause(), concatCharBuffer(), copyCharBuffer(), DEBUG_IN, DEBUG_OUT, DBOBJDefinitionNode::getDBTable(), DBObjectNode::getDefinition(), DBOBJDefinitionNode::getOnDelete(), and releaseCharBuffer().

Referenced by sendNodeToDB().

bool DBOBJSetStreamer::buildEventStatement DBObjectNode   p_pDBObjectNode,
const char *    l_pszEnventString,
char **    l_ppszStatement,
char **    l_ppszFields
[protected]
 

Definition at line 981 of file dbobjsetstreamer.cpp.

References DBObjectNode::calculateRelValue(), and releaseCharBuffer().

Referenced by buildCHECKStatement(), buildDELETEStatement(), buildINSERTStatement(), and buildUPDATEStatement().

bool DBOBJSetStreamer::buildINSERTStatement DBObjectNode   p_pDBObjectNode,
char **    l_ppszStatement,
char **    l_ppszFields
[protected]
 

Builds INSERT SQL statement corresponding to the provided node.

Parameters:
p_pDBObjectNode (DBObjectNode*) Node to map.
Returns:
(string) statement.

Definition at line 731 of file dbobjsetstreamer.cpp.

References buildEventStatement(), concatCharBuffer(), copyCharBuffer(), DEBUG_IN, DEBUG_OUT, DBOBJDefinitionField::getDBField(), DBOBJDefinitionNode::getDBTable(), DBObjectField::getDefinition(), DBObjectNode::getDefinition(), DBObjectNode::getField(), DBOBJDefinitionNode::getField(), DBOBJDefinitionNode::getFieldsCount(), DBOBJDefinitionField::getName(), DBOBJDefinitionNode::getOnInsert(), getSQLInsert(), and releaseCharBuffer().

Referenced by sendNodeToDB().

bool DBOBJSetStreamer::buildUPDATEStatement DBObjectNode   p_pDBObjectNode,
char **    l_ppszStatement,
char **    l_ppszFields
[protected]
 

Builds UPDATE SQL statement corresponding to the provided node.

Parameters:
p_pDBObjectNode (DBObjectNode*) Node to map.
Returns:
(string) statement.

Definition at line 806 of file dbobjsetstreamer.cpp.

References buildEventStatement(), buildWHEREclause(), concatCharBuffer(), copyCharBuffer(), DEBUG_IN, DEBUG_OUT, DBOBJDefinitionField::getDBField(), DBOBJDefinitionNode::getDBTable(), DBObjectNode::getDefinition(), DBObjectNode::getField(), DBOBJDefinitionNode::getField(), DBOBJDefinitionNode::getFieldsCount(), DBOBJDefinitionField::getName(), DBOBJDefinitionNode::getOnUpdate(), getSQLInsert(), DBOBJDefinitionField::isPkey(), and releaseCharBuffer().

Referenced by sendNodeToDB().

bool DBOBJSetStreamer::buildWHEREclause DBObjectNode   p_pDBObjectNode,
char **    l_ppszStatement,
char **    l_ppszFields
[protected]
 

Builds WHERE clause to modify the provided node.

Parameters:
p_pDBObjectNode (DBObjectNode*) Node to map.
Returns:
(string) statement.

Definition at line 917 of file dbobjsetstreamer.cpp.

References concatCharBuffer(), DEBUG_IN, DEBUG_OUT, DBOBJDefinitionField::getDBField(), DBObjectNode::getDefinition(), DBObjectNode::getField(), DBOBJDefinitionField::getName(), DBOBJDefinitionNode::getPkey(), DBOBJDefinitionNode::getPkeysCount(), getSQLInsert(), and releaseCharBuffer().

Referenced by buildDELETEStatement(), and buildUPDATEStatement().

void DBOBJSetStreamer::commitObjects   [virtual]
 

Definition at line 392 of file dbobjsetstreamer.cpp.

References DBOBJSETSTREAMER_TAGNAME, DEBUG_IN, DEBUG_OUT, deStackObjects(), rollBackObjects(), VAarray< DBObjectNode * >::size(), and THROW_XMLFLOW_EXCEPTION.

Referenced by commitStream(), and processObject().

bool DBOBJSetStreamer::commitStream bool    p_fFinal = false [virtual]
 

xML Stream commit function.
This function is called to commit a chunk or the whole of the input XML stream.
A partial commit means that the data provided since last commit is OK for processing.
A final commit means that the whole input stream has been provided and that the streamer should consider the input XML document as complete.

Reimplemented from XMLStreamer.

Definition at line 223 of file dbobjsetstreamer.cpp.

References CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN, commitObjects(), XMLStreamConsumer::commitStream(), DBOBJSETSTREAMER_TAGNAME, DEBUG_IN, DEBUG_OUT, DBObjectSAXBuilder::getObjectsCount(), m_pHandler, XMLStreamer::m_pOutput, m_pStreamParser, makeReport(), ON_XML_FLOW_ERROR_THROW, DBObjectSAXBuilder::popObject(), PREP_CATCH_XML_FLOW_ERROR, processObject(), and WATCH_XML_FLOW_ERROR.

void DBOBJSetStreamer::countObjectNodes DBObjectNode   p_pDBObjectNode [protected]
 

Count the number of ecach node type in the given object.

Parameters:
p_pDBObjectNode (DBOBJectNode*) Root object to count the nodes in.

Definition at line 1235 of file dbobjsetstreamer.cpp.

References VAarray< int >::add(), concatCharBuffer(), DBObjectNode::getAction(), DBObjectNode::getChildNode(), DBObjectNode::getChildNodesCount(), DBObjectNode::getName(), releaseCharBuffer(), VAarray< int >::remove(), and DBObjectSAXBuilder::translateAction().

Referenced by deStackObjects().

void DBOBJSetStreamer::deStackObjects XMLStreamConsumer   p_pBufferXML,
bool    l_fCount
[protected]
 

Destacks objects and serializes them in given buffer.

Parameters:
p_pBufferXML (XMLStreamBuffer*) XML buffer .

Definition at line 1201 of file dbobjsetstreamer.cpp.

References VAarray< DBObjectNode * >::bottom(), XMLStreamConsumer::commitStream(), countObjectNodes(), DBOBJSETSTREAMER_TAGNAME, DEBUG_FUNC, VAarray< DBObjectNode * >::empty(), DBObjectNode::getXML(), XMLStreamer::m_pOutput, and VAarray< DBObjectNode * >::remove().

Referenced by commitObjects(), and rollBackObjects().

char * DBOBJSetStreamer::getFieldBindVar DBObjectField   l_pDBObjectField [protected]
 

Definition at line 1125 of file dbobjsetstreamer.cpp.

References concatCharBuffer(), DEBUG_FUNC, DBOBJDefinitionField::getDateFormat(), DBOBJDefinitionField::getDBSpecProps(), DBObjectField::getDefinition(), DBOBJDefinitionField::getMap(), DBObjectField::getName(), DBStreamerFactory::getSQLSyntax(), DBOBJDefinitionField::isAttribute(), OTL_getColumBindType(), releaseCharBuffer(), SQL_SYNTAX_MSSQL, and SQL_SYNTAX_ORA.

Referenced by getSQLInsert().

char * DBOBJSetStreamer::getFieldValue DBObjectField   p_pDBObjectField [protected]
 

Extract field value.

Parameters:
p_pDBObjectField (DBObjectField*) Field to get value from.

Definition at line 1067 of file dbobjsetstreamer.cpp.

References concatCharBuffer(), copyCharBuffer(), DEBUG_FUNC, DBOBJDefinitionField::getDateFormat(), DBObjectField::getDefinition(), DBOBJDefinitionField::getMap(), DBObjectField::getValue(), releaseCharBuffer(), and replaceInCharBuffer().

Referenced by getSQLInsert().

char * DBOBJSetStreamer::getSQLInsert DBObjectField   l_pDBObjectField,
bool *    p_pfCachable,
char **    p_ppszFields
[protected]
 

Definition at line 1036 of file dbobjsetstreamer.cpp.

References concatCharBuffer(), getFieldBindVar(), getFieldValue(), and DBObjectField::getName().

Referenced by buildINSERTStatement(), buildUPDATEStatement(), and buildWHEREclause().

bool DBOBJSetStreamer::initStream   [virtual]
 

Stream beginning notifier.
This function is called before receiving any byte of the input XML stream. It should performs init tasks.

Returns:
Not used, should return TRUE.

Reimplemented from XMLStreamer.

Definition at line 120 of file dbobjsetstreamer.cpp.

References DBOBJaction_Delete, DBOBJaction_Insert, DBOBJaction_None, DBOBJaction_Update, DBObjectSAXBuilder, DEBUG_IN, DEBUG_OUT, XMLFlowContext::getNamedBuffer(), XMLStreamer::getParamValue(), XMLFlowContext::getThreadId(), importCharBuffer(), m_pErrorReporter, m_pHandler, XMLStreamer::m_pOutput, m_pParent, and m_pStreamParser.

void DBOBJSetStreamer::makeReport   [virtual]
 

Called after request processing.

Definition at line 282 of file dbobjsetstreamer.cpp.

References VAarray< int >::get(), VAarray< int >::getKey(), VAarray< int >::remove(), and VAarray< int >::size().

Referenced by commitStream().

void DBOBJSetStreamer::processNode DBObjectNode   p_pDBObjectNode,
DBOBJSetAction    p_intParentAction
[protected]
 

Definition at line 441 of file dbobjsetstreamer.cpp.

References DBOBJaction_Delete, DBOBJaction_None, DBOBJSetAction, DEBUG_IN, DEBUG_OUT, DBObjectNode::getAction(), DBObjectNode::getCurrentChild(), DBObjectNode::getDefinition(), DBOBJDefinitionNode::isLocked(), DBObjectNode::moveFirstChild(), DBObjectNode::moveLastChild(), DBObjectNode::moveNextChild(), DBObjectNode::movePreviousChild(), and sendNodeToDB().

Referenced by processObject().

void DBOBJSetStreamer::processObject DBObjectNode   p_pDBObjectNode [virtual]
 

Builds mapping SQL statements for given object, stacks it and launches SQL execution if pack is full. If no object is provided, lauches mapping for left stacked objects.

Parameters:
p_pDBObjectNode (DBObjectNode*) Object to map to DB

Definition at line 327 of file dbobjsetstreamer.cpp.

References CATCH_XML_FLOW_ERROR, commitObjects(), DEBUG_FUNC, XMLValuable::getValuer(), PREP_CATCH_XML_FLOW_ERROR, processNode(), rollBackObjects(), DBObjectNode::setValuable(), stackObject(), transformObject(), and WATCH_XML_FLOW_ERROR.

Referenced by commitStream().

void DBOBJSetStreamer::rollBackObjects  
 

Definition at line 422 of file dbobjsetstreamer.cpp.

References DBOBJSETSTREAMER_TAGNAME, deStackObjects(), and VAarray< DBObjectNode * >::size().

Referenced by commitObjects(), and processObject().

void DBOBJSetStreamer::sendNodeToDB DBObjectNode   p_pDBObjectNode,
DBOBJSetAction    l_iCurAction
[protected]
 

Definition at line 493 of file dbobjsetstreamer.cpp.

References VAarray< stream_cache * >::add(), buildCHECKStatement(), buildDELETEStatement(), buildINSERTStatement(), buildUPDATEStatement(), CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN, concatCharBuffer(), copyCharBuffer(), DBOBJaction_CheckPost, DBOBJaction_CheckPre, DBOBJaction_Delete, DBOBJaction_Insert, DBOBJaction_Update, DEBUG_IN, DEBUG_OUT, _stream_cache::descLen, _stream_cache::fieldList, VAarray< stream_cache * >::get(), DBObjectNode::getName(), MAKE_XMLFLOW_EXCEPTION, ON_XML_FLOW_ERROR_THROW, OTL_openDataStream(), OTL_releaseDataStream(), _stream_cache::otlStream, PREP_CATCH_XML_FLOW_ERROR, releaseCharBuffer(), sendRecordToDB(), _stream_cache::varDesc, and WATCH_XML_FLOW_ERROR.

Referenced by processNode().

void DBOBJSetStreamer::sendRecordToDB DBObjectNode   p_pDBObjectNode,
otl_stream *    p_pOTLStream,
const char *    p_pszFieldList,
int    p_iDescLen,
otl_var_desc *    p_varsDesc
[protected]
 

Definition at line 631 of file dbobjsetstreamer.cpp.

References copyCharBuffer(), DEBUG_IN, DEBUG_OUT, DBObjectNode::getName(), DBObjectField::getValue(), MAKE_XMLFLOW_EXCEPTION, ON_XML_FLOW_ERROR_THROW, OTL_insertInVar(), PREP_CATCH_XML_FLOW_ERROR, releaseCharBuffer(), and DBObjectNode::selectSingleNode().

Referenced by sendNodeToDB().

void DBOBJSetStreamer::stackObject DBObjectNode   p_pDBObjectNode [protected]
 

Stacks an object.

Parameters:
p_pDBObjectNode (DBObjectNode*) Root node of the object to stack.

Definition at line 1191 of file dbobjsetstreamer.cpp.

References DEBUG_FUNC, and VAarray< DBObjectNode * >::push().

Referenced by processObject().

bool DBOBJSetStreamer::transformObject DBObjectNode   p_pDBObjectNode [virtual]
 

Transforms object and returns TRUE if it is to be mapped on DB.

Parameters:
p_pDBObjectNode (DBObjectNode*) Root node of the object to tranform.
Returns:
(bool) TRUE if the object is to be mapped to DB.

Definition at line 382 of file dbobjsetstreamer.cpp.

References DEBUG_FUNC.

Referenced by processObject().

void DBOBJSetStreamer::writeData const char *    p_pszData,
unsigned int    p_uiDataLen
[virtual]
 

XML Stream reception function.
This function is called to write input XML stream to the Streamer.

Parameters:
p_pszData XML stream chunk.
p_uiDataLen XML stream chunk length.

Reimplemented from XMLStreamer.

Definition at line 210 of file dbobjsetstreamer.cpp.

References DEBUG_IN, DEBUG_OUT, and m_pStreamParser.


Member Data Documentation

XDFLSaxErrorReporter* DBOBJSetStreamer::m_pErrorReporter [protected]
 

Definition at line 110 of file dbobjsetstreamer.hpp.

Referenced by DBOBJSetStreamer(), initStream(), and ~DBOBJSetStreamer().

DBObjectSAXBuilder* DBOBJSetStreamer::m_pHandler [protected]
 

Definition at line 112 of file dbobjsetstreamer.hpp.

Referenced by commitStream(), DBOBJSetStreamer(), initStream(), and ~DBOBJSetStreamer().

DBStreamerFactory* DBOBJSetStreamer::m_pParent [protected]
 

Reimplemented from XMLStreamer.

Definition at line 111 of file dbobjsetstreamer.hpp.

Referenced by initStream(), and ~DBOBJSetStreamer().

StreamSAX2Parser* DBOBJSetStreamer::m_pStreamParser [protected]
 

Definition at line 109 of file dbobjsetstreamer.hpp.

Referenced by commitStream(), DBOBJSetStreamer(), initStream(), writeData(), and ~DBOBJSetStreamer().


The documentation for this class was generated from the following files:
Generated on Sat Oct 4 13:23:50 2003 for XDFLengine by doxygen1.3-rc2