prepared_statement.hxx
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef PQXX_H_PREPARED_STATEMENT
00019 #define PQXX_H_PREPARED_STATEMENT
00020
00021 #include "pqxx/compiler-public.hxx"
00022 #include "pqxx/compiler-internal-pre.hxx"
00023
00024 #include "pqxx/internal/statement_parameters.hxx"
00025
00026
00027 namespace pqxx
00028 {
00029 class binarystring;
00030 class connection_base;
00031 class transaction_base;
00032 class result;
00033
00034
00036 namespace prepare
00037 {
00123
00124 class PQXX_LIBEXPORT invocation : internal::statement_parameters
00125 {
00126 public:
00127 invocation(transaction_base &, const std::string &statement);
00128
00130 result exec() const;
00131
00133 bool exists() const;
00134
00136 invocation &operator()() { add_param(); return *this; }
00137
00139
00142 template<typename T> invocation &operator()(const T &v)
00143 { add_param(v, true); return *this; }
00144
00146
00149 invocation &operator()(const binarystring &v)
00150 { add_binary_param(v, true); return *this; }
00151
00153
00157 template<typename T> invocation &operator()(const T &v, bool nonnull)
00158 { add_param(v, nonnull); return *this; }
00159
00161
00165 invocation &operator()(const binarystring &v, bool nonnull)
00166 { add_binary_param(v, nonnull); return *this; }
00167
00169
00187 template<typename T> invocation &operator()(T *v, bool nonnull=true)
00188 { add_param(v, nonnull); return *this; }
00189
00191
00195 invocation &operator()(const char *v, bool nonnull=true)
00196 { add_param(v, nonnull); return *this; }
00197
00198 private:
00200 invocation &operator=(const invocation &);
00201
00202 transaction_base &m_home;
00203 const std::string m_statement;
00204 std::vector<std::string> m_values;
00205 std::vector<bool> m_nonnull;
00206
00207 invocation &setparam(const std::string &, bool nonnull);
00208 };
00209
00210
00211 namespace internal
00212 {
00214 struct PQXX_LIBEXPORT prepared_def
00215 {
00217 std::string definition;
00219 bool registered;
00220
00221 prepared_def();
00222 explicit prepared_def(const std::string &);
00223 };
00224
00225 }
00226 }
00227 }
00228
00229 #include "pqxx/compiler-internal-post.hxx"
00230
00231 #endif
00232