Created
October 14, 2011 22:47
-
-
Save dead1ock/1288583 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool MysqlAccountProvider::AutoRegisterAccount(std::string username, std::string password) { | |
bool success = false; | |
try { | |
string sql = "call sp_CreateAccount(?,?,?);"; | |
auto conn = db_manager_->getConnection("galaxy_manager"); | |
auto statement = shared_ptr<sql::PreparedStatement>(conn->prepareStatement(sql)); | |
statement->setString(1, username); | |
statement->setString(2, password); | |
statement->setString(3, ""); | |
auto rows_updated = statement->executeUpdate(); | |
if (rows_updated > 0) | |
success = true; | |
} catch(sql::SQLException &e) { | |
DLOG(ERROR) << "SQLException at " << __FILE__ << " (" << __LINE__ << ": " << __FUNCTION__ << ")"; | |
DLOG(ERROR) << "MySQL Error: (" << e.getErrorCode() << ": " << e.getSQLState() << ") " << e.what(); | |
} | |
return success; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment