From 85b8d8fb245ff3a960d38f92720b1be14edbe52d Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 18 Feb 2005 17:04:18 +0000 Subject: [PATCH] Fetch out some numbers from a table. --- bigscreen/ccbs_bigscreen.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bigscreen/ccbs_bigscreen.cpp b/bigscreen/ccbs_bigscreen.cpp index dc31c06..02ed033 100644 --- a/bigscreen/ccbs_bigscreen.cpp +++ b/bigscreen/ccbs_bigscreen.cpp @@ -9,6 +9,13 @@ int main(int argc, char **argv) try { pqxx::connection conn("dbname=ccbs host=sql.samfundet.no user=ccbs password=GeT|>>B_"); pqxx::transaction<> t(conn, "trx"); + + // fetch all songs + pqxx::result res( t.exec("SELECT * FROM songs") ); + for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) { + std::fprintf(stderr, "%s\n", i[0].as(std::string()).c_str()); + } + t.commit(); } catch (const std::exception &e) { std::fprintf(stderr, "Exception: %s\n", e.what()); exit(1); -- 2.39.2