mysql_db is untested because we have no sponsor with a mysql database
authorMarkus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 17:58:15 +0100
changeset 22 0db9235d68d9
parent 21 403742321c65
child 23 7acfc5eda7ed
mysql_db is untested because we have no sponsor with a mysql database committer: Markus Bröker <mbroeker@largo.homelinux.org>
db_bridge/mysql_db.cpp
--- 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)) {