00001 #if !defined(_DBOBJGETSTATEMENT_HPP) 00002 #define _DBOBJGETSTATEMENT_HPP 00003 //============================================================================= 00004 // 00005 // XDFLengine library 00006 // 00007 //----------------------------------------------------------------------------- 00008 // DBOBJGETSTATEMENT.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 "processor/xmlflowcontext.hpp" 00044 # include "streamers/db/dbobject/dbobjdefinition.hpp" 00045 00046 BEGIN_XDFLENGINE_NS 00047 00048 00049 00050 00051 //============================================================================= 00052 // STRUCT DBOBJGETSTATEMENTCLAUSE 00053 //----------------------------------------------------------------------------- 00055 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00056 typedef struct _DBOBJGetStatementClause 00057 { 00058 const DBOBJDefinitionField* m_pFieldDefinition; 00059 unsigned int m_uiType; 00060 char* m_pszOp; 00061 char* m_pszValue; 00062 } DBOBJGetStatementClause; 00063 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00064 //============================================================================= 00065 00066 00067 00068 00069 00070 //============================================================================= 00071 // CLASS DBOBJGETSTATEMENTNODE 00072 //----------------------------------------------------------------------------- 00074 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00075 class XDFLENGINE_EXPORT DBOBJGetStatementNode 00076 { 00077 private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00078 00079 char* m_pszName; 00080 const DBOBJDefinitionNode* m_pDBObjectNodeDefinition; 00081 DBOBJGetStatementNode* m_pSAXStatementParent; 00082 VAarray<DBOBJGetStatementNode*> m_vaChildren; 00083 VAarray<DBOBJGetStatementClause*> m_vaFilters; 00084 VAarray<DBOBJGetStatementClause*> m_vaOrders; 00085 00086 00087 public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00088 00089 // CONTRUCTOR & DESTRUCTOR 00090 00091 //_____________________________________________________________________ 00092 // DBOBJGETSTATEMENTNODE 00093 //--------------------------------------------------------------------- 00096 //_____________________________________________________________________ 00097 DBOBJGetStatementNode( const DBOBJDefinitionNode* p_pDBOBJDefNode); 00098 00099 //_____________________________________________________________________ 00100 // ~DBOBJGETSTATEMENTNODE 00101 //--------------------------------------------------------------------- 00104 //_____________________________________________________________________ 00105 ~DBOBJGetStatementNode(); 00106 00107 // SETTERS 00108 00109 //_____________________________________________________________________ 00110 // SETPARENT 00111 //--------------------------------------------------------------------- 00114 //_____________________________________________________________________ 00115 void setParent( DBOBJGetStatementNode* p_pDBOBJParentStmtNode); 00116 00117 // GETTERS 00118 00119 //_____________________________________________________________________ 00120 // GETNAME 00121 //--------------------------------------------------------------------- 00124 //_____________________________________________________________________ 00125 const char* getName() const; 00126 00127 //_____________________________________________________________________ 00128 // GETDEFINITION 00129 //--------------------------------------------------------------------- 00132 //_____________________________________________________________________ 00133 const DBOBJDefinitionNode* getDefinition() const; 00134 00135 //_____________________________________________________________________ 00136 // GETPARENT 00137 //--------------------------------------------------------------------- 00140 //_____________________________________________________________________ 00141 DBOBJGetStatementNode* getParent() const; 00142 00143 // CHILD NODES 00144 00145 //_____________________________________________________________________ 00146 // APPENDCHILD 00147 //--------------------------------------------------------------------- 00150 //_____________________________________________________________________ 00151 void appendChild( DBOBJGetStatementNode* p_pSAXStatementChild); 00152 00153 //_____________________________________________________________________ 00154 // GETCHILDNODESCOUNT 00155 //--------------------------------------------------------------------- 00158 //_____________________________________________________________________ 00159 unsigned int getChildNodesCount() const; 00160 00161 //_____________________________________________________________________ 00162 // GETCHILDNODE 00163 //--------------------------------------------------------------------- 00167 //_____________________________________________________________________ 00168 DBOBJGetStatementNode* getChildNode( unsigned int p_uiIndex) const; 00169 00170 //_____________________________________________________________________ 00171 // GETCHILDNODE 00172 //--------------------------------------------------------------------- 00177 //_____________________________________________________________________ 00178 DBOBJGetStatementNode* getChildNode( const char* p_pszName, unsigned int p_uiIndex=0) const; 00179 00180 // FILTERS 00181 00182 //_____________________________________________________________________ 00183 // APPENDFILTER 00184 //--------------------------------------------------------------------- 00187 //_____________________________________________________________________ 00188 void appendFilter( DBOBJGetStatementClause* p_pDBOBJGetStatementClause); 00189 00190 //_____________________________________________________________________ 00191 // GETFILTERSCOUNT 00192 //--------------------------------------------------------------------- 00194 // !@return (int) Number of filter of this node. 00195 //_____________________________________________________________________ 00196 unsigned int getFiltersCount() const; 00197 00198 //_____________________________________________________________________ 00199 // GETFILTER 00200 //--------------------------------------------------------------------- 00204 //_____________________________________________________________________ 00205 DBOBJGetStatementClause* getFilter( unsigned int p_uiIndex) const; 00206 00207 //_____________________________________________________________________ 00208 // GETFILTER 00209 //--------------------------------------------------------------------- 00213 //_____________________________________________________________________ 00214 DBOBJGetStatementClause* getFilter(const char* p_pszName, unsigned int p_uiIndex) const; 00215 00216 // ORDERS 00217 00218 //_____________________________________________________________________ 00219 // APPENDORDER 00220 //--------------------------------------------------------------------- 00223 //_____________________________________________________________________ 00224 void appendOrder( DBOBJGetStatementClause* p_pDBOBJGetStatementClause); 00225 00226 //_____________________________________________________________________ 00227 // GETORDERSCOUNT 00228 //--------------------------------------------------------------------- 00231 //_____________________________________________________________________ 00232 unsigned int getOrdersCount() const; 00233 00234 //_____________________________________________________________________ 00235 // GETORDER 00236 //--------------------------------------------------------------------- 00240 //_____________________________________________________________________ 00241 DBOBJGetStatementClause* getOrder( unsigned int p_uiIndex) const; 00242 00243 //_____________________________________________________________________ 00244 // GETORDER 00245 //--------------------------------------------------------------------- 00249 //_____________________________________________________________________ 00250 DBOBJGetStatementClause* getOrder(const char* p_pszName, unsigned int p_uiIndex) const; 00251 00252 00253 private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00254 00255 //_____________________________________________________________________ 00256 // DELETETREE 00257 //--------------------------------------------------------------------- 00259 //_____________________________________________________________________ 00260 void deleteTree(); 00261 00262 }; 00263 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00264 //============================================================================= 00265 00266 00267 00268 00269 00270 00271 00272 //============================================================================= 00273 // CLASS DBOBJGETSTATEMENTSAXBUILDER 00274 //----------------------------------------------------------------------------- 00276 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00277 class XDFLENGINE_EXPORT DBOBJGetStatementSAXBuilder : public ContentHandler 00278 { 00279 00280 private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00281 00282 VAarray< DBOBJGetStatementNode* > m_vaNodes; 00283 const DBOBJDefinitionNode* m_pSAXDB_objectDef; 00284 DBOBJGetStatementClause* m_pSAXDB_curClause; 00285 DBOBJGetStatementNode* m_pSAXDB_StatementRoot; 00286 XMLFlowContext* m_pContext; // Parsing context 00287 00288 00289 public: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00290 00291 // STATIC 00292 00293 //_____________________________________________________________________ 00294 // BUILDDBOBJGETSTATEMENT 00295 //--------------------------------------------------------------------- 00300 //_____________________________________________________________________ 00301 static DBOBJGetStatementNode* buildDBOBJGetStatement(XMLFlowContext* p_pContext, XMLStreamProvider* p_pInput,const DBOBJDefinitionNode* p_pDBOBJDefNode ); 00302 00303 // CONSTRUCTOR & DESTRUCTOR 00304 00305 //_____________________________________________________________________ 00306 // DBOBJGETSTATEMENTSAXBUILDER 00307 //--------------------------------------------------------------------- 00310 //_____________________________________________________________________ 00311 DBOBJGetStatementSAXBuilder(XMLFlowContext* p_pContext, const DBOBJDefinitionNode* p_pDBOBJDefNode); 00312 00313 //_____________________________________________________________________ 00314 // ~DBOBJGETSTATEMENTSAXBUILDER 00315 //--------------------------------------------------------------------- 00318 //_____________________________________________________________________ 00319 ~DBOBJGetStatementSAXBuilder(); 00320 00321 00322 // GETTERS 00323 00324 //_____________________________________________________________________ 00325 // DBOBJGETSTATEMENTNODE 00326 //--------------------------------------------------------------------- 00329 //_____________________________________________________________________ 00330 DBOBJGetStatementNode* getStatementRoot(); 00331 00332 // CONTENTHANDLER ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00333 00334 //____________________________________________________________________ 00335 // STARTELEMENT 00336 //-------------------------------------------------------------------- 00346 //_____________________________________________________________________ 00347 void startElement( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const Attributes& attrs); 00348 00349 //____________________________________________________________________ 00350 // CHARACTERS 00351 //-------------------------------------------------------------------- 00357 //_____________________________________________________________________ 00358 void characters( const XMLCh* const chars, const unsigned int length); 00359 00360 //____________________________________________________________________ 00361 // ENDELEMENT 00362 //-------------------------------------------------------------------- 00369 //_____________________________________________________________________ 00370 void endElement ( const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname); 00371 00372 // not implemented : 00373 void startDocument(){}; 00374 void endDocument(){}; 00375 void ignorableWhitespace ( const XMLCh* const chars, const unsigned int length){}; 00376 void processingInstruction ( const XMLCh* const target, const XMLCh* const data){}; 00377 void setDocumentLocator ( const Locator* const locator) {}; 00378 void startPrefixMapping ( const XMLCh* const prefix,const XMLCh* const uri){}; 00379 void endPrefixMapping ( const XMLCh* const prefix){}; 00380 void skippedEntity ( const XMLCh* const name){}; 00381 00382 private: //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00383 00384 //____________________________________________________________________ 00385 // DELSTACKEDNODES 00386 //-------------------------------------------------------------------- 00388 //____________________________________________________________________ 00389 void delStackedNodes(); 00390 }; 00391 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 00392 //============================================================================= 00393 00394 00395 END_XDFLENGINE_NS 00396 00397 #endif