From cb96c26c3e1e2725e537a50f8243cbfaf5a5e459 Mon Sep 17 00:00:00 2001 From: NotAdam Date: Sat, 22 Dec 2018 02:08:28 +1100 Subject: [PATCH] add batch land select to get all land + houses in 1 query --- src/common/Database/ZoneDbConnection.cpp | 7 +++++++ src/common/Database/ZoneDbConnection.h | 1 + src/world/Territory/Land.cpp | 1 + 3 files changed, 9 insertions(+) diff --git a/src/common/Database/ZoneDbConnection.cpp b/src/common/Database/ZoneDbConnection.cpp index b35ecf79..2e96cd6a 100644 --- a/src/common/Database/ZoneDbConnection.cpp +++ b/src/common/Database/ZoneDbConnection.cpp @@ -212,6 +212,13 @@ void Sapphire::Db::ZoneDbConnection::doPrepareStatements() "SELECT * FROM land WHERE LandSetId = ?;", CONNECTION_SYNC ); + prepareStatement( LAND_SEL_BATCH, + "SELECT land.*, house.Welcome, house.Aetheryte, house.Comment, house.HouseName, house.BuildTime, house.Endorsements" + "FROM land" + "LEFT JOIN house" + "ON land.HouseId = house.HouseId;", + CONNECTION_SYNC ); + /*prepareStatement( LAND_INS, "INSERT INTO land ( LandSetId ) VALUES ( ? );", CONNECTION_BOTH ); diff --git a/src/common/Database/ZoneDbConnection.h b/src/common/Database/ZoneDbConnection.h index 2cbfac6e..47bce834 100644 --- a/src/common/Database/ZoneDbConnection.h +++ b/src/common/Database/ZoneDbConnection.h @@ -80,6 +80,7 @@ namespace Sapphire::Db LAND_INS, LAND_SEL, + LAND_SEL_BATCH, LAND_UP, LANDSET_SEL, HOUSING_HOUSE_INS, diff --git a/src/world/Territory/Land.cpp b/src/world/Territory/Land.cpp index d575cfea..21ab6a00 100644 --- a/src/world/Territory/Land.cpp +++ b/src/world/Territory/Land.cpp @@ -139,6 +139,7 @@ void Sapphire::Land::loadItemContainerContents() items[ containerId ].push_back( std::make_pair( slotId, itemId ) ); } + // fuck the query off res.reset(); for( auto it = items.begin(); it != items.end(); it++ )