From fd27b85b004ad13c4139d84a287fd3f3ef444c4b Mon Sep 17 00:00:00 2001 From: randomdan Date: Thu, 5 Aug 2010 23:48:05 +0000 Subject: Cache the result of default column compose Use this cache now lots of things are const refs --- libodbcpp/column.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libodbcpp/column.h') diff --git a/libodbcpp/column.h b/libodbcpp/column.h index 3b3370f..67dd0c4 100644 --- a/libodbcpp/column.h +++ b/libodbcpp/column.h @@ -22,7 +22,7 @@ namespace ODBC { operator Glib::ustring () const; operator struct tm () const; virtual void rebind(Command *, unsigned int col) const = 0; - virtual Glib::ustring compose() const = 0; + virtual const Glib::ustring & compose() const = 0; virtual Glib::ustring compose(const Glib::ustring & fmt) const = 0; virtual int writeToBuf(char ** buf) const = 0; virtual int writeToBuf(char ** buf, const char * fmt) const = 0; @@ -30,6 +30,8 @@ namespace ODBC { const unsigned int colNo; const Glib::ustring name; + protected: + mutable Glib::ustring * composeCache; private: SQLUINTEGER bindSize; // Allocated memory friend class SelectCommand; @@ -40,7 +42,7 @@ namespace ODBC { _Column(const Glib::ustring &, unsigned int); ~_Column() {} void rebind(Command *, unsigned int col) const; - Glib::ustring compose() const; + const Glib::ustring & compose() const; Glib::ustring compose(const Glib::ustring & fmt) const; int writeToBuf(char ** buf) const; int writeToBuf(char ** buf, const char * fmt) const; -- cgit v1.2.3