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
commit1ade888ed97c316739f7bbab638d96831fe61303 (patch)
tree360cf016184fe6772ecfaba9186a7ccd6242f85d
parentSupport reading a my.cnf group and correcting passing null to mysql_real_connect (diff)
downloadlibdbpp-mysql-1ade888ed97c316739f7bbab638d96831fe61303.tar.bz2
libdbpp-mysql-1ade888ed97c316739f7bbab638d96831fe61303.tar.xz
libdbpp-mysql-1ade888ed97c316739f7bbab638d96831fe61303.zip
Add support for RDBMS boolean/bit types
-rw-r--r--libmysqlpp/command.cpp8
-rw-r--r--libmysqlpp/command.h8
2 files changed, 13 insertions, 3 deletions
diff --git a/libmysqlpp/command.cpp b/libmysqlpp/command.cpp
index 1b1b4ae..51db90f 100644
--- a/libmysqlpp/command.cpp
+++ b/libmysqlpp/command.cpp
@@ -92,6 +92,14 @@ MySQL::Command::bindParamI(unsigned int n, long long unsigned int v)
binds[n].is_unsigned = 1;
}
void
+MySQL::Command::bindParamB(unsigned int n, bool v)
+{
+ binds[n].buffer_type = MYSQL_TYPE_TINY;
+ binds[n].buffer = realloc(binds[n].buffer, sizeof(bool));
+ *static_cast<bool*>(binds[n].buffer) = (v ? 1 : 0);
+ binds[n].is_unsigned = 1;
+}
+void
MySQL::Command::bindParamF(unsigned int n, double v)
{
binds[n].buffer_type = MYSQL_TYPE_DOUBLE;
diff --git a/libmysqlpp/command.h b/libmysqlpp/command.h
index 21a2e09..72828e0 100644
--- a/libmysqlpp/command.h
+++ b/libmysqlpp/command.h
@@ -19,14 +19,16 @@ namespace MySQL {
void bindParamI(unsigned int, long unsigned int);
void bindParamI(unsigned int, long long unsigned int);
+ void bindParamB(unsigned int, bool);
+
void bindParamF(unsigned int, double);
void bindParamF(unsigned int, float);
-
+
void bindParamS(unsigned int, const Glib::ustring&);
-
+
void bindParamT(unsigned int, const boost::posix_time::time_duration &);
void bindParamT(unsigned int, const boost::posix_time::ptime &);
-
+
void bindNull(unsigned int);
protected:
void bindParams();