ForgottenNot
Member
- Joined
- Feb 10, 2023
- Messages
- 192
- Reaction score
- 19
Hello I've editing this code a lot in order to access to my server using multiworld.
I use tfs 1.4
I can log in to the server but i can't laod character list. I've debugged things and such but don't know what else to do. Please help me
editing this code in order to laod charcter list properly
I've been editing the code and i've rcieved errors like these:
I use tfs 1.4
I can log in to the server but i can't laod character list. I've debugged things and such but don't know what else to do. Please help me
editing this code in order to laod charcter list properly
Lua:
bool IOLoginData::loginserverAuthentication(const std::string& name, const std::string& password, Account& account)
{
Database& db = Database::getInstance();
std::ostringstream query;
//query << "SELECT `id`, `name`, `password`, `secret`, `type`, `premdays`, `lastday` FROM `accounts` WHERE `name` = " << db.escapeString(name);//original
DBResult_ptr result = db.storeQuery(fmt::format(
"SELECT `id`, `name`, `password`, `secret`, `type`, `premium_ends_at` FROM `accounts` WHERE `name` = {:s}",
db.escapeString(name)));
//DBResult_ptr result = db.storeQuery(query.str()); //removido venia con original
if (!result) {
return false;
}
if (transformToSHA1(password) != result->getString("password")) {
return false;
}
account.id = result->getNumber<uint32_t>("id");
account.name = result->getString("name");
account.key = decodeSecret(result->getString("secret"));
account.accountType = static_cast<AccountType_t>(result->getNumber<int32_t>("type"));
account.premiumEndsAt = result->getNumber<time_t>("premium_ends_at");
#ifdef MULTIWORLD_SYSTEM
query.str(std::string());
//result = db.storeQuery(fmt::format("SELECT `name`, `deletion`, `world_id`, FROM `players` WHERE `account_id` = {:d} AND `deletion` = 0", account.id));
result = db.storeQuery(fmt::format("SELECT `name`, `deletion`, `world_id` FROM `players` WHERE `account_id` = {:d} AND `deletion` = 0 ORDER BY `name` ASC", account.id));
//query << "SELECT `name`, `deletion`, `world_id` FROM `players` WHERE `account_id` = " << account.id; //original
result = db.storeQuery(query.str());
if (result) {
do {
/*if (result->getNumber<uint64_t>("deletion") == 0)*/ {
Character character;
character.name = result->getString("name");
character.worldid = result->getNumber<uint16_t>("world_id");
account.characters.push_back(character);
}
} while (result->next());
}
#else
query.str(std::string());
//query << "SELECT `name`, `deletion` FROM `players` WHERE `account_id` = " << account.id;//original
result = db.storeQuery(fmt::format("SELECT `name` FROM `players` WHERE `account_id` = {:d} AND `deletion` = 0 ORDER BY `name` ASC", account.id));
//result = db.storeQuery(query.str());
if (result) {
do {
//if (result->getNumber<uint64_t>("deletion") == 0) {
account.characters.push_back(result->getString("name"));
}
} while (result->next());
//std::sort(account.characters.begin(), account.characters.end());
}
#endif
return true;
}
Code:
Error - mysql_store_result] Query: SELECT id, name, password, secret, type, premium_ends_at FROM accounts WHERE name = {:s}'5546102'
Message: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ':s}'5546102'' at line 1
Code:
[Error - mysql_real_query] Query:
Message: Query was empty
[Error - mysql_store_result] Query:
Message: Query was empty