summaryrefslogtreecommitdiff
path: root/libodbcpp/column.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libodbcpp/column.cpp')
-rw-r--r--libodbcpp/column.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/libodbcpp/column.cpp b/libodbcpp/column.cpp
index d4b6446..386cbfd 100644
--- a/libodbcpp/column.cpp
+++ b/libodbcpp/column.cpp
@@ -4,10 +4,10 @@
#include "command.h"
#include "error.h"
-ODBC::Column::Column(String n, unsigned int i) :
+ODBC::Column::Column(const Glib::ustring & n, unsigned int i) :
colNo(i),
name(n),
- fresh(false)
+ bindSize(0)
{
}
@@ -15,6 +15,12 @@ ODBC::Column::~Column()
{
}
+bool
+ODBC::Column::isNull() const
+{
+ return (bindLen == SQL_NULL_DATA);
+}
+
#define ODBC_DEFAULT_COLUMN_CAST(ctype, rtype) \
ODBC::Column::operator rtype() const { \
return (dynamic_cast<const _Column<ctype>& >(*this)).value; \
@@ -27,7 +33,9 @@ ODBC_DEFAULT_COLUMN_CAST(SQLINTEGER, int);
ODBC_DEFAULT_COLUMN_CAST(SQLDOUBLE, double);
ODBC_DEFAULT_COLUMN_CAST(SQLDOUBLE, float);
ODBC_DEFAULT_COLUMN_CAST(SQLCHAR*, const unsigned char *);
-ODBC_DEFAULT_COLUMN_CAST(SQLCHAR*, String);
+ODBC::Column::operator Glib::ustring() const {
+ return Glib::ustring((const char *)((dynamic_cast<const _Column<SQLCHAR*>& >(*this)).value));
+}
ODBC::Column::operator std::string() const {
return (const char*)((dynamic_cast<const _Column<SQLCHAR*>& >(*this)).value);
}
@@ -65,7 +73,10 @@ namespace ODBC {
REBIND(double, bindParamF)
REBIND(float, bindParamF)
REBIND(SQL_TIMESTAMP_STRUCT, bindParamT)
- REBIND(unsigned char *, bindParamS)
+ template<> void _Column<unsigned char *>::rebind(Command * cmd, unsigned int col) const \
+ {
+ cmd->bindParamS(col, (char *)value);
+ }
template <>
int