diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:08:56 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-24 04:08:56 +0000 |
commit | 63d9cbb434ec4f6e828083b99d638127cfce7a95 (patch) | |
tree | 2dfcf95372467a9119147265fccfba058c617b8a /libodbcpp/param.h | |
parent | Use parent glibmm (diff) | |
download | libdbpp-odbc-63d9cbb434ec4f6e828083b99d638127cfce7a95.tar.bz2 libdbpp-odbc-63d9cbb434ec4f6e828083b99d638127cfce7a95.tar.xz libdbpp-odbc-63d9cbb434ec4f6e828083b99d638127cfce7a95.zip |
ODBC files prefixed with odbc-
Diffstat (limited to 'libodbcpp/param.h')
-rw-r--r-- | libodbcpp/param.h | 135 |
1 files changed, 0 insertions, 135 deletions
diff --git a/libodbcpp/param.h b/libodbcpp/param.h deleted file mode 100644 index d695391..0000000 --- a/libodbcpp/param.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef ODBC_PARAM_H -#define ODBC_PARAM_H - -#include <malloc.h> -#include <sqlext.h> -#include <glibmm/ustring.h> -#include "bind.h" -#include <boost/date_time/posix_time/posix_time_types.hpp> - -namespace ODBC { - class Command; - class Param : public virtual Bind { - public: - Param(); - Param(Command *, unsigned int idx); - virtual ~Param() = 0; - void bind() const; - - virtual SQLSMALLINT stype() const = 0; // The SQL type ID - virtual SQLINTEGER dp() const = 0; // The decimal place count - virtual const void * dataAddress() const = 0; // The address of the data - - protected: - friend class Column; - mutable Command * paramCmd; - mutable unsigned int paramIdx; - mutable bool paramBound; // Has SqlBind(...) been called since last change of address? - SQLLEN dataLength; - }; - - class BooleanParam : public Param { - public: - BooleanParam() : Param() { } - BooleanParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_BIT; } - virtual SQLSMALLINT stype() const { return SQL_C_BIT; } - virtual SQLULEN size() const { return sizeof(SQLINTEGER); } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return &data; } - void operator=(const SQLINTEGER & d) { data = d; } - protected: - SQLINTEGER data; - }; - class SignedIntegerParam : public Param { - public: - SignedIntegerParam() : Param() { } - SignedIntegerParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_LONG; } - virtual SQLSMALLINT stype() const { return SQL_C_LONG; } - virtual SQLULEN size() const { return sizeof(SQLINTEGER); } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return &data; } - void operator=(const SQLINTEGER & d) { data = d; } - protected: - SQLINTEGER data; - }; - class UnsignedIntegerParam : public Param { - public: - UnsignedIntegerParam() : Param() { } - UnsignedIntegerParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_ULONG; } - virtual SQLSMALLINT stype() const { return SQL_C_ULONG; } - virtual SQLULEN size() const { return sizeof(SQLUINTEGER); } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return &data; } - void operator=(const SQLUINTEGER & d) { data = d; } - protected: - SQLUINTEGER data; - }; - class FloatingPointParam : public Param { - public: - FloatingPointParam() : Param() { } - FloatingPointParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_DOUBLE; } - virtual SQLSMALLINT stype() const { return SQL_C_DOUBLE; } - virtual SQLULEN size() const { return sizeof(SQLDOUBLE); } - virtual SQLINTEGER dp() const { return 10; } - virtual const void * dataAddress() const { return &data; } - void operator=(const SQLDOUBLE & d) { data = d; } - protected: - SQLDOUBLE data; - }; - class GlibUstringParam : public Param { - public: - GlibUstringParam() : Param() { } - GlibUstringParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_CHAR; } - virtual SQLSMALLINT stype() const { return SQL_CHAR; } - virtual SQLULEN size() const { return data.bytes(); } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return data.data(); } - void operator=(const Glib::ustring & d); - protected: - Glib::ustring data; - }; - class IntervalParam : public Param { - public: - IntervalParam() : Param() { } - IntervalParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_INTERVAL_DAY_TO_SECOND; } - virtual SQLSMALLINT stype() const { return SQL_INTERVAL_DAY_TO_SECOND; } - virtual SQLULEN size() const { return sizeof(SQL_INTERVAL_STRUCT); } - virtual SQLINTEGER dp() const { return boost::posix_time::time_res_traits::num_fractional_digits(); } - virtual const void * dataAddress() const { return &data; } - void operator=(const boost::posix_time::time_duration & d); - protected: - SQL_INTERVAL_STRUCT data; - }; - class TimeStampParam : public Param { - public: - TimeStampParam() : Param() { } - TimeStampParam(Command * c, unsigned int i) : Param(c, i) { bindLen = size(); } - virtual SQLSMALLINT ctype() const { return SQL_C_TYPE_TIMESTAMP; } - virtual SQLSMALLINT stype() const { return SQL_TYPE_TIMESTAMP; } - virtual SQLULEN size() const { return sizeof(SQL_TIMESTAMP_STRUCT); } - virtual SQLINTEGER dp() const { return boost::posix_time::time_res_traits::num_fractional_digits(); } - virtual const void * dataAddress() const { return &data; } - void operator=(const boost::posix_time::ptime & d); - protected: - SQL_TIMESTAMP_STRUCT data; - }; - class NullParam : public Param { - public: - NullParam() : Param() { } - NullParam(Command * c, unsigned int i) : Param(c, i) { bindLen = SQL_NULL_DATA; } - virtual SQLSMALLINT ctype() const { return SQL_C_LONG; } - virtual SQLSMALLINT stype() const { return SQL_C_LONG; } - virtual SQLULEN size() const { return 0; } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return NULL; } - }; -} - -#endif - |