diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-04-29 20:43:50 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2015-04-29 20:43:50 +0100 |
commit | 9917fcb8386cf74ef52771f9bae6de2088209466 (patch) | |
tree | 2824d704bbedb7a82a56ca7cf404c263b3ca18a3 /libmysqlpp | |
parent | Ignore Vim swap files (diff) | |
download | libdbpp-mysql-9917fcb8386cf74ef52771f9bae6de2088209466.tar.bz2 libdbpp-mysql-9917fcb8386cf74ef52771f9bae6de2088209466.tar.xz libdbpp-mysql-9917fcb8386cf74ef52771f9bae6de2088209466.zip |
Centralize all the column reference storage logic
Diffstat (limited to 'libmysqlpp')
-rw-r--r-- | libmysqlpp/selectcommand.cpp | 37 | ||||
-rw-r--r-- | libmysqlpp/selectcommand.h | 19 |
2 files changed, 0 insertions, 56 deletions
diff --git a/libmysqlpp/selectcommand.cpp b/libmysqlpp/selectcommand.cpp index b361fb1..41b28b6 100644 --- a/libmysqlpp/selectcommand.cpp +++ b/libmysqlpp/selectcommand.cpp @@ -92,40 +92,3 @@ MySQL::SelectCommand::fetch() } } -const DB::Column& -MySQL::SelectCommand::operator[](unsigned int n) const -{ - if (n < columns.size()) { - return **columns.get<0>().find(n); - } - throw Error(); -} - -const DB::Column& -MySQL::SelectCommand::operator[](const Glib::ustring & n) const -{ - typedef Columns::nth_index<1>::type CbyName; - CbyName::iterator i = columns.get<1>().find(n); - if (i != columns.get<1>().end()) { - return **i; - } - throw Error(); -} - -unsigned int -MySQL::SelectCommand::getOrdinal(const Glib::ustring & n) const -{ - typedef Columns::nth_index<1>::type CbyName; - CbyName::iterator i = columns.get<1>().find(n); - if (i != columns.get<1>().end()) { - return (*i)->colNo; - } - throw Error(); -} - -unsigned int -MySQL::SelectCommand::columnCount() const -{ - return fields.size(); -} - diff --git a/libmysqlpp/selectcommand.h b/libmysqlpp/selectcommand.h index a338599..7ffff54 100644 --- a/libmysqlpp/selectcommand.h +++ b/libmysqlpp/selectcommand.h @@ -2,15 +2,7 @@ #define MY_SELECTCOMMAND_H #include "../libdbpp/selectcommand.h" -#include "../libdbpp/column.h" #include "command.h" -#include <boost/shared_ptr.hpp> -#include <boost/multi_index_container.hpp> -#include <boost/multi_index/indexed_by.hpp> -#include <boost/multi_index/ordered_index.hpp> -#include <boost/multi_index/member.hpp> -#include <vector> -#include <map> namespace MySQL { class Connection; @@ -21,21 +13,10 @@ namespace MySQL { bool fetch(); void execute(); - const DB::Column& operator[](unsigned int) const; - const DB::Column& operator[](const Glib::ustring&) const; - unsigned int columnCount() const; - unsigned int getOrdinal(const Glib::ustring&) const; private: bool executed; Binds fields; - typedef boost::multi_index_container<boost::shared_ptr<ColumnBase>, boost::multi_index::indexed_by< - boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const unsigned int, &DB::Column::colNo>>, - boost::multi_index::ordered_unique<boost::multi_index::member<DB::Column, const Glib::ustring, &DB::Column::name>> - >> Columns; - Columns columns; - - friend class ColumnBase; }; } |