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

sqlstreamer.hpp

Go to the documentation of this file.
00001 #if !defined(_SQLStreamer_HPP)
00002 #define _SQLStreamer_HPP
00003 //============================================================================= 
00004 //
00005 // XDFLengine library
00006 //
00007 //-----------------------------------------------------------------------------
00008 //  SQLStreamer.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/dbstreamerfactory.hpp"
00044 
00045 BEGIN_XDFLENGINE_NS
00046 
00047 class XMLProcessor;
00048 
00049 //============================================================================= 
00050 //  CLASS SQLStreamerFACTORY
00051 //----------------------------------------------------------------------------- 
00053 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00054 class XDFLENGINE_EXPORT SQLStreamerFactory:public DBStreamerFactory
00055 {
00056 
00057     public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00058 
00059         //_____________________________________________________________________
00060         //  GETSTREAMER
00061         //---------------------------------------------------------------------
00062         XMLStreamer* getStreamer(StreamerParams* p_pParameters, XMLFlowContext* p_pStreamContext, XMLStreamConsumer* p_pStreamConsumer) const;
00063 };
00064 
00065 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00066 //=============================================================================
00067 
00068 
00069 
00070 //============================================================================= 
00071 //  CLASS SAXSQLHandler
00072 //----------------------------------------------------------------------------- 
00075 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00076 class XDFLENGINE_EXPORT SAXSQLHandler : public ContentHandler
00077 {
00078 
00079 
00080     private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00081         const           XMLStreamerFactory* m_pStreamerFactory;
00082         const           XMLFlowContext*     m_pContext;
00083         XMLStreamConsumer*  m_pOutput;      
00084         char*           m_pszConnection;
00085         otl_connect*    m_pCNN_connection ; 
00086         otl_stream*     m_rsData;           
00087         otl_var_desc*   m_varsDesc;         
00088         char*           m_pszEncloseRecord; 
00089         char*           m_pszSQLStmt;       
00090         char*           m_pszFilterData;    
00091         unsigned int    m_uiBufSize;        
00092         unsigned int    m_uiLevel;          
00093         int             m_iDescLen;         
00094         int             m_iDescrPos;        
00095         char*           m_pszCurVal;        
00096         int             m_iFilterMode;      
00097         unsigned int    m_uiStreamObjects;
00098         unsigned int    m_uiToStream;
00099         int             m_iCommitPack;      
00100         int             m_iCommit;
00101         unsigned int    m_uiFlushPack;      
00102         unsigned int    m_uiFlush;
00103         bool            m_fDBErrorFatal;
00104         bool            m_fCurRecordError;
00105         bool            m_fTransmitData;
00106 
00107     public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00108 
00109     // CONSTRUCTOR & DESTRUCTOR
00110 
00111         //_____________________________________________________________________
00112         //  SAXSQLHANDLER
00113         //---------------------------------------------------------------------
00114         SAXSQLHandler(  DBStreamerFactory*      p_pStreamerFactory,
00115                         StreamerParams*         p_pParameters, 
00116                         XMLFlowContext*         p_pStreamContext, 
00117                         XMLStreamConsumer*      p_pStreamConsumer); 
00118 
00119         //_____________________________________________________________________
00120         //  ~SAXSQLHANDLER
00121         //---------------------------------------------------------------------
00123         //_____________________________________________________________________
00124         ~SAXSQLHandler    ();
00125 
00126 
00127 
00128     // CONTENTHANDLER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00129     
00130         //____________________________________________________________________
00131         //  STARTDOCUMENT
00132         //--------------------------------------------------------------------
00136         //_____________________________________________________________________ 
00137         void startDocument();
00138         
00139         //____________________________________________________________________
00140         //  STARTELEMENT
00141         //--------------------------------------------------------------------
00149         //_____________________________________________________________________ 
00150         void startElement(  const XMLCh* const uri,  const XMLCh* const localname,   const XMLCh* const qname, const Attributes& attrs);
00151 
00152         //____________________________________________________________________
00153         //  CHARACTERS
00154         //--------------------------------------------------------------------
00160         //_____________________________________________________________________ 
00161         void characters(  const XMLCh* const chars,   const unsigned int length);
00162 
00163         //____________________________________________________________________
00164         //  ENDELEMENT
00165         //--------------------------------------------------------------------
00174         //_____________________________________________________________________ 
00175         void endElement (  const XMLCh* const uri,   const XMLCh* const localname,   const XMLCh* const qname);
00176 
00177         //____________________________________________________________________
00178         //  ENDDOCUMENT
00179         //--------------------------------------------------------------------
00184         //_____________________________________________________________________ 
00185         void endDocument();
00186 
00187         // not implemented :
00188         void ignorableWhitespace ( const XMLCh* const chars, const unsigned int length){};
00189         void processingInstruction ( const XMLCh* const target, const XMLCh* const data){};
00190         void setDocumentLocator ( const Locator* const locator) {};
00191         void startPrefixMapping ( const XMLCh* const prefix,const XMLCh* const uri){};      
00192         void endPrefixMapping ( const XMLCh* const prefix){};
00193         void skippedEntity ( const XMLCh* const name){};
00194 
00195     private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00196 
00197         //____________________________________________________________________
00198         //  OPENDATASTREAM
00199         //--------------------------------------------------------------------
00203         //_____________________________________________________________________
00204         void openDataStream();
00205         
00206         //____________________________________________________________________
00207         //  RELEASEDATASTREAM
00208         //--------------------------------------------------------------------
00210         //_____________________________________________________________________     
00211         void releaseDataStream ();
00212 
00213 
00214         //____________________________________________________________________
00215         //  FLUSHRECORDS
00216         //--------------------------------------------------------------------
00217         void flushRecords();
00218 
00219         //____________________________________________________________________
00220         //  COMMITRECORDS
00221         //--------------------------------------------------------------------
00222         void commitRecords();
00223 
00224         //____________________________________________________________________
00225         //  ROLLBACKRECORDS
00226         //--------------------------------------------------------------------
00227         void rollbackRecords();
00228 
00229         //____________________________________________________________________
00230         //  SETINVAR
00231         //--------------------------------------------------------------------
00236         //_____________________________________________________________________
00237         void setInVar ( const char* p_pszName, const char* p_pszVarValue);
00238 
00239         //____________________________________________________________________
00240         //  INSERTINVAR
00241         //--------------------------------------------------------------------
00246         //_____________________________________________________________________
00247         void insertInVar ( int p_intOTLType, const char* p_pszVarValue);
00248 
00249         //_____________________________________________________________________
00250         //  MAKEXML
00251         //---------------------------------------------------------------------
00254         //_____________________________________________________________________
00255         void makeXML ();
00256         
00257 };
00258 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00259 //=============================================================================
00260 
00261 END_XDFLENGINE_NS
00262 
00263 #endif
00264 

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