diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 05:01:53 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-12-29 06:00:07 +0000 |
commit | 753922f1b924ca3431abfe939fc07d7210698c4d (patch) | |
tree | 5e49913ba04accad802e1c8bdbe32bc6227c05ce | |
parent | Non-const command getters (diff) | |
download | libdbpp-odbc-753922f1b924ca3431abfe939fc07d7210698c4d.tar.bz2 libdbpp-odbc-753922f1b924ca3431abfe939fc07d7210698c4d.tar.xz libdbpp-odbc-753922f1b924ca3431abfe939fc07d7210698c4d.zip |
Add missing override attribute
-rw-r--r-- | libodbcpp/odbc-column.h | 78 | ||||
-rw-r--r-- | libodbcpp/odbc-command.h | 27 | ||||
-rw-r--r-- | libodbcpp/odbc-connection.h | 16 | ||||
-rw-r--r-- | libodbcpp/odbc-modifycommand.h | 2 | ||||
-rw-r--r-- | libodbcpp/odbc-param.h | 80 | ||||
-rw-r--r-- | libodbcpp/odbc-selectcommand.h | 4 |
6 files changed, 104 insertions, 103 deletions
diff --git a/libodbcpp/odbc-column.h b/libodbcpp/odbc-column.h index 678a042..b914793 100644 --- a/libodbcpp/odbc-column.h +++ b/libodbcpp/odbc-column.h @@ -34,8 +34,8 @@ namespace ODBC { virtual operator struct tm () const { throw std::bad_cast(); } virtual operator SQL_TIMESTAMP_STRUCT () const { throw std::bad_cast(); } - bool isNull() const; - virtual void apply(DB::HandleField &) const = 0; + bool isNull() const override; + virtual void apply(DB::HandleField &) const override = 0; const SelectCommand * selectCmd; protected: @@ -50,19 +50,19 @@ namespace ODBC { { data.resize(std::max<SQLULEN>(sizeHint, 64) + 1); } - virtual SQLSMALLINT ctype() const { return SQL_C_CHAR; } - virtual SQLSMALLINT stype() const { return SQL_CHAR; } - virtual SQLULEN size() const { return data.size(); } - virtual SQLINTEGER dp() const { return 0; } - virtual const void * dataAddress() const { return &data.front(); } - virtual void * rwDataAddress() { return &data.front(); } + virtual SQLSMALLINT ctype() const override { return SQL_C_CHAR; } + virtual SQLSMALLINT stype() const override { return SQL_CHAR; } + virtual SQLULEN size() const override { return data.size(); } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return &data.front(); } + virtual void * rwDataAddress() override { return &data.front(); } void operator=(const Glib::ustring & d); - bool resize(); - virtual operator std::string () const { return std::string(&data.front(), bindLen); } - virtual operator Glib::ustring () const { return std::string(&data.front(), bindLen); } - virtual void apply(DB::HandleField &) const; + bool resize() override; + virtual operator std::string () const override { return std::string(&data.front(), bindLen); } + virtual operator Glib::ustring () const override { return std::string(&data.front(), bindLen); } + virtual void apply(DB::HandleField &) const override; protected: - virtual const Param * meAsAParam() const { return this; } + virtual const Param * meAsAParam() const override { return this; } CharArray data; }; class SignedIntegerColumn : public Column, public SignedIntegerParam { @@ -70,21 +70,21 @@ namespace ODBC { SignedIntegerColumn(SelectCommand * sc, const Glib::ustring & n, unsigned int i) : DB::Column(n, i), Column(sc, n, i) { } - virtual SQLSMALLINT ctype() const { return SignedIntegerParam::ctype(); } - virtual SQLULEN size() const { return SignedIntegerParam::size(); } - virtual void * rwDataAddress() { return &data; } - virtual operator int () const { return data; } - virtual operator long () const { return data; } - virtual operator long long () const { return data; } - virtual const Param * meAsAParam() const { return this; } - virtual void apply(DB::HandleField &) const; + virtual SQLSMALLINT ctype() const override { return SignedIntegerParam::ctype(); } + virtual SQLULEN size() const override { return SignedIntegerParam::size(); } + virtual void * rwDataAddress() override { return &data; } + virtual operator int () const override { return data; } + virtual operator long () const override { return data; } + virtual operator long long () const override { return data; } + virtual const Param * meAsAParam() const override { return this; } + virtual void apply(DB::HandleField &) const override; }; #ifdef COMPLETENESS class UnsignedIntegerColumn : public Column, public UnsignedIntegerParam { public: UnsignedIntegerColumn(SelectCommand * sc, const Glib::ustring & n, unsigned int i) : Column(sc, n, i) { } - virtual const Param * meAsAParam() const { return this; } + virtual const Param * meAsAParam() const override { return this; } }; #endif class FloatingPointColumn : public Column, public FloatingPointParam { @@ -92,37 +92,37 @@ namespace ODBC { FloatingPointColumn(SelectCommand * sc, const Glib::ustring & n, unsigned int i) : DB::Column(n, i), Column(sc, n, i) { } - virtual SQLSMALLINT ctype() const { return FloatingPointParam::ctype(); } - virtual SQLULEN size() const { return FloatingPointParam::size(); } - virtual void * rwDataAddress() { return &data; } - virtual operator double () const { return data; } - virtual operator float () const { return data; } - virtual const Param * meAsAParam() const { return this; } - virtual void apply(DB::HandleField &) const; + virtual SQLSMALLINT ctype() const override { return FloatingPointParam::ctype(); } + virtual SQLULEN size() const override { return FloatingPointParam::size(); } + virtual void * rwDataAddress() override { return &data; } + virtual operator double () const override { return data; } + virtual operator float () const override { return data; } + virtual const Param * meAsAParam() const override { return this; } + virtual void apply(DB::HandleField &) const override; }; class IntervalColumn : public Column, public IntervalParam { public: IntervalColumn(SelectCommand * sc, const Glib::ustring & n, unsigned int i) : DB::Column(n, i), Column(sc, n, i) { } - virtual SQLSMALLINT ctype() const { return IntervalParam::ctype(); } - virtual SQLULEN size() const { return IntervalParam::size(); } - virtual void * rwDataAddress() { return &data; } + virtual SQLSMALLINT ctype() const override { return IntervalParam::ctype(); } + virtual SQLULEN size() const override { return IntervalParam::size(); } + virtual void * rwDataAddress() override { return &data; } virtual operator boost::posix_time::time_duration () const; - virtual const Param * meAsAParam() const { return this; } - virtual void apply(DB::HandleField &) const; + virtual const Param * meAsAParam() const override { return this; } + virtual void apply(DB::HandleField &) const override; }; class TimeStampColumn : public Column, public TimeStampParam { public: TimeStampColumn(SelectCommand * sc, const Glib::ustring & n, unsigned int i) : DB::Column(n, i), Column(sc, n, i) { } - virtual SQLSMALLINT ctype() const { return TimeStampParam::ctype(); } - virtual SQLULEN size() const { return TimeStampParam::size(); } - virtual void * rwDataAddress() { return &data; } + virtual SQLSMALLINT ctype() const override { return TimeStampParam::ctype(); } + virtual SQLULEN size() const override { return TimeStampParam::size(); } + virtual void * rwDataAddress() override { return &data; } virtual operator boost::posix_time::ptime () const; - virtual const Param * meAsAParam() const { return this; } - virtual void apply(DB::HandleField &) const; + virtual const Param * meAsAParam() const override { return this; } + virtual void apply(DB::HandleField &) const override; }; } diff --git a/libodbcpp/odbc-command.h b/libodbcpp/odbc-command.h index d7173e3..ab3f65b 100644 --- a/libodbcpp/odbc-command.h +++ b/libodbcpp/odbc-command.h @@ -14,30 +14,31 @@ namespace ODBC { Command(const Connection &, const std::string & sql); virtual ~Command() = 0; - void bindParamI(unsigned int i, int val); - void bindParamI(unsigned int i, long val); - void bindParamI(unsigned int i, long long val); - void bindParamI(unsigned int i, unsigned int val); - void bindParamI(unsigned int i, unsigned long int val); - void bindParamI(unsigned int i, unsigned long long int val); + void bindParamI(unsigned int i, int val) override; + void bindParamI(unsigned int i, long val) override; + void bindParamI(unsigned int i, long long val) override; + void bindParamI(unsigned int i, unsigned int val) override; + void bindParamI(unsigned int i, unsigned long int val) override; + void bindParamI(unsigned int i, unsigned long long int val) override; - void bindParamB(unsigned int i, bool val); + void bindParamB(unsigned int i, bool val) override; - void bindParamF(unsigned int i, double val); - void bindParamF(unsigned int i, float val); + void bindParamF(unsigned int i, double val) override; + void bindParamF(unsigned int i, float val) override; - void bindParamS(unsigned int i, const Glib::ustring &); + void bindParamS(unsigned int i, const Glib::ustring &) override; - void bindParamT(unsigned int i, const boost::posix_time::time_duration &); - void bindParamT(unsigned int i, const boost::posix_time::ptime &); + void bindParamT(unsigned int i, const boost::posix_time::time_duration &) override; + void bindParamT(unsigned int i, const boost::posix_time::ptime &) override; - void bindNull(unsigned int i); + void bindNull(unsigned int i) override; protected: friend class Param; friend class Column; SQLHSTMT hStmt; const Connection& connection; + private: Params params; diff --git a/libodbcpp/odbc-connection.h b/libodbcpp/odbc-connection.h index 8c14af4..7fe5c56 100644 --- a/libodbcpp/odbc-connection.h +++ b/libodbcpp/odbc-connection.h @@ -21,18 +21,18 @@ namespace ODBC { SQLHENV env; SQLHDBC conn; - void finish() const; - int beginTx() const; - int commitTx() const; - int rollbackTx() const; + void finish() const override; + int beginTx() const override; + int commitTx() const override; + int rollbackTx() const override; void abortTx() const; bool txIsAborted() const; - bool inTx() const; - void ping() const; + bool inTx() const override; + void ping() const override; std::string getAttrStr(SQLINTEGER) const; SQLINTEGER getAttrInt(SQLINTEGER) const; - DB::BulkDeleteStyle bulkDeleteStyle() const; - DB::BulkUpdateStyle bulkUpdateStyle() const; + DB::BulkDeleteStyle bulkDeleteStyle() const override; + DB::BulkUpdateStyle bulkUpdateStyle() const override; DB::SelectCommand * newSelectCommand(const std::string & sql) override; DB::ModifyCommand * newModifyCommand(const std::string & sql) override; diff --git a/libodbcpp/odbc-modifycommand.h b/libodbcpp/odbc-modifycommand.h index 5b2a4f4..796ee2f 100644 --- a/libodbcpp/odbc-modifycommand.h +++ b/libodbcpp/odbc-modifycommand.h @@ -10,7 +10,7 @@ namespace ODBC { ModifyCommand(const Connection &, const std::string & sql); ~ModifyCommand(); // Execute the command and return effected row count - unsigned int execute(bool allowNoChange = true); + unsigned int execute(bool allowNoChange = true) override; }; } diff --git a/libodbcpp/odbc-param.h b/libodbcpp/odbc-param.h index ca49c46..96ab7f3 100644 --- a/libodbcpp/odbc-param.h +++ b/libodbcpp/odbc-param.h @@ -32,11 +32,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_BIT; } + virtual SQLSMALLINT stype() const override { return SQL_C_BIT; } + virtual SQLULEN size() const override { return sizeof(SQLINTEGER); } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return &data; } void operator=(const SQLINTEGER & d) { data = d; } protected: SQLINTEGER data; @@ -45,11 +45,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_LONG; } + virtual SQLSMALLINT stype() const override { return SQL_C_LONG; } + virtual SQLULEN size() const override { return sizeof(SQLINTEGER); } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return &data; } void operator=(const SQLINTEGER & d) { data = d; } protected: SQLINTEGER data; @@ -58,11 +58,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_ULONG; } + virtual SQLSMALLINT stype() const override { return SQL_C_ULONG; } + virtual SQLULEN size() const override { return sizeof(SQLUINTEGER); } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return &data; } void operator=(const SQLUINTEGER & d) { data = d; } protected: SQLUINTEGER data; @@ -71,11 +71,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_DOUBLE; } + virtual SQLSMALLINT stype() const override { return SQL_C_DOUBLE; } + virtual SQLULEN size() const override { return sizeof(SQLDOUBLE); } + virtual SQLINTEGER dp() const override { return 10; } + virtual const void * dataAddress() const override { return &data; } void operator=(const SQLDOUBLE & d) { data = d; } protected: SQLDOUBLE data; @@ -84,11 +84,11 @@ namespace ODBC { 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(); } + virtual SQLSMALLINT ctype() const override { return SQL_C_CHAR; } + virtual SQLSMALLINT stype() const override { return SQL_CHAR; } + virtual SQLULEN size() const override { return data.bytes(); } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return data.data(); } void operator=(const Glib::ustring & d); protected: Glib::ustring data; @@ -97,11 +97,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_INTERVAL_DAY_TO_SECOND; } + virtual SQLSMALLINT stype() const override { return SQL_INTERVAL_DAY_TO_SECOND; } + virtual SQLULEN size() const override { return sizeof(SQL_INTERVAL_STRUCT); } + virtual SQLINTEGER dp() const override { return boost::posix_time::time_res_traits::num_fractional_digits(); } + virtual const void * dataAddress() const override { return &data; } void operator=(const boost::posix_time::time_duration & d); protected: SQL_INTERVAL_STRUCT data; @@ -110,11 +110,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_TYPE_TIMESTAMP; } + virtual SQLSMALLINT stype() const override { return SQL_TYPE_TIMESTAMP; } + virtual SQLULEN size() const override { return sizeof(SQL_TIMESTAMP_STRUCT); } + virtual SQLINTEGER dp() const override { return boost::posix_time::time_res_traits::num_fractional_digits(); } + virtual const void * dataAddress() const override { return &data; } void operator=(const boost::posix_time::ptime & d); protected: SQL_TIMESTAMP_STRUCT data; @@ -123,11 +123,11 @@ namespace ODBC { 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; } + virtual SQLSMALLINT ctype() const override { return SQL_C_LONG; } + virtual SQLSMALLINT stype() const override { return SQL_C_LONG; } + virtual SQLULEN size() const override { return 0; } + virtual SQLINTEGER dp() const override { return 0; } + virtual const void * dataAddress() const override { return NULL; } }; } diff --git a/libodbcpp/odbc-selectcommand.h b/libodbcpp/odbc-selectcommand.h index 1fb2220..2d4311a 100644 --- a/libodbcpp/odbc-selectcommand.h +++ b/libodbcpp/odbc-selectcommand.h @@ -10,8 +10,8 @@ namespace ODBC { public: SelectCommand (const Connection &, const std::string & sql); ~SelectCommand(); - bool fetch(); - void execute(); + bool fetch() override; + void execute() override; private: bool fetch(SQLSMALLINT orientation = SQL_FETCH_NEXT, SQLLEN offset = 0); |