]> git.sesse.net Git - ccbs/blob - bigscreen/ccbs_bigscreen.cpp
2dbb34a81fe21ac37550cbac08caaf1332b6bc92
[ccbs] / bigscreen / ccbs_bigscreen.cpp
1 #include <cstdio>
2 #include <unistd.h>
3 #include <pqxx/pqxx>
4 #include "glwindow.h"
5
6 int main(int argc, char **argv)
7 {
8         GLWindow glw("CCBS bigscreen", 800, 600, 32, false, 16, -1);
9         try {
10                 pqxx::connection conn("dbname=ccbs host=sql.samfundet.no user=ccbs password=GeT|>>B_");
11                 pqxx::transaction<> t(conn, "trx");
12
13                 // fetch all songs
14                 pqxx::result res( t.exec("SELECT * FROM songs") );
15                 for (pqxx::result::const_iterator i = res.begin(); i != res.end(); ++i) {
16                         std::fprintf(stderr, "%s\n", i["title"].c_str());
17                 }
18                 t.commit();
19         } catch (const std::exception &e) {
20                 std::fprintf(stderr, "Exception: %s\n", e.what());
21                 exit(1);
22         }
23         
24         return 0;
25 }