equal
deleted
inserted
replaced
3 * Copyright 2008 (C) Markus Broeker |
3 * Copyright 2008 (C) Markus Broeker |
4 */ |
4 */ |
5 |
5 |
6 #include <postgresql_db.h> |
6 #include <postgresql_db.h> |
7 #include <exception> |
7 #include <exception> |
|
8 #include <console.h> |
8 |
9 |
9 PostgreSQL_DB::PostgreSQL_DB (std::string srv, std::string usr, std::string pwd, std::string db) |
10 PostgreSQL_DB::PostgreSQL_DB (std::string srv, std::string usr, std::string pwd, std::string db) |
10 { |
11 { |
11 server = srv; |
12 server = srv; |
12 user = (usr != "") ? usr : getenv ("USER"); |
13 user = (usr != "") ? usr : getenv ("USER"); |
15 |
16 |
16 conninfo = "user=" + user + " dbname=" + database; |
17 conninfo = "user=" + user + " dbname=" + database; |
17 |
18 |
18 if (server != "" && pwd == "") { |
19 if (server != "" && pwd == "") { |
19 std::cout << "Passwort von " << user << "@" << server << ": "; |
20 std::cout << "Passwort von " << user << "@" << server << ": "; |
20 std::getline (std::cin, password); |
21 Console::getpass (password); |
21 conninfo += " host=" + server + " password=" + password; |
22 conninfo += " host=" + server + " password=" + password; |
22 } |
23 } |
23 } |
24 } |
24 |
25 |
25 PostgreSQL_DB::~PostgreSQL_DB () |
26 PostgreSQL_DB::~PostgreSQL_DB () |