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_SQL_BINDOUT_HH
00025 #define RESOURCEPOOL_SQL_BINDOUT_HH
00026
00027 #include "ResourcePool/SQL/BindOutInterface.hh"
00028
00029 #ifndef INCLUDED_GC_PTR_HH
00030 #include "mm/gc_ptr.hh"
00031 #endif
00032
00033 #include <vector>
00034
00035 namespace fatalmind {
00036 namespace SQL {
00037
00038
00043 template<class VBC, template <class> class CT>
00044 class BindOut: public BindOutInterface {
00045 public:
00046 virtual ~BindOut();
00047
00048 virtual void bindout(const unsigned int pos, char& val, bool& isnull = BindOutInterface::notnullconstant) {
00049 bindoutTpl(pos, val, isnull);
00050 }
00051 virtual void bindout(const unsigned int pos, signed char& val, bool& isnull = BindOutInterface::notnullconstant) {
00052 bindoutTpl(pos, val, isnull);
00053 }
00054 virtual void bindout(const unsigned int pos, unsigned char& val, bool& isnull = BindOutInterface::notnullconstant) {
00055 bindoutTpl(pos, val, isnull);
00056 }
00057
00058 virtual void bindout(const unsigned int pos, short int& val, bool& isnull = BindOutInterface::notnullconstant) {
00059 bindoutTpl(pos, val, isnull);
00060 }
00061 virtual void bindout(const unsigned int pos, unsigned short int& val, bool& isnull = BindOutInterface::notnullconstant) {
00062 bindoutTpl(pos, val, isnull);
00063 }
00064
00065 virtual void bindout(const unsigned int pos, int& val, bool& isnull = BindOutInterface::notnullconstant) {
00066 bindoutTpl(pos, val, isnull);
00067 }
00068 virtual void bindout(const unsigned int pos, unsigned int& val, bool& isnull = BindOutInterface::notnullconstant) {
00069 bindoutTpl(pos, val, isnull);
00070 }
00071
00072 virtual void bindout(const unsigned int pos, long int& val, bool& isnull = BindOutInterface::notnullconstant) {
00073 bindoutTpl(pos, val, isnull);
00074 }
00075 virtual void bindout(const unsigned int pos, unsigned long int& val, bool& isnull = BindOutInterface::notnullconstant) {
00076 bindoutTpl(pos, val, isnull);
00077 }
00078
00079 virtual void bindout(const unsigned int pos, float& val, bool& isnull = BindOutInterface::notnullconstant) {
00080 bindoutTpl(pos, val, isnull);
00081 }
00082 virtual void bindout(const unsigned int pos, double& val, bool& isnull = BindOutInterface::notnullconstant) {
00083 bindoutTpl(pos, val, isnull);
00084 }
00085 virtual void bindout(const unsigned int pos, long double& val, bool& isnull = BindOutInterface::notnullconstant) {
00086 bindoutTpl(pos, val, isnull);
00087 }
00088
00089 virtual void bindout(const unsigned int pos, std::string& val, bool& isnull = BindOutInterface::notnullconstant) {
00090 bindoutTpl(pos, val, isnull);
00091 }
00092
00093 protected:
00094 VBC& getOutParam(const unsigned int pos);
00095
00096 typedef gc_ptr<VBC> _refT;
00097 typedef std::vector<_refT> _outparamt;
00098 _outparamt _outparam;
00099
00100 typename _outparamt::const_iterator _begin;
00101 typename _outparamt::const_iterator _end;
00102
00103 void setIterators() {
00104 _begin = _outparam.begin();
00105 _end = _outparam.end();
00106 }
00107 private:
00108 template<typename T>
00109 inline
00110 void bindoutTpl(const unsigned int pos, T& val, bool& isnull = BindOutInterface::notnullconstant) {
00111 gc_ptr<VBC> ptr(new CT<T>(val, isnull));
00112 bindoutPtr(pos, ptr);
00113 }
00114
00115 void bindoutPtr(const unsigned int pos, gc_ptr<VBC>& ptr);
00116 };
00117
00118
00119 }
00120 }
00121 #endif