43 " WHERE accountName='%s'" , username.c_str() ))
45 sLog.Error(
"APIServiceDB::GetAccountIdFromUsername()",
"Cannot find accountID for username %s", username.c_str() );
52 sLog.Error(
"APIServiceDB::GetAccountIdFromUsername()",
"res.GetRow(row) failed for unknown reason." );
69 " WHERE userID='%s'" , userID.c_str() ))
71 sLog.Error(
"APIServiceDB::GetAccountIdFromUserID()",
"Cannot find accountID for userID %s", userID.c_str() );
78 sLog.Error(
"APIServiceDB::GetAccountIdFromUserID()",
"res.GetRow(row) failed for unknown reason." );
87 std::string * apiLimitedKey,
uint32 * apiRole)
94 " userID, fullKey, limitedKey, apiRole "
96 " WHERE accountID='%s'" , accountID.c_str() ))
98 sLog.Error(
"APIServiceDB::GetApiAccountInfoUsingAccountID()",
"Cannot find accountID '%s' in 'accountApi' table", accountID.c_str() );
105 sLog.Error(
"APIServiceDB::GetApiAccountInfoUsingAccountID()",
"res.GetRow(row) failed for unknown reason." );
111 *apiLimitedKey = row.
GetText(2);
123 " fullKey, limitedKey, apiRole "
125 " WHERE userID='%s'" , userID.c_str() ))
127 sLog.Error(
"APIServiceDB::GetApiAccountInfoUsingUserID()",
"Cannot find userID '%s' in 'accountApi' table", userID.c_str() );
134 sLog.Error(
"APIServiceDB::GetApiAccountInfoUsingUserID()",
"res.GetRow(row) failed for unknown reason." );
139 *apiLimitedKey = row.
GetText(1);
147 if( apiLimitedKey.length() != 64 )
149 sLog.Error(
"APIServiceDB::UpdateUserIdApiKeyDatabaseRow()",
"limitedApiKey length != 64, but rather %u", apiLimitedKey.length() );
153 if( apiFullKey.length() != 64 )
155 sLog.Error(
"APIServiceDB::UpdateUserIdApiKeyDatabaseRow()",
"fullApiKey length != 64, but rather %u", apiFullKey.length() );
165 " SET fullKey = '%s', limitedKey = '%s'"
166 " WHERE userID = %u",
167 apiFullKey.
c_str(), apiLimitedKey.c_str(), userID ))
169 sLog.Error(
"",
"Error in query: %s.", err.
c_str());
179 if( apiLimitedKey.length() != 64 )
181 sLog.Error(
"APIServiceDB::UpdateUserIdApiKeyDatabaseRow()",
"limitedApiKey length != 64, but rather %u", apiLimitedKey.length() );
185 if( apiFullKey.length() != 64 )
187 sLog.Error(
"APIServiceDB::UpdateUserIdApiKeyDatabaseRow()",
"fullApiKey length != 64, but rather %u", apiFullKey.length() );
196 " accountID, fullKey, limitedKey, apiRole"
198 " %u, '%s', '%s', %u"
200 accountID, apiFullKey.
c_str(), apiLimitedKey.c_str(), apiRole
203 sLog.Error(
"",
"Error in query: %s.", err.
c_str());
219 " WHERE userID = %u",
222 sLog.Error(
"",
"Error in query: %s.", err.
c_str());
bool GetAccountIdFromUsername(std::string username, std::string *accountID)
?
const char * GetText(uint32 index) const
bool UpdateUserIdApiRole(uint32 userID, uint32 apiRole)
?
uint32 GetUInt(uint32 index) const
bool InsertNewUserIdApiKeyInfoToDatabase(uint32 accountID, std::string apiFullKey, std::string apiLimitedKey, uint32 apiRole)
?
bool GetRow(DBResultRow &into)
#define sLog
Evaluates to a NewLog instance.
bool GetAccountIdFromUserID(std::string userID, uint32 *accountID)
?
const char * c_str() const
bool GetApiAccountInfoUsingUserID(std::string userID, std::string *apiFullKey, std::string *apiLimitedKey, uint32 *apiRole)
?
bool GetApiAccountInfoUsingAccountID(std::string accountID, uint32 *userID, std::string *apiFullKey, std::string *apiLimitedKey, uint32 *apiRole)
?
bool UpdateUserIdApiKeyDatabaseRow(uint32 userID, std::string apiFullKey, std::string apiLimitedKey)
?