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,
|
||||
ConnectionInfo& connInfo ) :
|
||||
ConnectionInfo& connInfo ) :
|
||||
DbConnection( q, connInfo )
|
||||
{
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
|||
"INSERT INTO charaglobalitem ( CharacterId, ItemId, catalogId, stack, UPDATE_DATE ) VALUES ( ?, ?, ?, ?, NOW() );",
|
||||
CONNECTION_SYNC );
|
||||
|
||||
/// BNPC TEMPLATES
|
||||
/// ZONE QUERIES
|
||||
prepareStatement( ZONE_SEL_BNPCTEMPLATES,
|
||||
"SELECT Id, Name, bNPCBaseId, bNPCNameId, mainWeaponModel, "
|
||||
"secWeaponModel, aggressionMode, enemyType, pose, "
|
||||
|
@ -183,6 +183,18 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements()
|
|||
"FROM bnpctemplate WHERE 1;",
|
||||
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,
|
||||
"UPDATE charaglobalitem SET stack = ?, durability = ?, stain = ? WHERE ItemId = ?;",
|
||||
CONNECTION_BOTH );
|
||||
|
|
|
@ -77,6 +77,8 @@ namespace Sapphire::Db
|
|||
CHARA_ITEMGLOBAL_DELETE,
|
||||
|
||||
ZONE_SEL_BNPCTEMPLATES,
|
||||
ZONE_SEL_SPAWNGROUPS,
|
||||
ZONE_SEL_SPAWNPOINTS,
|
||||
|
||||
LAND_INS,
|
||||
LAND_SEL,
|
||||
|
|
|
@ -763,9 +763,9 @@ Sapphire::Data::TerritoryTypePtr Sapphire::Zone::getTerritoryTypeInfo() const
|
|||
bool Sapphire::Zone::loadSpawnGroups()
|
||||
{
|
||||
auto pDb = m_pFw->get< Db::DbWorkerPool< Db::ZoneDbConnection > >();
|
||||
auto res = pDb->query( "SELECT id, bNpcTemplateId, level, maxHp "
|
||||
"FROM spawngroup "
|
||||
"WHERE territoryTypeId = " + std::to_string( getTerritoryTypeId() ) + ";" );
|
||||
auto stmt = pDb->getPreparedStatement( Db::ZoneDbStatements::ZONE_SEL_SPAWNGROUPS );
|
||||
stmt->setUInt( 1, getTerritoryTypeId() );
|
||||
auto res = pDb->query( stmt );
|
||||
|
||||
while( res->next() )
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue