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

dbobjgetstreamer.hpp

Go to the documentation of this file.
00001 #if !defined(_DBOBJGetStreamer_HPP)
00002 #define _DBOBJGetStreamer_HPP
00003 //============================================================================= 
00004 //
00005 // XDFLengine library
00006 //
00007 //----------------------------------------------------------------------------- 
00008 //  DBOBJGetStreamer.HPP
00009 //----------------------------------------------------------------------------- 
00015 //_____________________________________________________________________________
00016 //
00017 //  Copyright (C) 2003 Guillaume Baurand. All Rights Reserved.
00018 //
00019 //  This file is part of the XDFLengine project.
00020 //
00021 //  The XDFLengine is free software; you can redistribute it and/or modify
00022 //  it under the terms of the GNU General Public License as published by
00023 //  the Free Software Foundation; either version 2 of the License, or
00024 //  (at your option) any later version.
00025 //
00026 //  This program is distributed in the hope that it will be useful,
00027 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00028 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00029 //  GNU General Public License for more details.
00030 //
00031 //  You should have received a copy of the GNU General Public License
00032 //  along with this program; if not, write to the Free Software
00033 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00034 //  USA.
00035 //
00036 //  For more information, 
00037 //      contact  : guillaume@baurand.net 
00038 //      or visit : http://xdflengine.sourceforge.net
00039 //
00040 //=============================================================================
00041 
00042 #   include "config/commonincs.hpp"
00043 #   include "streamers/db/dbobject/dbobjstreamerfactory.hpp"
00044 #   include "streamers/generic/saxstreamer.hpp"
00045 
00046 BEGIN_XDFLENGINE_NS
00047 
00048 class XMLProcessor;
00049 class DBOBJDefinitionNode;
00050 class DBOBJGetStatementNode;
00051 class DBOBJGetStatementSAXBuilder;
00052 
00053 //============================================================================= 
00054 //  STRUCT OTL_STREAM_PEEK
00055 //----------------------------------------------------------------------------- 
00058 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00059 typedef struct otl_stream_peek
00060 {
00061         otl_stream*         pOTLStream; 
00062         VAarray< char*>     vaPeeks;    
00063         unsigned int        pos;        
00064 } otl_stream_peek;
00065 
00066 
00067 //============================================================================= 
00068 //  CLASS DBOBJGetStreamer
00069 //----------------------------------------------------------------------------- 
00072 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00073 class XDFLENGINE_EXPORT DBOBJGetStreamer : public SaxStreamer
00074 {
00075 
00076     private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00077 
00078         char*                           m_pszConnName;
00079         bool                            m_boolFlat;                 
00080         char*                           m_pszMaxItems;              
00081         int                             m_intBufSize;               
00082         DBOBJGetStatementNode*          m_pDBOBJGetStatementRoot;   
00083         const DBOBJDefinitionNode*      m_pDBOBJDefinitionRoot;
00084         DBOBJDefinitionNode*            m_pDBOBJOwnedDefinitionRoot;
00085 
00086         VAarray< otl_stream_peek*>      m_vaNamedData;              
00087         otl_connect*                    m_pConnection;
00088         VAarray<char*>                  m_vaStatements;     
00089 
00090         unsigned int    m_uiStreamObjects;
00091         unsigned int    m_uiToStream;
00092 
00093     protected :
00094 
00095         //DBStreamerFactory*                m_pParent;
00096         //DBOBJGetStatementSAXBuilder*  m_pHandler;
00097 
00098 
00099 
00100     public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00101 
00102 
00103     // CONSTRUCTOR & DESTRUCTOR
00104 
00105         //_____________________________________________________________________
00106         //  DBOBJGetStreamer
00107         //---------------------------------------------------------------------
00108         DBOBJGetStreamer( const XMLStreamerFactory* p_pParent, StreamerParams* p_pParameters, XMLFlowContext* p_pContext, XMLStreamConsumer* p_pOutput, ContentHandler* p_pHandler,const DBOBJDefinitionNode* p_pDBOBJDefinitionRoot, DBOBJDefinitionNode* p_pDBOBJOwnedDefinitionRoot  );
00109         
00110         //_____________________________________________________________________
00111         //  ~DBOBJGetStreamer
00112         //---------------------------------------------------------------------     
00113         virtual ~DBOBJGetStreamer();
00114 
00115     // STREAMER
00116 
00117         //_____________________________________________________________________
00118         //  COMMITSTREAM
00119         //---------------------------------------------------------------------
00120         bool commitStream(bool p_fFinal=false);
00121 
00122 
00123     // STATEMENT BUILD AND EXEC
00124 
00125         //_____________________________________________________________________
00126         //  EXECUTESQL
00127         //---------------------------------------------------------------------
00130         //_____________________________________________________________________ 
00131         void executeSQL(); // overloaded
00132 
00133 
00134     // OUTPUT
00135 
00136         //_____________________________________________________________________
00137         //  makeXML
00138         //---------------------------------------------------------------------
00140         //_____________________________________________________________________ 
00141         void makeXML();
00142 
00143     
00144     private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00145 
00146     // PARAMS GETTERS
00147 
00148         //_____________________________________________________________________
00149         //  GETMAXITEMS
00150         //---------------------------------------------------------------------
00153         //_____________________________________________________________________ 
00154         int getMaxItems() const;
00155 
00156     // SQL BUILD
00157 
00158         //_____________________________________________________________________
00159         //  BUILDSELECTSTATEMENT
00160         //---------------------------------------------------------------------
00171         //_____________________________________________________________________ 
00172         void buildSELECTStatement ( const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00173                                     DBOBJGetStatementNode*  p_pDBOBJStmtNode, 
00174                                     unsigned int            p_uiDepth , 
00175                                     const char*             p_pszrParentFROM  , 
00176                                     const char*             p_pszParentJOIN, 
00177                                     const char*             p_pszParentWHERE , 
00178                                     const char*             p_pszParentORDER    );
00179         
00180         //_____________________________________________________________________
00181         //  BUILDSQLSELECT
00182         //---------------------------------------------------------------------
00187         //_____________________________________________________________________ 
00188         char* buildSQLSELECT (      const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00189                                     unsigned int            p_uiDepth   ) const;
00190         
00191         //_____________________________________________________________________
00192         //  BUILDSQLFROM
00193         //---------------------------------------------------------------------
00195         //
00200         //_____________________________________________________________________         
00201         char* buildSQLFROM  (       const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00202                                     unsigned int            p_uiDepth, 
00203                                     const char*             p_pszParentFROM ) const;
00204         
00205         //_____________________________________________________________________
00206         //  BUILDSQLJOIN
00207         //---------------------------------------------------------------------
00209         //
00214         //_____________________________________________________________________         
00215         char* buildSQLJOIN  (       const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00216                                     unsigned int            p_uiDepth , 
00217                                     const char*             p_pszParentJOIN ) const;   
00218         
00219         //_____________________________________________________________________
00220         //  BUILDSQLWHERE
00221         //---------------------------------------------------------------------
00224         //
00230         //_____________________________________________________________________         
00231         char* buildSQLWHERE (       const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00232                                     DBOBJGetStatementNode*  p_pDBOBJStmtNode, 
00233                                     unsigned int            p_uiDepth, 
00234                                     const char*             p_pszParentWHERE ) const; 
00235         
00236         //_____________________________________________________________________
00237         //  BUILDSQLJOINORDER
00238         //---------------------------------------------------------------------
00241         //
00246         //_____________________________________________________________________         
00247         char* buildSQLJOINORDER (   const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00248                                     unsigned int            p_uiDepth, 
00249                                     const char*             p_pszParentORDER ) const; 
00250         
00251         //_____________________________________________________________________
00252         //  BUILDSQLORDER
00253         //---------------------------------------------------------------------
00255         //
00261         //_____________________________________________________________________         
00262         char* buildSQLORDER (       const DBOBJDefinitionNode*  p_pDBOBJDefNode, 
00263                                     DBOBJGetStatementNode*  p_pDBOBJStmtNode, 
00264                                     unsigned int            p_uiDepth, 
00265                                     const char*             p_pszParentORDER ) const;
00266 
00267 
00268     // DATA GETTERS
00269 
00270         //_____________________________________________________________________
00271         //  PUSHSQLSTATEMENT
00272         //---------------------------------------------------------------------
00275         //_____________________________________________________________________
00276         void pushSQLStatement(const char* p_pszSQL);
00277 
00278         //_____________________________________________________________________
00279         //  GETDATASTREAM
00280         //---------------------------------------------------------------------
00285         //_____________________________________________________________________ 
00286         otl_stream* getDataStream ( const char* p_pszName) const;
00287 
00288         //_____________________________________________________________________
00289         //  PEEKDATA
00290         //---------------------------------------------------------------------
00294         //_____________________________________________________________________ 
00295         const char* peekData ( const char* p_pszName);
00296 
00297         //_____________________________________________________________________
00298         //  REWINDPEEKEDDATA
00299         //---------------------------------------------------------------------
00302         //_____________________________________________________________________ 
00303         void rewindPeekedData ( const char* p_pszName);
00304 
00305         //_____________________________________________________________________
00306         //  FLUSHPEEKEDDATA
00307         //---------------------------------------------------------------------
00310         //_____________________________________________________________________ 
00311         void flushPeekedData ( const char* p_pszName);
00312 
00313         //_____________________________________________________________________
00314         //  DELSTREAM
00315         //---------------------------------------------------------------------
00318         //_____________________________________________________________________ 
00319         void delStream ( otl_stream_peek* p_rsDataPeek);
00320 
00321 
00322     // XML BUILD
00323 
00324         //_____________________________________________________________________
00325         //  MAKEXML
00326         //---------------------------------------------------------------------
00333         //_____________________________________________________________________
00334         void makeXML ( const DBOBJDefinitionNode* p_pDBOBJDefNode , const char* p_pszParentKeys , unsigned int p_uiDepth);        
00335 
00336         //_____________________________________________________________________
00337         //  OPENXMLNODE
00338         //---------------------------------------------------------------------
00342         //_____________________________________________________________________ 
00343         void openXMLNode ( const DBOBJDefinitionNode* p_pDBOBJDefNode) ;
00344 
00345         //_____________________________________________________________________
00346         //  CLOSEXMLNODE
00347         //---------------------------------------------------------------------
00351         //_____________________________________________________________________ 
00352         void closeXMLNode ( const DBOBJDefinitionNode* p_pDBOBJDefNode) ;
00353 
00354 };
00355 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00356 //=============================================================================
00357 
00358 
00359 //============================================================================= 
00360 //  CLASS DBOBJGetStreamerFACTORY
00361 //----------------------------------------------------------------------------- 
00363 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00364 class XDFLENGINE_EXPORT DBOBJGetStreamerFactory:public DBOBJStreamerFactory
00365 {
00366 
00367     public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00368 
00369         //_____________________________________________________________________
00370         //  GETSTREAMER
00371         //---------------------------------------------------------------------
00372         XMLStreamer* getStreamer(StreamerParams* p_pParameters, XMLFlowContext* p_pStreamContext, XMLStreamConsumer* p_pStreamConsumer) const;
00373 };
00374 
00375 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00376 //=============================================================================
00377 
00378 
00379 END_XDFLENGINE_NS
00380 
00381 #endif

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