-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (29 loc) · 795 Bytes
/
main.cpp
File metadata and controls
38 lines (29 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "exerciser.h"
#include "utils.h"
int main (int argc, char *argv[])
{
//Allocate & initialize a Postgres connection object
connection *C;
try{
//Establish a connection to the database
//Parameters: database name, user name, user password
C = new connection("dbname=ACC_BBALL user=postgres password=passw0rd");
if (C->is_open()) {
cout << "Opened database successfully: " << C->dbname() << endl;
} else {
cout << "Can't open database" << endl;
return 1;
}
//drop all tables before recreating
cleanupDB(*C);
createDBTables(*C);
initAllTables(*C);
} catch (const std::exception &e){
cerr << e.what() << std::endl;
return 1;
}
exercise(C);
//Close database connection
C->disconnect();
return 0;
}