#ifndef ODBC_COLUMN_H #define ODBC_COLUMN_H #include #include "bind.h" namespace ODBC { class Column : public BindBase { public: Column(const Glib::ustring &, unsigned int); virtual ~Column(); void bind(SQLHANDLE, SQLUINTEGER, SQLSMALLINT, void*, size_t); operator int () const; operator unsigned int () const; operator long long () const; operator unsigned long long () const; operator double () const; operator float () const; operator const unsigned char * () const; operator const char * () const; operator std::string () const; operator Glib::ustring () const; operator struct tm () const; virtual void rebind(Command *, unsigned int col) const = 0; virtual 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; bool isNull() const; const unsigned int colNo; const Glib::ustring name; private: SQLUINTEGER bindSize; // Allocated memory friend class SelectCommand; }; template class _Column : public Bind, public Column { public: _Column(const Glib::ustring &, unsigned int); ~_Column() {} void rebind(Command *, unsigned int col) 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; }; } void operator << (SQL_TIMESTAMP_STRUCT & target, const struct tm &); void operator << (struct tm &, const SQL_TIMESTAMP_STRUCT & target); #endif