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_ORACLEREFTYPE_HH
00025 #define RESOURCEPOOL_ORACLE_ORACLEREFTYPE_HH
00026
00027 #include <memory>
00028
00029 #ifndef OCI_ORACLE
00030 #include <oci.h>
00031 #endif
00032
00033 #include <string>
00034
00035 namespace fatalmind {
00036 namespace oracle {
00037
00038 class oracleRefType {
00039 public:
00040 oracleRefType();
00041 virtual void* ptr() const = 0;
00042 virtual sb4 capacity() const = 0;
00043 virtual ub2 type() const = 0;
00044 virtual void start() = 0;
00045 virtual void done(const ub4 size, void* ptr) = 0;
00046 virtual ~oracleRefType();
00047 dvoid* indptr() const;
00048
00049 sb2 _ind;
00050 };
00051
00052 template<typename T>
00053 class oracleRefTypeImpl: public oracleRefType {
00054 public:
00055 oracleRefTypeImpl(T& val, bool& isnull);
00056 virtual ~oracleRefTypeImpl();
00057
00058 virtual void* ptr() const;
00059 virtual sb4 capacity() const;
00060 virtual ub2 type() const;
00061 virtual void start();
00062 virtual void done(const ub4 size, void* ptr);
00063 virtual T& getValue();
00064
00065 private:
00066 T& val;
00067 bool& isnull;
00068 };
00069
00070 template<>
00071 class oracleRefTypeImpl<std::string>: public oracleRefType {
00072 public:
00073 oracleRefTypeImpl(std::string& val, bool& isnull);
00074 virtual ~oracleRefTypeImpl();
00075
00076 virtual void* ptr() const;
00077 virtual sb4 capacity() const;
00078 virtual ub2 type() const;
00079 virtual void start();
00080 virtual void done(const ub4 size, void* ptr);
00081 private:
00082 std::string& val;
00083 bool& isnull;
00084 sb4 _cap;
00085 bool needsreset;
00086 };
00087
00088
00089 }
00090 }
00091 #endif