summaryrefslogtreecommitdiff
path: root/libodbcpp/column.h
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2010-08-05 23:48:05 +0000
committerrandomdan <randomdan@localhost>2010-08-05 23:48:05 +0000
commitfd27b85b004ad13c4139d84a287fd3f3ef444c4b (patch)
treecd089ac1c4f2c93a2ee2911db07f49aa096a83f8 /libodbcpp/column.h
parentFix behaviour of composing a string column (diff)
downloadlibdbpp-odbc-fd27b85b004ad13c4139d84a287fd3f3ef444c4b.tar.bz2
libdbpp-odbc-fd27b85b004ad13c4139d84a287fd3f3ef444c4b.tar.xz
libdbpp-odbc-fd27b85b004ad13c4139d84a287fd3f3ef444c4b.zip
Cache the result of default column compose
Use this cache now lots of things are const refs
Diffstat (limited to 'libodbcpp/column.h')
-rw-r--r--libodbcpp/column.h6
1 files changed, 4 insertions, 2 deletions
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;