db_bridge/mysql_db.cpp
changeset 20 5fec678f931b
parent 17 b3731a25b9ec
child 22 0db9235d68d9
equal deleted inserted replaced
19:933d86c1ff71 20:5fec678f931b
     2  * db_bridge/mysql_db.cpp
     2  * db_bridge/mysql_db.cpp
     3  * Copyright 2008 (C) Markus Broeker
     3  * Copyright 2008 (C) Markus Broeker
     4  */
     4  */
     5 
     5 
     6 #include <mysql_db.h>
     6 #include <mysql_db.h>
       
     7 #include <console.h>
     7 
     8 
     8 MySQL_DB::MySQL_DB (std::string srv, std::string usr, std::string pwd, std::string db)
     9 MySQL_DB::MySQL_DB (std::string srv, std::string usr, std::string pwd, std::string db)
     9 {
    10 {
    10     server = srv;
    11     server = srv;
    11     user = (usr != "") ? usr : getenv ("USER");
    12     user = (usr != "") ? usr : getenv ("USER");
    13     database = db;
    14     database = db;
    14     conn = mysql_init (NULL);
    15     conn = mysql_init (NULL);
    15 
    16 
    16     if (server != "" && pwd == "") {
    17     if (server != "" && pwd == "") {
    17         std::cout << "Passwort von " << user << "@" << server << ": ";
    18         std::cout << "Passwort von " << user << "@" << server << ": ";
    18         std::getline (std::cin, password);
    19         Console::getpass (password);
    19     }
    20     }
    20 }
    21 }
    21 
    22 
    22 MySQL_DB::~MySQL_DB ()
    23 MySQL_DB::~MySQL_DB ()
    23 {
    24 {