diff options
Diffstat (limited to 'server/src/pracrodaopgsql.cc')
-rw-r--r-- | server/src/pracrodaopgsql.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/server/src/pracrodaopgsql.cc b/server/src/pracrodaopgsql.cc index e48e549..683fe85 100644 --- a/server/src/pracrodaopgsql.cc +++ b/server/src/pracrodaopgsql.cc @@ -242,4 +242,39 @@ unsigned PracroDAOPgsql::nrOfCommits(std::string patientid, std::string macronam return 0; } +void PracroDAOPgsql::addFieldname(std::string name, std::string description) +{ +} + +void PracroDAOPgsql::delFieldname(std::string name) +{ +} + +std::vector<Fieldname> PracroDAOPgsql::getFieldnames() +{ + if(!conn) PRACRO_DEBUG(db, "No pgsql connection\n"); + std::vector<Fieldname> fieldnames; + + std::string query; + try { + pqxx::work W(*conn); + query = "SELECT * FROM fieldnames"; + PRACRO_DEBUG(sql, "Query: %s\n", query.c_str()); + pqxx::result R = W.exec(query); + pqxx::result::const_iterator ri = R.begin(); + while(ri != R.end()) { + Fieldname f; + f.name = (*ri)[0].c_str(); + f.description = (*ri)[1].c_str(); + f.timestamp = atol((*ri)[2].c_str()); + fieldnames.push_back(f); + ri++; + } + } catch (std::exception &e) { + PRACRO_ERR_LOG(db, "Query failed: %s: %s\n", e.what(), query.c_str()); + } + + return fieldnames; +} + #endif/*WITHOUT_DB*/ |