summaryrefslogtreecommitdiff
path: root/libpqpp/selectcommand.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2015-04-29 20:43:50 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2015-04-29 20:43:50 +0100
commit020ca153a7d45e2365a6e2d2c4361b15b2a4393f (patch)
treee24e57a7fd285fc345bb543db87f8a82731439f2 /libpqpp/selectcommand.cpp
parentPass include dirs to slice tools (diff)
downloadlibdbpp-postgresql-020ca153a7d45e2365a6e2d2c4361b15b2a4393f.tar.bz2
libdbpp-postgresql-020ca153a7d45e2365a6e2d2c4361b15b2a4393f.tar.xz
libdbpp-postgresql-020ca153a7d45e2365a6e2d2c4361b15b2a4393f.zip
Centralize all the column reference storage logic
Diffstat (limited to 'libpqpp/selectcommand.cpp')
-rw-r--r--libpqpp/selectcommand.cpp43
1 files changed, 1 insertions, 42 deletions
diff --git a/libpqpp/selectcommand.cpp b/libpqpp/selectcommand.cpp
index 9854216..359cdfd 100644
--- a/libpqpp/selectcommand.cpp
+++ b/libpqpp/selectcommand.cpp
@@ -26,9 +26,6 @@ PQ::SelectCommand::~SelectCommand()
PQclear(execRes);
}
}
- for (unsigned int f = 0; f < fields.size(); f += 1) {
- delete fields[f];
- }
}
void
@@ -63,11 +60,8 @@ PQ::SelectCommand::execute()
PGRES_COMMAND_OK);
fetchTuples();
unsigned int nFields = PQnfields(execRes);
- fields.resize(nFields);
for (unsigned int f = 0; f < nFields; f += 1) {
- Column * c = new Column(this, f);
- fields[f] = c;
- fieldsName[c->name] = c;
+ columns.insert(DB::ColumnPtr(new Column(this, f)));
}
executed = true;
}
@@ -103,38 +97,3 @@ PQ::SelectCommand::fetch()
}
}
-const DB::Column&
-PQ::SelectCommand::operator[](unsigned int n) const
-{
- if (n < fields.size()) {
- return *fields[n];
- }
- throw Error();
-}
-
-const DB::Column&
-PQ::SelectCommand::operator[](const Glib::ustring & n) const
-{
- std::map<Glib::ustring, Column *>::const_iterator i = fieldsName.find(n);
- if (i != fieldsName.end()) {
- return *i->second;
- }
- throw Error();
-}
-
-unsigned int
-PQ::SelectCommand::getOrdinal(const Glib::ustring & n) const
-{
- std::map<Glib::ustring, Column *>::const_iterator i = fieldsName.find(n);
- if (i != fieldsName.end()) {
- return i->second->colNo;
- }
- throw Error();
-}
-
-unsigned int
-PQ::SelectCommand::columnCount() const
-{
- return fields.size();
-}
-