/// \brief Retrieve an Account from the accounts database /// /// @param username Username of the Account to be found /// @param account Account description returned here bool Storage::getAccount(const std::string & username, Atlas::Message::MapType & account) { std::string namestr = "'" + username + "'"; DatabaseResult dr = m_connection.selectSimpleRowBy("accounts", "username", namestr); if (dr.error()) { return false; } if (dr.empty()) { dr.clear(); return false; } if (dr.size() > 1) { return false; } const char * c = dr.field("id"); if (c == 0) { dr.clear(); return false; } std::string id = c; c = dr.field("password"); if (c == 0) { dr.clear(); return false; } std::string password = c; c = dr.field("type"); if (c == 0) { dr.clear(); return false; } std::string type = c; dr.clear(); account["id"] = id; account["username"] = username; account["password"] = password; account["type"] = type; return true; }