-#include <stdio.h>
+#include <cstdio>
#include <unistd.h>
+#include <pqxx/pqxx>
#include "glwindow.h"
int main(int argc, char **argv)
{
GLWindow glw("CCBS bigscreen", 800, 600, 32, false, 16, -1);
- sleep(5);
+ 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["title"].c_str());
+ }
+ t.commit();
+ } catch (const std::exception &e) {
+ std::fprintf(stderr, "Exception: %s\n", e.what());
+ exit(1);
+ }
+
return 0;
}