mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-10 02:08:20 +00:00
Additional SQLite lookup sanitizing with CDClientDatabase::ExecuteQueryWithArgs()
This commit is contained in:
parent
590ccc78aa
commit
4796b551ad
@ -59,11 +59,9 @@ float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CDCLIENT_CACHE_ALL
|
#ifndef CDCLIENT_CACHE_ALL
|
||||||
std::stringstream query;
|
auto tableData = CDClientDatabase::ExecuteQueryWithArgs(
|
||||||
|
"SELECT parameterID, value FROM BehaviorParameter WHERE behaviorID = %u;",
|
||||||
query << "SELECT parameterID, value FROM BehaviorParameter WHERE behaviorID = " << std::to_string(behaviorID);
|
behaviorID);
|
||||||
|
|
||||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
|
||||||
|
|
||||||
m_Entries.insert_or_assign(behaviorID, 0);
|
m_Entries.insert_or_assign(behaviorID, 0);
|
||||||
|
|
||||||
|
@ -198,14 +198,12 @@ void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& e
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream query;
|
const std::string effectType_str = GeneralUtils::UTF16ToWTF8(effectType);
|
||||||
|
auto result = CDClientDatabase::ExecuteQueryWithArgs(
|
||||||
|
"SELECT animation_length FROM Animations WHERE animation_type IN (SELECT animationName FROM BehaviorEffect WHERE effectID = %d AND effectType = %Q);",
|
||||||
|
effectId, effectType_str.c_str());
|
||||||
|
|
||||||
query << "SELECT animation_length FROM Animations WHERE animation_type IN (SELECT animationName FROM BehaviorEffect WHERE effectID = " << std::to_string(effectId) << " AND effectType = '" << GeneralUtils::UTF16ToWTF8(effectType) << "');";
|
if (result.eof() || result.fieldIsNull(0)) {
|
||||||
|
|
||||||
auto result = CDClientDatabase::ExecuteQuery(query.str());
|
|
||||||
|
|
||||||
if (result.eof() || result.fieldIsNull(0))
|
|
||||||
{
|
|
||||||
result.finalize();
|
result.finalize();
|
||||||
|
|
||||||
m_DurationCache[effectId] = 0;
|
m_DurationCache[effectId] = 0;
|
||||||
@ -214,7 +212,7 @@ void RenderComponent::PlayEffect(const int32_t effectId, const std::u16string& e
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
effect->time = static_cast<float>(result.getFloatField(0));
|
effect->time = static_cast<float>(result.getFloatField(0));
|
||||||
|
|
||||||
result.finalize();
|
result.finalize();
|
||||||
|
@ -15,11 +15,9 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
|||||||
|
|
||||||
this->m_PassiveAbilities = ItemSetPassiveAbility::FindAbilities(id, m_InventoryComponent->GetParent(), this);
|
this->m_PassiveAbilities = ItemSetPassiveAbility::FindAbilities(id, m_InventoryComponent->GetParent(), this);
|
||||||
|
|
||||||
std::stringstream query;
|
auto result = CDClientDatabase::ExecuteQueryWithArgs(
|
||||||
|
"SELECT skillSetWith2, skillSetWith3, skillSetWith4, skillSetWith5, skillSetWith6, itemIDs FROM ItemSets WHERE setID = %u;",
|
||||||
query << "SELECT skillSetWith2, skillSetWith3, skillSetWith4, skillSetWith5, skillSetWith6, itemIDs FROM ItemSets WHERE setID = " << std::to_string(id);
|
id);
|
||||||
|
|
||||||
auto result = CDClientDatabase::ExecuteQuery(query.str());
|
|
||||||
|
|
||||||
if (result.eof())
|
if (result.eof())
|
||||||
{
|
{
|
||||||
@ -33,11 +31,9 @@ ItemSet::ItemSet(const uint32_t id, InventoryComponent* inventoryComponent)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::stringstream skillQuery;
|
auto skillResult = CDClientDatabase::ExecuteQueryWithArgs(
|
||||||
|
"SELECT SkillID FROM ItemSetSkills WHERE SkillSetID = %d;",
|
||||||
skillQuery << "SELECT SkillID FROM ItemSetSkills WHERE SkillSetID = " << std::to_string(result.getIntField(i));
|
result.getIntField(i));
|
||||||
|
|
||||||
auto skillResult = CDClientDatabase::ExecuteQuery(skillQuery.str());
|
|
||||||
|
|
||||||
if (skillResult.eof())
|
if (skillResult.eof())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user