Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
LegacyTransportDatabase.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#include "DatabaseEnv.h"
8#include "Log.h"
9#include "Timer.h"
10
12{
14 {
15 uint32 oldMSTime = getMSTime();
16
18
19 QueryResult result = WorldDatabase.Query("SELECT `entry`, `transport_entry`, `map`, `spawnMask`, `flags` FROM `transport_legacy`");
20 if (!result)
21 {
22 SF_LOG_INFO("server.loading", ">> Loaded 0 legacy local transports. DB table `transport_legacy` is empty.");
23 return;
24 }
25
26 uint32 count = 0;
27 do
28 {
29 Field* fields = result->Fetch();
31 {
32 fields[0].GetUInt32(),
33 fields[1].GetUInt32(),
34 fields[2].GetUInt32(),
35 fields[3].GetUInt32(),
36 fields[4].GetUInt32()
37 };
38
39 if (!AddLegacyTransportEntry(entry))
40 {
41 SF_LOG_ERROR("sql.sql", "Table `transport_legacy` has invalid or duplicate legacy transport row for entry %u, transport_entry %u, map %u, spawnMask %u, flags %u. Skipped.",
42 entry.DbEntry, entry.ClientEntry, entry.MapId, entry.SpawnMask, entry.Flags);
43 continue;
44 }
45
46 ++count;
47 } while (result->NextRow());
48
49 SF_LOG_INFO("server.loading", ">> Loaded %u legacy local transports in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
50 }
51}
std::uint32_t uint32
Definition Define.h:77
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
#define SF_LOG_INFO(filterType__,...)
Definition Log.h:137
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
Definition QueryResult.h:48
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition Timer.h:22
uint32 getMSTime()
Definition Timer.h:12
Definition Field.h:16
uint32 GetUInt32() const
Definition Field.h:105
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
Definition Main.cpp:40
bool AddLegacyTransportEntry(LegacyTransportEntry const &entry)
uint32 Flags
uint32 ClientEntry
uint32 MapId
uint32 DbEntry
uint32 SpawnMask