summaryrefslogtreecommitdiff
path: root/libodbcpp/column.cpp
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-02-09 01:33:33 +0000
committerrandomdan <randomdan@localhost>2011-02-09 01:33:33 +0000
commit6d7c18f1119de8941c7055910e55c13c411eeb92 (patch)
tree9468662e07280c26e29de53f7fdfa228eb62ecde /libodbcpp/column.cpp
parentAdd missing conversion in generic visitor (diff)
downloadlibdbpp-odbc-6d7c18f1119de8941c7055910e55c13c411eeb92.tar.bz2
libdbpp-odbc-6d7c18f1119de8941c7055910e55c13c411eeb92.tar.xz
libdbpp-odbc-6d7c18f1119de8941c7055910e55c13c411eeb92.zip
Fix the build system to do dependencies properly
Break down libodbcpp into a set of base classes; libdbpp Add a native PostgreSQL implementation of libdbpp; libpqpp Extend project2 rdbms stuff to work with generic connectors Update datasources to specify connector type Build libmisc as .so
Diffstat (limited to 'libodbcpp/column.cpp')
-rw-r--r--libodbcpp/column.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/libodbcpp/column.cpp b/libodbcpp/column.cpp
index 4101b0f..13c5ee1 100644
--- a/libodbcpp/column.cpp
+++ b/libodbcpp/column.cpp
@@ -6,9 +6,8 @@
#include "selectcommand.h"
#include "error.h"
-ODBC::Column::Column(SelectCommand * sc, const Glib::ustring & n, unsigned int i) :
- colNo(i),
- name(n),
+ODBC::Column::Column(SelectCommand * sc, const Glib::ustring & s, unsigned int i) :
+ DB::Column(s, i),
selectCmd(sc)
{
bindLen = 0;
@@ -48,9 +47,9 @@ ODBC::Column::isNull() const
}
void
-ODBC::Column::rebind(Command * cmd, unsigned int idx) const
+ODBC::Column::rebind(DB::Command * cmd, unsigned int idx) const
{
- meAsAParam()->paramCmd = cmd;
+ meAsAParam()->paramCmd = dynamic_cast<ODBC::Command *>(cmd);
meAsAParam()->paramIdx = idx;
meAsAParam()->bind();
}
@@ -60,7 +59,7 @@ ODBC::Column::bind()
{
RETCODE rc = SQLBindCol(selectCmd->hStmt, colNo + 1, ctype(), rwDataAddress(), size(), &bindLen);
if (!SQL_SUCCEEDED(rc)) {
- throw Error(rc, SQL_HANDLE_STMT, selectCmd->hStmt, "%s: Bind column %u", __FUNCTION__, colNo);
+ throw Error(rc, SQL_HANDLE_STMT, selectCmd->hStmt, "ODBC::Column::bind");
}
}
@@ -91,26 +90,26 @@ void operator << (struct tm & target, const SQL_TIMESTAMP_STRUCT & src)
}
void
-ODBC::SignedIntegerColumn::apply(ODBC::HandleField & h) const
+ODBC::SignedIntegerColumn::apply(DB::HandleField & h) const
{
if (isNull()) return h.null();
h.integer(data);
}
void
-ODBC::FloatingPointColumn::apply(ODBC::HandleField & h) const
+ODBC::FloatingPointColumn::apply(DB::HandleField & h) const
{
if (isNull()) return h.null();
h.floatingpoint(data);
}
void
-ODBC::CharArrayColumn::apply(ODBC::HandleField & h) const
+ODBC::CharArrayColumn::apply(DB::HandleField & h) const
{
if (isNull()) return h.null();
- h.string(data, bindLen);
+ h.string(&data.front(), bindLen);
}
void
-ODBC::TimeStampColumn::apply(ODBC::HandleField & h) const
+ODBC::TimeStampColumn::apply(DB::HandleField & h) const
{
if (isNull()) return h.null();
- h.timestamp(data);
+ h.timestamp(*this);
}