diff options
Diffstat (limited to 'libpqpp/pq-command.h')
-rw-r--r-- | libpqpp/pq-command.h | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/libpqpp/pq-command.h b/libpqpp/pq-command.h index 101afd8..839c991 100644 --- a/libpqpp/pq-command.h +++ b/libpqpp/pq-command.h @@ -1,72 +1,69 @@ #ifndef PQ_COMMAND_H #define PQ_COMMAND_H +#include "pq-connection.h" #include <command.h> #include <libpq-fe.h> -#include <vector> #include <memory> +#include <vector> #include <visibility.h> -#include "pq-connection.h" namespace PQ { class Connection; class DLL_PUBLIC CommandOptions : public DB::CommandOptions { - public: - CommandOptions(std::size_t, const DB::CommandOptionsMap &); - explicit CommandOptions(std::size_t hash, - unsigned int fetchTuples = 35, - bool useCursor = true, - bool fetchBinary = false); + public: + CommandOptions(std::size_t, const DB::CommandOptionsMap &); + explicit CommandOptions( + std::size_t hash, unsigned int fetchTuples = 35, bool useCursor = true, bool fetchBinary = false); - unsigned int fetchTuples; - bool useCursor; - bool fetchBinary; + unsigned int fetchTuples; + bool useCursor; + bool fetchBinary; }; using CommandOptionsPtr = std::shared_ptr<CommandOptions>; using CommandOptionsCPtr = std::shared_ptr<const CommandOptions>; class Command : public virtual DB::Command { - public: - Command(Connection *, const std::string & sql, const DB::CommandOptionsCPtr &); + public: + Command(Connection *, const std::string & sql, const DB::CommandOptionsCPtr &); + + void bindParamI(unsigned int, int) override; + void bindParamI(unsigned int, long int) override; + void bindParamI(unsigned int, long long int) override; + void bindParamI(unsigned int, unsigned int) override; + void bindParamI(unsigned int, long unsigned int) override; + void bindParamI(unsigned int, long long unsigned int) override; - void bindParamI(unsigned int, int) override; - void bindParamI(unsigned int, long int) override; - void bindParamI(unsigned int, long long int) override; - void bindParamI(unsigned int, unsigned int) override; - void bindParamI(unsigned int, long unsigned int) override; - void bindParamI(unsigned int, long long unsigned int) override; + void bindParamB(unsigned int, bool) override; - void bindParamB(unsigned int, bool) override; + void bindParamF(unsigned int, double) override; + void bindParamF(unsigned int, float) override; - void bindParamF(unsigned int, double) override; - void bindParamF(unsigned int, float) override; + void bindParamS(unsigned int, const Glib::ustring &) override; + void bindParamS(unsigned int, const std::string_view &) override; - void bindParamS(unsigned int, const Glib::ustring&) override; - void bindParamS(unsigned int, const std::string_view&) override; + void bindParamT(unsigned int, const boost::posix_time::time_duration &) override; + void bindParamT(unsigned int, const boost::posix_time::ptime &) override; - void bindParamT(unsigned int, const boost::posix_time::time_duration &) override; - void bindParamT(unsigned int, const boost::posix_time::ptime &) override; + void bindParamBLOB(unsigned int, const DB::Blob &) override; - void bindParamBLOB(unsigned int, const DB::Blob &) override; + void bindNull(unsigned int) override; - void bindNull(unsigned int) override; - protected: - void prepareSql(std::stringstream & psql, const std::string & sql) const; - Connection::StatementHash hash; - const std::string stmntName; - Connection * const c; + protected: + void prepareSql(std::stringstream & psql, const std::string & sql) const; + Connection::StatementHash hash; + const std::string stmntName; + Connection * const c; - void paramsAtLeast(unsigned int); - template<typename ... T> - void paramSet(unsigned int, const T & ... t); - void paramSet(unsigned int, const std::string_view &); - std::vector<const char *> values; - std::vector<int> lengths; - std::vector<int> formats; - std::vector<std::unique_ptr<std::string>> bufs; + void paramsAtLeast(unsigned int); + template<typename... T> void paramSet(unsigned int, const T &... t); + void paramSet(unsigned int, const std::string_view &); + std::vector<const char *> values; + std::vector<int> lengths; + std::vector<int> formats; + std::vector<std::unique_ptr<std::string>> bufs; }; } #endif - |