summaryrefslogtreecommitdiff
path: root/libodbcpp
diff options
context:
space:
mode:
Diffstat (limited to 'libodbcpp')
-rw-r--r--libodbcpp/command.h2
-rw-r--r--libodbcpp/param.cpp6
-rw-r--r--libodbcpp/param.h10
3 files changed, 18 insertions, 0 deletions
diff --git a/libodbcpp/command.h b/libodbcpp/command.h
index 0517afd..1bc9f6d 100644
--- a/libodbcpp/command.h
+++ b/libodbcpp/command.h
@@ -29,6 +29,8 @@ namespace ODBC {
void bindParamT(unsigned int i, const SQL_TIMESTAMP_STRUCT &);
void bindParamT(unsigned int i, time_t);
+ void bindNull(unsigned int i);
+
const std::string sql;
protected:
friend class Param;
diff --git a/libodbcpp/param.cpp b/libodbcpp/param.cpp
index 9ccb7c9..91fc9e8 100644
--- a/libodbcpp/param.cpp
+++ b/libodbcpp/param.cpp
@@ -80,6 +80,12 @@ SIMPLEBINDER(const SQL_TIMESTAMP_STRUCT &, TimeStampParam, T);
SIMPLEBINDER(time_t, TimeStampParam, T);
void
+ODBC::Command::bindNull(unsigned int i)
+{
+ makeParam<NullParam>(i)->bind();
+}
+
+void
ODBC::GlibUstringParam::operator=(Glib::ustring const & d)
{
const char * addr = data.data();
diff --git a/libodbcpp/param.h b/libodbcpp/param.h
index f845a49..0009956 100644
--- a/libodbcpp/param.h
+++ b/libodbcpp/param.h
@@ -94,6 +94,16 @@ namespace ODBC {
protected:
SQL_TIMESTAMP_STRUCT data;
};
+ class NullParam : public Param {
+ public:
+ NullParam() : Param() { }
+ NullParam(Command * c, unsigned int i) : Param(c, i) { bindLen = SQL_NULL_DATA; }
+ virtual SQLSMALLINT ctype() const { return SQL_C_LONG; }
+ virtual SQLSMALLINT stype() const { return SQL_C_LONG; }
+ virtual SQLINTEGER size() const { return 0; }
+ virtual SQLINTEGER dp() const { return 0; }
+ virtual const void * dataAddress() const { return NULL; }
+ };
}
#endif