summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-05-02 18:41:53 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-05-02 18:41:53 +0100
commit38b3452daeae0085506f5b4661203fb74a9b7840 (patch)
treed0d8c55a7785582d8a54755d738f78573f288fa2
parentCentralize all the column reference storage logic (diff)
downloadlibdbpp-odbc-38b3452daeae0085506f5b4661203fb74a9b7840.tar.bz2
libdbpp-odbc-38b3452daeae0085506f5b4661203fb74a9b7840.tar.xz
libdbpp-odbc-38b3452daeae0085506f5b4661203fb74a9b7840.zip
Add support for RDBMS boolean/bit types
-rw-r--r--libodbcpp/command.h2
-rw-r--r--libodbcpp/param.cpp2
-rw-r--r--libodbcpp/param.h13
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() { }