#include "msql_acces.h" #include msql_acces::msql_acces() { driver = get_driver_instance(); con = driver->connect("tcp://127.0.0.1:3306", "root", "1234"); con->setSchema("bin_database"); } std::string msql_acces::get_passwd(std::string username){ sql::PreparedStatement *pstmt = con->prepareStatement("select passwd from users where username=?"); pstmt->setString(1,username); sql::ResultSet *res = pstmt->executeQuery(); std::string ret; while(res->next()) ret = res->getString("passwd"); delete res; return ret; }