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_BIND_HH
00025 #define RESOURCEPOOL_SQL_BIND_HH
00026
00027 #include "ResourcePool/SQL/BindInterface.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
00042 template<class VBC, template <class> class CT>
00043 class Bind: public BindInterface {
00044 public:
00045 typedef VBC _datat;
00046 typedef gc_ptr<VBC> _ptrt;
00047 typedef std::vector<_ptrt> _argst;
00048 protected:
00049 _argst _args;
00050 public:
00051 virtual ~Bind() {
00052 }
00053
00054 virtual void bind(const unsigned int pos, const char& val, bool isnull = false) {
00055 bindTpl(pos, val, isnull);
00056 }
00057 virtual void bind(const unsigned int pos, const signed char& val, bool isnull = false) {
00058 bindTpl(pos, val, isnull);
00059 }
00060 virtual void bind(const unsigned int pos, const unsigned char& val, bool isnull = false) {
00061 bindTpl(pos, val, isnull);
00062 }
00063
00064 virtual void bind(const unsigned int pos, const short int& val, bool isnull = false) {
00065 bindTpl(pos, val, isnull);
00066 }
00067 virtual void bind(const unsigned int pos, const unsigned short int& val, bool isnull = false) {
00068 bindTpl(pos, val, isnull);
00069 }
00070
00071 virtual void bind(const unsigned int pos, const int& val, bool isnull = false) {
00072 bindTpl(pos, val, isnull);
00073 }
00074 virtual void bind(const unsigned int pos, const unsigned int& val, bool isnull = false) {
00075 bindTpl(pos, val, isnull);
00076 }
00077
00078 virtual void bind(const unsigned int pos, const long int& val, bool isnull = false) {
00079 bindTpl(pos, val, isnull);
00080 }
00081 virtual void bind(const unsigned int pos, const unsigned long int& val, bool isnull = false) {
00082 bindTpl(pos, val, isnull);
00083 }
00084
00085 virtual void bind(const unsigned int pos, const float& val, bool isnull = false) {
00086 bindTpl(pos, val, isnull);
00087 }
00088 virtual void bind(const unsigned int pos, const double& val, bool isnull = false) {
00089 bindTpl(pos, val, isnull);
00090 }
00091 virtual void bind(const unsigned int pos, const long double& val, bool isnull = false) {
00092 bindTpl(pos, val, isnull);
00093 }
00094 virtual void bind(const unsigned int pos, const std::string& val, bool isnull = false) {
00095 bindTpl(pos, val, isnull);
00096 }
00097
00098 virtual void clearParameters();
00099
00100 virtual void bindoutputoperator(std::ostream& str) const;
00101 static void bindoutputoperator(std::ostream& str, const _argst&);
00102
00103 private:
00104 template<typename T>
00105 inline
00106 void bindTpl(const unsigned int pos, const T& val, bool nul = false) {
00107 gc_ptr<VBC> ptr(new CT<T>(val, nul));
00108 bindPtr(pos, ptr);
00109 }
00110
00111
00112
00113
00114 void bindPtr(const unsigned int pos, gc_ptr<VBC>& ptr);
00115
00116 };
00117
00118 }
00119 }
00120
00121 #endif