From d0807e56bc2ef9644b27a955e69906f7768b1551 Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 16 Sep 2010 18:14:28 +0000 Subject: Fix ustring builders from chararraycolumn --- libodbcpp/column.cpp | 4 ++-- libodbcpp/column.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libodbcpp') diff --git a/libodbcpp/column.cpp b/libodbcpp/column.cpp index f8a9dfb..9ed6143 100644 --- a/libodbcpp/column.cpp +++ b/libodbcpp/column.cpp @@ -115,14 +115,14 @@ const Glib::ustring & ODBC::CharArrayColumn::compose() const { if (!composeCache) { - composeCache = new Glib::ustring(data.begin(), data.end()); + composeCache = new Glib::ustring(&data.front(), bindLen); } return *composeCache; } Glib::ustring ODBC::CharArrayColumn::compose(const Glib::ustring & fmt) const { - return Glib::ustring::compose(fmt, &data[0]); + return Glib::ustring::compose(fmt, &data.front()); } int ODBC::TimeStampColumn::writeToBuf(char ** buf, const char * fmt) const diff --git a/libodbcpp/column.h b/libodbcpp/column.h index aa2f2a5..472f806 100644 --- a/libodbcpp/column.h +++ b/libodbcpp/column.h @@ -67,8 +67,8 @@ namespace ODBC { virtual Glib::ustring compose(const Glib::ustring & fmt) const; virtual int writeToBuf(char ** buf) const; virtual int writeToBuf(char ** buf, const char * fmt) const; - virtual operator std::string () const { return std::string(data.begin(), data.end()); } - virtual operator Glib::ustring () const { return std::string(data.begin(), data.end()); } + virtual operator std::string () const { return std::string(&data.front(), bindLen); } + virtual operator Glib::ustring () const { return std::string(&data.front(), bindLen); } protected: virtual const Param * meAsAParam() const { return this; } CharArray data; -- cgit v1.2.3