mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Moved spawngroup query to prepared stmt
This commit is contained in:
parent
31d5aaf457
commit
f795aca9a6
3 changed files with 19 additions and 5 deletions
|
@ -7,7 +7,7 @@ Sapphire::Db::ZoneDbConnection::ZoneDbConnection( ConnectionInfo& connInfo ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
Sapphire::Db::ZoneDbConnection::ZoneDbConnection( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* q,
|
Sapphire::Db::ZoneDbConnection::ZoneDbConnection( Sapphire::LockedWaitQueue< std::shared_ptr< Operation > >* q,
|
||||||
ConnectionInfo& connInfo ) :
|
ConnectionInfo& connInfo ) :
|
||||||
DbConnection( q, connInfo )
|
DbConnection( q, connInfo )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
|
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
|
||||||
CONNECTION_SYNC );
|
CONNECTION_SYNC );
|
||||||
|
|
||||||
/// BNPC TEMPLATES
|
/// ZONE QUERIES
|
||||||
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
||||||
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
||||||
"secWeaponModel, aggressionMode, enemyType, pose, "
|
"secWeaponModel, aggressionMode, enemyType, pose, "
|
||||||
|
@ -183,6 +183,18 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
||||||
"FROM bnpctemplate WHERE 1;",
|
"FROM bnpctemplate WHERE 1;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
|
prepareStatement( ZONE_SEL_SPAWNGROUPS,
|
||||||
|
"SELECT id, bNpcTemplateId, level, maxHp "
|
||||||
|
"FROM spawngroup "
|
||||||
|
"WHERE territoryTypeId = ?",
|
||||||
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
|
prepareStatement( ZONE_SEL_SPAWNPOINTS,
|
||||||
|
"SELECT id, x, y, z, r "
|
||||||
|
"FROM spawnpoint "
|
||||||
|
"WHERE spawnGroupId = ?",
|
||||||
|
CONNECTION_BOTH );
|
||||||
|
|
||||||
prepareStatement( CHARA_ITEMGLOBAL_UP,
|
prepareStatement( CHARA_ITEMGLOBAL_UP,
|
||||||
"UPDATE charaglobalitem SET stack = ?, durability = ?, stain = ? WHERE ItemId = ?;",
|
"UPDATE charaglobalitem SET stack = ?, durability = ?, stain = ? WHERE ItemId = ?;",
|
||||||
CONNECTION_BOTH );
|
CONNECTION_BOTH );
|
||||||
|
|
|
@ -77,6 +77,8 @@ namespace Sapphire::Db
|
||||||
CHARA_ITEMGLOBAL_DELETE,
|
CHARA_ITEMGLOBAL_DELETE,
|
||||||
|
|
||||||
ZONE_SEL_BNPCTEMPLATES,
|
ZONE_SEL_BNPCTEMPLATES,
|
||||||
|
ZONE_SEL_SPAWNGROUPS,
|
||||||
|
ZONE_SEL_SPAWNPOINTS,
|
||||||
|
|
||||||
LAND_INS,
|
LAND_INS,
|
||||||
LAND_SEL,
|
LAND_SEL,
|
||||||
|
|
|
@ -763,9 +763,9 @@ Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const
|
||||||
bool Sapphire::Zone::loadSpawnGroups()
|
bool Sapphire::Zone::loadSpawnGroups()
|
||||||
{
|
{
|
||||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||||
auto res = pDb->query( "SELECT id, bNpcTemplateId, level, maxHp "
|
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS );
|
||||||
"FROM spawngroup "
|
stmt->setUInt( 1, getTerritoryTypeId() );
|
||||||
"WHERE territoryTypeId = " + std::to_string( getTerritoryTypeId() ) + ";" );
|
auto res = pDb->query( stmt );
|
||||||
|
|
||||||
while( res->next() )
|
while( res->next() )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue