CommandCommon.hh

00001 //********************************************************************
00002 //*** ResourcePool/oracle/CommandCommon.hh
00003 //*** Copyright (c) 2003-2009 by Markus Winand <mws@fatalmind.com>
00004 //*** $Id: CommandCommon.hh,v 1.41 2009-05-10 16:16:52 mws Exp $
00005 //********************************************************************
00006 /*
00007 This file is part of ResourcePool.
00008 
00009 ResourcePool is free software; you can redistribute it
00010 and/or modify it under the terms of the GNU General Public License
00011 as published by the Free Software Foundation; either version 2 of 
00012 the License, or (at your option) any later version.
00013 
00014 ResourcePool is distributed in the hope that it will be
00015 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00016 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 GNU General Public License for more details.
00018 
00019 You should have received a copy of the GNU General Public License
00020 along with ResourcePool; if not, write to the Free Software
00021 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00022 02111-1307  USA */
00023 
00024 #ifndef RESOURCEPOOL_ORACLE_COMMANDCOMMON_HH
00025 #define RESOURCEPOOL_ORACLE_COMMANDCOMMON_HH
00026 
00027 #ifndef RESOURCEPOOL_ORACLE_COMMANDINTERFACE_HH
00028 #include "CommandInterface.hh"
00029 #endif
00030 
00031 #ifndef INCLUDED_GC_PTR_HH
00032 #include "mm/gc_ptr.hh"
00033 #endif
00034 
00035 #ifndef RESOURCEPOOL_COMMAND_HH
00036 #include "ResourcePool/Command.hh"
00037 #endif
00038 
00039 #ifndef RESOURCEPOOL_ORACLE_OCIHANDLEFWD_HH
00040 #include "OCIHandleFwd.hh"
00041 #endif
00042 
00043 #ifndef RESOURCEPOOL_SQL_BIND_HH
00044 #include "ResourcePool/SQL/Bind.hh"
00045 #endif
00046 
00047 #ifndef RESOURCEPOOL_ORACLE_STATEMENTCACHE_HH
00048 #include "StatementCache.hh"
00049 #endif
00050 
00051 #ifndef RESOURCEPOOL_ORACLE_ORACLESTATEMENT_HH
00052 #include "oracleStatement.hh"
00053 #endif
00054 
00055 #include "ResourcePool/SQL/SQLStatement.hh"
00056 
00057 #include <string>
00058 
00059 namespace fatalmind {
00060 namespace oracle {
00061 
00062 class oracleType;
00063 template<typename T>
00064 class oracleTypeImpl;
00065 
00069 template<class TM, template<class> class SLMDC>
00070 class CommandCommon
00071 : public CommandInterface<TM, SLMDC>
00072 , public SQL::Bind<oracleType, oracleTypeImpl> 
00073 {
00074     public:
00075         virtual ~CommandCommon();
00076         
00077         virtual void outputoperator(std::ostream& s) const;
00078     protected:
00079         typedef SQL::Bind<oracleType, oracleTypeImpl> super_bind;
00084         CommandCommon(const fatalmind::SQL::SQLStatement&);
00085 
00086         /*
00087          * this functions is the primary target to be overwritten by
00088          * the respective SQL actions (SQLExecute, SQLSelect and so on)
00089          */
00090         virtual void _execute(oracleResource<TM>&, StatementCache&) = 0;
00091 
00092         /*
00093          * performs the OCI prepare call (cached)
00094          */
00095         StatementCache::handle_t prepare(oracleResource<TM>&, StatementCache&, const oracleStatement& oraSQL);
00096         /*
00097          * perform the OCIBind calls. since this is required by all (not only)
00098          * select calls its here in the Common code
00099          */
00100         void real_bind(oracleResource<TM>&, OCIStatementHandle& sth);
00101 
00102         const std::string& getSQL() const;
00103 
00104         virtual const std::string& getCommandName() const;
00105         static const std::string _CommandCommonName;
00106     
00110         oracleStatement _SQL;
00111 };
00112 
00113 } // namespace oracle
00114 } // namespace fatalmind
00115 #endif

Generated on Mon Nov 9 16:21:24 2009 for ResourcePool by  doxygen 1.5.3