equal
deleted
inserted
replaced
|
1 /** |
|
2 * db_bridge/main.cpp |
|
3 * Copyright (C) 2008 Markus Broeker |
|
4 */ |
|
5 |
|
6 #ifdef WITH_POSTGRESQL |
|
7 #include <postgresql_db.h> |
|
8 #else |
|
9 #include <mysql_db.h> |
|
10 #endif |
|
11 |
|
12 int main (int argc, char **argv) |
|
13 { |
|
14 Abstract_DB *db; |
|
15 |
|
16 std::vector <std::string> vec; |
|
17 std::vector <std::vector <std::string> >result; |
|
18 unsigned int i, j; |
|
19 |
|
20 #ifdef WITH_POSTGRESQL |
|
21 db = new PostgreSQL_DB ("", "largo", "", "clubstatistik"); |
|
22 #else |
|
23 db = new MySQL_DB ("localhost", "dbuser", "dbpasswd", "datenbank"); |
|
24 #endif |
|
25 |
|
26 if (db->connect () == false) { |
|
27 std::cerr << "Kann mich nicht zur Datenbank verbinden. Passwoerter falsch?" << std::endl; |
|
28 return EXIT_FAILURE; |
|
29 } |
|
30 |
|
31 result = db->query ("select * from euroleague"); |
|
32 |
|
33 for (i = 0; i < result.size (); i++) { |
|
34 vec = result[i]; |
|
35 for (j = 0; j < vec.size (); j++) { |
|
36 std::cout << vec[j] << " "; |
|
37 } |
|
38 std::cout << std::endl; |
|
39 } |
|
40 |
|
41 delete db; |
|
42 |
|
43 return EXIT_SUCCESS; |
|
44 } |