00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RESOURCEPOOL_ORACLE_SQLEXECUTE_HH
00025 #define RESOURCEPOOL_ORACLE_SQLEXECUTE_HH
00026
00027 #ifndef RESOURCEPOOL_ORACLE_RESOURCEFWD_HH
00028 #include "ResourceFwd.hh"
00029 #endif
00030
00031 #ifndef RESOURCEPOOL_ORACLE_COMMANDCOMMON_HH
00032 #include "CommandCommon.hh"
00033 #endif
00034
00035
00036
00037
00038 #include <string>
00039 #include <deque>
00040
00041 #include "mm/RawBuffer.hh"
00042
00043 namespace fatalmind {
00044
00045
00046 class OracleExceptionFactory;
00047
00048 namespace oracle {
00049
00050
00051 template <class CommandType>
00052 class OptimizedBatchCommand;
00053
00058 template <class TM, template<class>class SLMDC>
00059 class SQLExecute
00060 : public CommandCommon<TM, SLMDC>
00061 {
00062 typedef CommandCommon<TM, SLMDC> super;
00063 typedef SQLExecute<TM, SLMDC> this_t;
00064 using super::_SQL;
00065 using super::_sth;
00066 public:
00067 SQLExecute(const std::string& SQL);
00068 SQLExecute(const ResourcePool<ResourceType<TM> >& p, const std::string& SQL);
00069 virtual ~SQLExecute();
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 bool addBatch(const SQLExecute<TM, SLMDC>& p);
00081
00082
00083
00084
00085
00086 int batchSize() const;
00087
00088 #ifndef FATALMIND_TEST_SHOW_PROTECTED
00089 protected:
00090 #endif
00091 SQLExecute(const this_t&);
00092 virtual Clone* DoClone() const;
00093 void _execute(fatalmind::oracleResource<TM>&,StatementCache&);
00094 bool push_onto_BatchParamSizes(const typename super::super_bind::_argst& p);
00095
00096 virtual const std::string& getCommandName() const;
00097 static const std::string _SQLExecuteName;
00098
00099
00100
00101
00102
00103
00104 void throwBatchException() const;
00105
00106
00107
00108
00109 int getBatchExceptionOffset() const;
00110
00111 typedef std::vector<typename super::super_bind::_argst> batchParams_t;
00112 batchParams_t batchParams;
00113 std::vector<gc_ptr<RawBuffer> > batchBuffers;
00114
00115
00116
00117
00118
00119
00120
00121 mutable std::deque<OracleExceptionFactory> batchedExceptions;
00122 mutable std::deque<int> batchedExceptionOffsets;
00123
00124
00125
00126
00127 void real_bind_batch(oracleHandles&);
00128
00129 private:
00130 class SQLExecuteBatchArguementsImpl;
00131 gc_ptr<SQLExecuteBatchArguementsImpl> batchParamData;
00132
00133
00134 this_t& operator=(const this_t&);
00135
00136 friend
00137 class oracle::OptimizedBatchCommand<Command<oracle::ResourceType<TM, SLMDC> > >;
00138 };
00139
00140
00141 }
00142 }
00143 #endif