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

dbobjgetstatement.cpp

Go to the documentation of this file.
00001 //============================================================================= 
00002 //
00003 // XDFLengine library
00004 //
00005 //-----------------------------------------------------------------------------
00006 //  DBOBJGETSTATEMENT.CPP
00007 //----------------------------------------------------------------------------- 
00013 //_____________________________________________________________________________
00014 //
00015 //  Copyright (C) 2003 Guillaume Baurand. All Rights Reserved.
00016 //
00017 //  This file is part of the XDFLengine project.
00018 //
00019 //  The XDFLengine is free software; you can redistribute it and/or modify
00020 //  it under the terms of the GNU General Public License as published by
00021 //  the Free Software Foundation; either version 2 of the License, or
00022 //  (at your option) any later version.
00023 //
00024 //  This program is distributed in the hope that it will be useful,
00025 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00026 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00027 //  GNU General Public License for more details.
00028 //
00029 //  You should have received a copy of the GNU General Public License
00030 //  along with this program; if not, write to the Free Software
00031 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00032 //  USA.
00033 //
00034 //  For more information, 
00035 //      contact  : guillaume@baurand.net 
00036 //      or visit : http://xdflengine.sourceforge.net
00037 //
00038 //=============================================================================
00039 
00040 #   include "dbobjgetstatement.hpp"  
00041 #   include "flow/consumers/streamsax2parser.hpp"
00042 
00043 BEGIN_XDFLENGINE_NS
00044 
00045 
00046 
00047 //============================================================================= 
00048 //  CLASS DBOBJGetStatementNode
00049 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00050 
00051     //_________________________________________________________________________
00052     //  DBOBJGETSTATEMENTNODE
00053     //-------------------------------------------------------------------------
00054     DBOBJGetStatementNode::DBOBJGetStatementNode(const DBOBJDefinitionNode* p_pDBOBJDefNode )
00055     {
00056         m_pDBObjectNodeDefinition = p_pDBOBJDefNode;
00057         m_pszName = importCharBuffer(0, m_pDBObjectNodeDefinition->getName());
00058 
00059         DEBUG_CREATE(DBOBJGetStatementNode)
00060     }
00061 
00062     //_________________________________________________________________________
00063     //  ~DBOBJGETSTATEMENTNODE
00064     //------------------------------------------------------------------------- 
00065     DBOBJGetStatementNode::~DBOBJGetStatementNode() 
00066     {
00067         DEBUG_DEL(DBOBJGetStatementNode)
00068 
00069         releaseCharBuffer(m_pszName);
00070         deleteTree();
00071 
00072     }
00073 
00074     //_________________________________________________________________________
00075     //  SETPARENT
00076     //------------------------------------------------------------------------- 
00077     void DBOBJGetStatementNode::setParent( DBOBJGetStatementNode* p_pDBOBJParentStmtNode)
00078     {
00079         DEBUG_FUNC(DBOBJGetStatementNode::setParent)
00080         m_pSAXStatementParent =  p_pDBOBJParentStmtNode;
00081     }
00082     
00083     // GETTERS  
00084 
00085     //_________________________________________________________________________
00086     //  GETNAME
00087     //-------------------------------------------------------------------------     
00088     const char* DBOBJGetStatementNode::getName() const
00089     {
00090         DEBUG_FUNC(SAXDBObjectNode::getName)
00091         return exportCharBuffer( m_pszName);
00092     }
00093 
00094     //_________________________________________________________________________
00095     //  GETPARENT
00096     //-------------------------------------------------------------------------     
00097     DBOBJGetStatementNode* DBOBJGetStatementNode::getParent() const
00098     {
00099         DEBUG_FUNC(DBOBJGetStatementNode::getParent)
00100         return m_pSAXStatementParent; 
00101     }
00102 
00103     //_________________________________________________________________________
00104     //  GETDEFINITION
00105     //-------------------------------------------------------------------------     
00106     const DBOBJDefinitionNode* DBOBJGetStatementNode::getDefinition() const
00107     {
00108         DEBUG_FUNC(SAXDBObjectNode::getDefinition)
00109         return m_pDBObjectNodeDefinition;
00110     }
00111     
00112     // CHILDREN COLLECTION BUILDER & ACCESSORS
00113     
00114     //_________________________________________________________________________
00115     //  APPENDCHILD
00116     //-------------------------------------------------------------------------     
00117     void DBOBJGetStatementNode::appendChild( DBOBJGetStatementNode* p_pSAXStatementChild)
00118     {
00119         DEBUG_FUNC(DBOBJGetStatementNode::appendChild)
00120         m_vaChildren.add( p_pSAXStatementChild, p_pSAXStatementChild->getName());
00121     }
00122 
00123     //_________________________________________________________________________
00124     //  GETCHILDNODESCOUNT
00125     //-------------------------------------------------------------------------     
00126     unsigned int DBOBJGetStatementNode::getChildNodesCount() const
00127     {
00128         DEBUG_FUNC(DBOBJGetStatementNode::getChildNodesCount)
00129         return m_vaChildren.size(); 
00130     }
00131 
00132     //_________________________________________________________________________
00133     //  GETCHILDNODE
00134     //-------------------------------------------------------------------------     
00135     DBOBJGetStatementNode* DBOBJGetStatementNode::getChildNode(unsigned int p_uiIndex) const
00136     {
00137         DEBUG_FUNC(DBOBJGetStatementNode::getChildNode)
00138         return m_vaChildren.get(p_uiIndex);
00139     }
00140 
00141     //_________________________________________________________________________
00142     //  GETCHILDNODE
00143     //-------------------------------------------------------------------------     
00144     DBOBJGetStatementNode* DBOBJGetStatementNode::getChildNode( const char* p_pszName, unsigned int p_uiIndex) const
00145     {
00146         DEBUG_FUNC(DBOBJGetStatementNode::getChildNode)
00147         return m_vaChildren.get(p_pszName,p_uiIndex);
00148     }
00149     
00150     // FILTERS COLLECTION BUILDER & ACCESSORS   
00151 
00152     //_________________________________________________________________________
00153     //  APPENDFILTER
00154     //-------------------------------------------------------------------------     
00155     void DBOBJGetStatementNode::appendFilter( DBOBJGetStatementClause* p_pDBOBJGetStatementClause)
00156     {
00157         DEBUG_FUNC(DBOBJGetStatementNode::appendFilter)
00158 
00159         // translate operator
00160         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPGT ) == 0)    p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, ">" );
00161         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPLT ) == 0)    p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, "<" );
00162         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPGTE ) == 0)   p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, ">=");
00163         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPLTE ) ==0)    p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, "<=");
00164         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPEQ ) == 0)    p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, "=" );
00165         if( strcmp( p_pDBOBJGetStatementClause->m_pszOp, DBOBJGETSTMT_FILTEROPNE ) == 0)    p_pDBOBJGetStatementClause->m_pszOp = importCharBuffer( p_pDBOBJGetStatementClause->m_pszOp, "<>");
00166 
00167         m_vaFilters.add( p_pDBOBJGetStatementClause, p_pDBOBJGetStatementClause->m_pFieldDefinition->getName());
00168     }
00169 
00170     //_________________________________________________________________________
00171     //  GETFILTERSCOUNT
00172     //-------------------------------------------------------------------------     
00173     unsigned int DBOBJGetStatementNode::getFiltersCount() const
00174     {
00175         DEBUG_FUNC(DBOBJGetStatementNode::getFiltersCount)
00176         return m_vaFilters.size();
00177     }
00178 
00179     //_________________________________________________________________________
00180     //  GETFILTER
00181     //-------------------------------------------------------------------------     
00182     DBOBJGetStatementClause* DBOBJGetStatementNode::getFilter(unsigned int p_uiIndex) const
00183     {
00184         DEBUG_FUNC(DBOBJGetStatementNode::getFilter)
00185         
00186         return m_vaFilters.get(p_uiIndex);
00187     }
00188 
00189     //_________________________________________________________________________
00190     //  GETFILTER
00191     //-------------------------------------------------------------------------     
00192     DBOBJGetStatementClause* DBOBJGetStatementNode::getFilter(const char* p_pszName, unsigned int p_uiIndex) const
00193     {
00194         DEBUG_FUNC(DBOBJGetStatementNode::getFilter)
00195         
00196         return m_vaFilters.get(p_pszName,p_uiIndex);
00197     }
00198     
00199     // ORDERS COLLECTION BUILDER & ACCESSORS
00200     
00201     //_________________________________________________________________________
00202     //  APPENDORDER
00203     //-------------------------------------------------------------------------     
00204     void DBOBJGetStatementNode::appendOrder( DBOBJGetStatementClause* p_pDBOBJGetStatementClause)
00205     {
00206         DEBUG_FUNC(DBOBJGetStatementNode::appendOrder)
00207 
00208         m_vaOrders.add( p_pDBOBJGetStatementClause, p_pDBOBJGetStatementClause->m_pFieldDefinition->getName());
00209     }
00210 
00211     //_________________________________________________________________________
00212     //  GETORDERSCOUNT
00213     //-------------------------------------------------------------------------     
00214     unsigned int DBOBJGetStatementNode::getOrdersCount() const
00215     {
00216         DEBUG_FUNC(DBOBJGetStatementNode::getOrdersCount)
00217         return m_vaOrders.size();
00218     }
00219 
00220     //_________________________________________________________________________
00221     //  GETORDER
00222     //-------------------------------------------------------------------------     
00223     DBOBJGetStatementClause* DBOBJGetStatementNode::getOrder(unsigned int p_uiIndex) const
00224     {
00225         DEBUG_FUNC(DBOBJGetStatementNode::getOrder)
00226         
00227         return m_vaOrders.get(p_uiIndex);
00228     }
00229 
00230     //_________________________________________________________________________
00231     //  GETORDER
00232     //-------------------------------------------------------------------------     
00233     DBOBJGetStatementClause* DBOBJGetStatementNode::getOrder(const char* p_pszName, unsigned int p_uiIndex) const
00234     {
00235         DEBUG_FUNC(DBOBJGetStatementNode::getOrder)
00236         
00237         return m_vaOrders.get(p_pszName, p_uiIndex);
00238     }
00239     
00240     // PRIVATES
00241     
00242     //_________________________________________________________________________
00243     //  DELETETREE
00244     //-------------------------------------------------------------------------     
00245     void DBOBJGetStatementNode::deleteTree()    
00246     {       
00247         //---------------------------------------------------------------------
00248         DBOBJGetStatementClause*   l_pSAXDB_clause = 0;
00249         DBOBJGetStatementNode*     l_pSAXDB_node = 0;
00250         //---------------------------------------------------------------------
00251 
00252         DEBUG_IN(DBOBJGetStatementNode::deleteTree)
00253 
00254         // kill chidren
00255         while( ! m_vaChildren.empty()) delete m_vaChildren.pop();
00256 
00257         // kill filters
00258         while(! m_vaFilters.empty()) 
00259         {      
00260             l_pSAXDB_clause = m_vaFilters.pop();
00261             l_pSAXDB_clause->m_pszOp=releaseCharBuffer(l_pSAXDB_clause->m_pszOp);
00262             l_pSAXDB_clause->m_pszValue=releaseCharBuffer(l_pSAXDB_clause->m_pszValue);
00263             delete l_pSAXDB_clause;
00264             
00265         }   
00266 
00267         // kill orders
00268         while(! m_vaOrders.empty()) 
00269         {      
00270             l_pSAXDB_clause = m_vaOrders.pop();
00271             l_pSAXDB_clause->m_pszOp=releaseCharBuffer(l_pSAXDB_clause->m_pszOp);
00272             l_pSAXDB_clause->m_pszValue=releaseCharBuffer(l_pSAXDB_clause->m_pszValue);
00273             delete l_pSAXDB_clause;
00274             
00275         }   
00276   
00277         DEBUG_OUT(DBOBJGetStatementNode::deleteTree)
00278     }
00279 
00280 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00281 //=============================================================================
00282 
00283 
00284 
00285 
00286 
00287 //============================================================================= 
00288 //  CLASS SAXDBSELECTBUILDER
00289 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00290 
00291     //_________________________________________________________________________
00292     //  BUILDDBOBJGETSTATEMENT
00293     //-------------------------------------------------------------------------
00294     DBOBJGetStatementNode* DBOBJGetStatementSAXBuilder::buildDBOBJGetStatement(XMLFlowContext* p_pContext,  XMLStreamProvider* p_pInput,const  DBOBJDefinitionNode* p_pDBOBJDefNode)
00295     {
00296         //---------------------------------------------------------------------
00297         DBOBJGetStatementSAXBuilder*            l_pDBOBJGetStmtBuilder=0;
00298         DBOBJGetStatementNode*                  l_pDBOBJGetStatementRoot=0;
00299         XDFLSaxErrorReporter*               l_pErrReporter=0;
00300         StreamSAX2Parser*                       l_pStreamParser=0;
00301         //---------------------------------------------------------------------
00302 
00303         DEBUG_IN(SAXDBObjectBuilder::buildSAXDBObject);
00304         PREP_CATCH_XML_FLOW_ERROR;
00305         
00306         WATCH_XML_FLOW_ERROR { 
00307 
00308             //  Create our SAX handler and error reporter objects.
00309             l_pDBOBJGetStmtBuilder=new DBOBJGetStatementSAXBuilder(p_pContext, p_pDBOBJDefNode);
00310             l_pErrReporter= new XDFLSaxErrorReporter("DBOBJGetStatementSAXBuilder::buildDBOBJGetStatement");
00311 
00312             // create parser
00313             l_pStreamParser = new StreamSAX2Parser(l_pDBOBJGetStmtBuilder, l_pErrReporter);
00314 
00315             // Parse !
00316             (*p_pInput) >> (*l_pStreamParser);
00317             l_pStreamParser->commitStream(true);            
00318 
00319             l_pDBOBJGetStatementRoot = l_pDBOBJGetStmtBuilder->getStatementRoot();
00320 
00321         } CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN;  
00322 
00323     RELEASE_AND_RETURN: 
00324 
00325         delete l_pStreamParser;
00326         delete l_pDBOBJGetStmtBuilder;
00327         delete l_pErrReporter;
00328 
00329         DEBUG_OUT(SAXDBObjectBuilder::buildSAXDBObject);
00330         ON_XML_FLOW_ERROR_DO delete l_pDBOBJGetStmtBuilder->getStatementRoot();
00331         ON_XML_FLOW_ERROR_THROW;    
00332 
00333         return l_pDBOBJGetStatementRoot;
00334     }
00335 
00336     //  CONSTRUCTORS AND DESTRUCTOR  
00337 
00338     //_________________________________________________________________________
00339     //  DBOBJGetStatementSAXBuilder
00340     //-------------------------------------------------------------------------
00341     DBOBJGetStatementSAXBuilder::DBOBJGetStatementSAXBuilder(XMLFlowContext* p_pContext, const DBOBJDefinitionNode* p_pDBOBJDefNode)
00342     {
00343         m_pSAXDB_curClause=0;
00344         m_pSAXDB_objectDef=p_pDBOBJDefNode; 
00345         m_pSAXDB_StatementRoot=0; 
00346         m_pContext = p_pContext;
00347 
00348         DEBUG_CREATE(DBOBJGetStatementSAXBuilder)
00349     }
00350 
00351     //_________________________________________________________________________
00352     //  ~DBOBJGetStatementSAXBuilder
00353     //-------------------------------------------------------------------------
00354     DBOBJGetStatementSAXBuilder::~DBOBJGetStatementSAXBuilder()
00355     {
00356         DEBUG_DEL(DBOBJGetStatementSAXBuilder)
00357 
00358         m_pSAXDB_curClause=0;
00359         m_pSAXDB_objectDef=0;   
00360         m_pSAXDB_StatementRoot=0; 
00361 
00362     }
00363 
00364     //  GETTERS  
00365 
00366     //_________________________________________________________________________
00367     //  GETSTATEMENTROOT
00368     //-------------------------------------------------------------------------
00369     DBOBJGetStatementNode* DBOBJGetStatementSAXBuilder::getStatementRoot()
00370     {
00371         DEBUG_FUNC(DBOBJGetStatementSAXBuilder::getStatementRoot) 
00372 
00373         return m_pSAXDB_StatementRoot;
00374     }
00375 
00376     //  CONTENTHANDLER  
00377 
00378     //_________________________________________________________________________
00379     //  STARTELEMENT
00380     //-------------------------------------------------------------------------
00381     void DBOBJGetStatementSAXBuilder::startElement( const XMLCh* const uri, 
00382                                                     const XMLCh* const localname, 
00383                                                     const XMLCh* const qname, 
00384                                                     const Attributes& attrs)
00385     {
00386         //---------------------------------------------------------------------
00387         const DBOBJDefinitionNode*      l_pSAXDB_nodeDef;
00388         const DBOBJDefinitionField*     l_pDBObjectFieldDef;
00389         DBOBJGetStatementNode*      l_pSAXDB_node=0;
00390 
00391         char                        l_szTagName[XMLPROCESSOR_MAX_TAG_SIZE];
00392         char                        l_szFieldName[XMLPROCESSOR_MAX_ATTRVAL_SIZE];
00393         char                        l_szOp[XMLPROCESSOR_MAX_ATTRVAL_SIZE];
00394 
00395         bool                        l_fRoot;
00396         unsigned int                l_uiType;
00397         //---------------------------------------------------------------------
00398 
00399         DEBUG_IN(DBOBJGetStatementSAXBuilder::startElement);
00400         PREP_CATCH_XML_FLOW_ERROR;
00401         
00402         WATCH_XML_FLOW_ERROR { 
00403 
00404             XSTR(m_pContext->getTranscoder(), localname, (char*)&l_szTagName);
00405 
00406             logout << l_szTagName << "\n";
00407 
00408             // get node or field definition
00409             if( m_vaNodes.empty() )
00410             {
00411                 // root node ?
00412                 if( strcmp( m_pSAXDB_objectDef->getName(), (char*) &l_szTagName) == 0) 
00413                 {
00414                     l_fRoot = true;
00415                     l_uiType = 0; // node
00416                     l_pSAXDB_nodeDef = m_pSAXDB_objectDef;
00417                 }
00418                 else
00419                 {
00420                     l_uiType=-1; // ignore
00421                 }
00422             }
00423             else
00424             {
00425                 // not a root node
00426                 l_fRoot = false;
00427                 l_uiType = 0; // node
00428 
00429                 if( strcmp( (char*) &l_szTagName, DBOBJGETSTMT_FILTER) == 0 ) l_uiType=DBOBJGETSTMT_TYPE_FILTER;    // filter
00430                 if( strcmp( (char*) &l_szTagName, DBOBJGETSTMT_ORDER) == 0 )  l_uiType=DBOBJGETSTMT_TYPE_ORDER; // order
00431 
00432                 if( l_uiType>0) // create clause
00433                 {
00434                     // get field name from clause
00435                      SAX_getAttrValue( attrs, DBOBJGETSTMT_FIELD,"", (char*)&l_szFieldName);
00436                     l_pDBObjectFieldDef = m_vaNodes.top()->getDefinition()->getField( (char*) &l_szFieldName);
00437 
00438                     // ERRCHECK : def field exists
00439                     if( l_pDBObjectFieldDef == 0 ) THROW_XMLFLOW_EXCEPTION ( ERRCODE_LOC_DBOBJGETREQUEST + ERRCODE_CAUSE_MISSINGREF , "Unable to find field definition.", "", "DBOBJGetStatementSAXBuilder::startElement", "The provided field name does not exists in object's node.", false );
00440 
00441                     if(l_pDBObjectFieldDef) // definition found, continue
00442                     {
00443                         if( l_uiType == DBOBJGETSTMT_TYPE_FILTER) SAX_getAttrValue(attrs, DBOBJGETSTMT_OP, DBOBJGETSTMT_FILTEROPDEF, (char*)&l_szOp);
00444                         if( l_uiType == DBOBJGETSTMT_TYPE_ORDER)  SAX_getAttrValue(attrs, DBOBJGETSTMT_OP, DBOBJGETSTMT_ORDEROPDEF, (char*)&l_szOp);
00445 
00446                         // create clause object
00447                         m_pSAXDB_curClause=new DBOBJGetStatementClause;
00448                         m_pSAXDB_curClause->m_pFieldDefinition  =l_pDBObjectFieldDef;
00449                         m_pSAXDB_curClause->m_uiType            =l_uiType;
00450                         m_pSAXDB_curClause->m_pszOp             =importCharBuffer( 0, (char*) &l_szOp);
00451                         m_pSAXDB_curClause->m_pszValue          =0; 
00452                     }
00453                 }
00454                 else
00455                 {
00456                     l_pSAXDB_nodeDef = m_vaNodes.top()->getDefinition()->getChildNode( (char*) &l_szTagName);
00457                     // ERRCHECK : def child exists
00458                     if( l_pSAXDB_nodeDef == 0 ) THROW_XMLFLOW_EXCEPTION ( ERRCODE_LOC_DBOBJGETREQUEST + ERRCODE_CAUSE_MISSINGREF , "Unable to find child node definition. ", "", "DBOBJGetStatementSAXBuilder::startElement", "The statement node's tag name does not match to a definition node.", false );
00459                 }
00460             }
00461             
00462             // build node
00463             if(l_uiType==0)
00464             {
00465                 m_pSAXDB_curClause=0;
00466 
00467                 if(l_pSAXDB_nodeDef)
00468                 {
00469                     l_pSAXDB_node = new DBOBJGetStatementNode( l_pSAXDB_nodeDef);
00470 
00471                     if( !l_fRoot)
00472                     {
00473                         l_pSAXDB_node->setParent( m_vaNodes.top());
00474                         m_vaNodes.top()->appendChild( l_pSAXDB_node);
00475                     }
00476 
00477                     //stack node
00478                     m_vaNodes.push( l_pSAXDB_node);
00479                 }
00480             }
00481 
00482         } CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN;  
00483 
00484     RELEASE_AND_RETURN:         
00485 
00486         logout << "/" << l_szTagName << "\n";
00487 
00488         DEBUG_OUT(DBOBJGetStatementSAXBuilder::startElement)
00489         ON_XML_FLOW_ERROR_DO  delStackedNodes();
00490         ON_XML_FLOW_ERROR_DO delete m_pSAXDB_curClause;
00491         ON_XML_FLOW_ERROR_THROW;    
00492     }
00493 
00494     //_________________________________________________________________________
00495     //  ENDELEMENT
00496     //-------------------------------------------------------------------------
00497     void DBOBJGetStatementSAXBuilder::endElement(   const XMLCh* const uri,
00498                                                     const XMLCh* const localname,
00499                                                     const XMLCh* const qname)
00500     {
00501         
00502         DEBUG_IN(DBOBJGetStatementSAXBuilder::endElement)
00503         PREP_CATCH_XML_FLOW_ERROR;
00504         
00505         WATCH_XML_FLOW_ERROR { 
00506         
00507             if( m_pSAXDB_curClause )
00508             {  
00509                 if( m_pSAXDB_curClause->m_uiType == DBOBJGETSTMT_TYPE_FILTER) m_vaNodes.top()->appendFilter( m_pSAXDB_curClause);
00510                 if( m_pSAXDB_curClause->m_uiType == DBOBJGETSTMT_TYPE_ORDER) m_vaNodes.top()->appendOrder( m_pSAXDB_curClause);
00511                 m_pSAXDB_curClause=0;
00512             }
00513             else
00514             {
00515                 // pop top stacked node and adds its to the previous one's children collection    
00516                 if(! m_vaNodes.empty())
00517                 {
00518                     m_pSAXDB_StatementRoot=m_vaNodes.pop();
00519                 }
00520             }
00521 
00522         } CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN;  
00523 
00524     RELEASE_AND_RETURN: 
00525 
00526         DEBUG_OUT(DBOBJGetStatementSAXBuilder::endElement)
00527         ON_XML_FLOW_ERROR_THROW;    
00528     }
00529 
00530     //_________________________________________________________________________
00531     //  CHARACTERS
00532     //-------------------------------------------------------------------------
00533     void DBOBJGetStatementSAXBuilder::characters(   const XMLCh* const chars , 
00534                                                     const unsigned int length)
00535     {
00536         //---------------------------------------------------------------------
00537         char*   l_pszChars;
00538         char*   l_pszTrimmedChars;
00539         //---------------------------------------------------------------------
00540         DEBUG_IN(DBOBJGetStatementSAXBuilder::characters)
00541         PREP_CATCH_XML_FLOW_ERROR;
00542 
00543         WATCH_XML_FLOW_ERROR { 
00544 
00545             // if there's a current field, store value
00546             if( m_pSAXDB_curClause )
00547             { 
00548                 l_pszChars= XSTR(m_pContext->getTranscoder(), chars, length);
00549                 l_pszTrimmedChars = trimCharBuffer( l_pszChars);
00550                 releaseCharBuffer( l_pszChars);
00551                 m_pSAXDB_curClause->m_pszValue = concatCharBuffer( m_pSAXDB_curClause->m_pszValue, l_pszTrimmedChars);
00552                 releaseCharBuffer( l_pszTrimmedChars);
00553             }
00554 
00555         } CATCH_XML_FLOW_ERROR_RELEASE_AND_RETURN;  
00556 
00557     RELEASE_AND_RETURN: 
00558            
00559         DEBUG_OUT(DBOBJGetStatementSAXBuilder::characters)
00560         ON_XML_FLOW_ERROR_THROW;               
00561     }
00562 
00563 
00564 
00565     //_________________________________________________________________________
00566     //  DELSTACKEDNODES
00567     //-------------------------------------------------------------------------
00568     void DBOBJGetStatementSAXBuilder::delStackedNodes()
00569     {
00570         DEBUG_FUNC(DBOBJGetStatementSAXBuilder::delStackedNode)
00571 
00572         while(!m_vaNodes.empty()) delete m_vaNodes.pop();
00573     }
00574 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00575 //=============================================================================
00576 
00577 END_XDFLENGINE_NS
00578 

Generated on Sat Oct 4 13:19:56 2003 for XDFLengine by doxygen1.3-rc2