diff options
-rw-r--r-- | libodbcpp/command.h | 2 | ||||
-rw-r--r-- | libodbcpp/param.cpp | 2 | ||||
-rw-r--r-- | libodbcpp/param.h | 13 |
3 files changed, 17 insertions, 0 deletions
diff --git a/libodbcpp/command.h b/libodbcpp/command.h index 02347cf..17926f6 100644 --- a/libodbcpp/command.h +++ b/libodbcpp/command.h @@ -21,6 +21,8 @@ namespace ODBC { void bindParamI(unsigned int i, unsigned long int val); void bindParamI(unsigned int i, unsigned long long int val); + void bindParamB(unsigned int i, bool val); + void bindParamF(unsigned int i, double val); void bindParamF(unsigned int i, float val); diff --git a/libodbcpp/param.cpp b/libodbcpp/param.cpp index 8e30f14..b91c07e 100644 --- a/libodbcpp/param.cpp +++ b/libodbcpp/param.cpp @@ -69,6 +69,8 @@ SIMPLEBINDER(unsigned int, UnsignedIntegerParam, I); SIMPLEBINDER(unsigned long int, UnsignedIntegerParam, I); SIMPLEBINDER(unsigned long long int, UnsignedIntegerParam, I); +SIMPLEBINDER(bool, BooleanParam, B); + SIMPLEBINDER(double, FloatingPointParam, F); SIMPLEBINDER(float, FloatingPointParam, F); diff --git a/libodbcpp/param.h b/libodbcpp/param.h index 37f8d5a..53ace67 100644 --- a/libodbcpp/param.h +++ b/libodbcpp/param.h @@ -28,6 +28,19 @@ namespace ODBC { SQLLEN dataLength; }; + class BooleanParam : public Param { + public: + BooleanParam() : Param() { } + BooleanParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } + virtual SQLSMALLINT ctype() const { return SQL_C_BIT; } + virtual SQLSMALLINT stype() const { return SQL_C_BIT; } + virtual SQLULEN size() const { return sizeof(SQLINTEGER); } + virtual SQLINTEGER dp() const { return 0; } + virtual const void * dataAddress() const { return &data; } + void operator=(const SQLINTEGER & d) { data = d; } + protected: + SQLINTEGER data; + }; class SignedIntegerParam : public Param { public: SignedIntegerParam() : Param() { } |