db_bridge/mysql_db.cpp
changeset 22 0db9235d68d9
parent 20 5fec678f931b
child 40 be3f5582b839
--- a/db_bridge/mysql_db.cpp
+++ b/db_bridge/mysql_db.cpp
@@ -8,13 +8,13 @@
 
 MySQL_DB::MySQL_DB (std::string srv, std::string usr, std::string pwd, std::string db)
 {
-    server = srv;
+    server = (srv != "") ? srv : "localhost";
     user = (usr != "") ? usr : getenv ("USER");
     password = pwd;
     database = db;
     conn = mysql_init (NULL);
 
-    if (server != "" && pwd == "") {
+    if (pwd == "") {
         std::cout << "Passwort von " << user << "@" << server << ": ";
         Console::getpass (password);
     }
@@ -30,7 +30,7 @@
 
 bool MySQL_DB::connect ()
 {
-    std::cerr << "Verbindungsparameter:" << " host=" << ((server != "") ? server : "LOCAL")
+    std::cerr << "Verbindungsparameter:" << " host=" << server
         << " user=" << user << " password=" << password << " database=" << database << std::endl;
 
     if (!mysql_real_connect (conn, server.c_str (), user.c_str (), password.c_str (), database.c_str (), 0, NULL, 0)) {