diff options
author | deva <deva> | 2009-07-10 09:59:41 +0000 |
---|---|---|
committer | deva <deva> | 2009-07-10 09:59:41 +0000 |
commit | a619ccc300a00947207600e11fac848b7d37b26b (patch) | |
tree | 1fcfef3cdde2f176368b7a15f795a0ad5508687b /server/src/pracrodaopgsql.cc | |
parent | ca32aba4df1b021b1acaa8f0650fa6a0cd7b9d80 (diff) |
Fieldname queries added macrotool.
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*/ |