diff --git a/src/tools/dbimport/Main.cpp b/src/tools/dbimport/Main.cpp index 0f4ddf5ffa918f..7b4d3abb52a3fb 100644 --- a/src/tools/dbimport/Main.cpp +++ b/src/tools/dbimport/Main.cpp @@ -18,10 +18,9 @@ #include "Banner.h" #include "Config.h" #include "DatabaseEnv.h" -#include "DatabaseLoader.h" +#include "DatabaseMgr.h" #include "IoContext.h" #include "Log.h" -#include "MySQLThreading.h" #include "OpenSSLCrypto.h" #include "Util.h" #include @@ -96,16 +95,12 @@ int main(int argc, char** argv) /// Initialize connection to the database bool StartDB() { - MySQL::Library_Init(); + sDatabaseMgr->AddDatabase(LoginDatabase, "Login"); + sDatabaseMgr->AddDatabase(CharacterDatabase, "Character"); + sDatabaseMgr->AddDatabase(WorldDatabase, "World"); +// sDatabaseMgr->AddDatabase(DBCDatabase, "Dbc"); - // Load databases - DatabaseLoader loader("dbimport"); - loader - .AddDatabase(LoginDatabase, "Login") - .AddDatabase(CharacterDatabase, "Character") - .AddDatabase(WorldDatabase, "World"); - - if (!loader.Load()) + if (!sDatabaseMgr->Load()) return false; LOG_INFO("dbimport", "Started database connection pool."); @@ -115,10 +110,7 @@ bool StartDB() /// Close the connection to the database void StopDB() { - CharacterDatabase.Close(); - WorldDatabase.Close(); - LoginDatabase.Close(); - MySQL::Library_End(); + sDatabaseMgr->CloseAllConnections(); } variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile) diff --git a/src/tools/dbimport/dbimport.conf.dist b/src/tools/dbimport/dbimport.conf.dist index 656bdd35b8b905..03e23161ed3a2f 100644 --- a/src/tools/dbimport/dbimport.conf.dist +++ b/src/tools/dbimport/dbimport.conf.dist @@ -110,36 +110,21 @@ CharacterDatabaseInfo = "127.0.0.1;3306;acore;acore;acore_characters" Database.Reconnect.Seconds = 5 Database.Reconnect.Attempts = 5 - # -# LoginDatabase.WorkerThreads -# WorldDatabase.WorkerThreads -# CharacterDatabase.WorkerThreads -# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL -# statements. Each worker thread is mirrored with its own connection to the -# MySQL server and their own thread on the MySQL server. -# Default: 1 - (LoginDatabase.WorkerThreads) -# 1 - (WorldDatabase.WorkerThreads) -# 1 - (CharacterDatabase.WorkerThreads) +# MaxQueueSize +# Description: Max size queue before open new dynamic async connect for db +# Default: 10 # -LoginDatabase.WorkerThreads = 1 -WorldDatabase.WorkerThreads = 1 -CharacterDatabase.WorkerThreads = 1 +MaxQueueSize = 10 # -# LoginDatabase.SynchThreads -# WorldDatabase.SynchThreads -# CharacterDatabase.SynchThreads -# Description: The amount of MySQL connections spawned to handle. -# Default: 1 - (LoginDatabase.WorkerThreads) -# 1 - (WorldDatabase.WorkerThreads) -# 1 - (CharacterDatabase.WorkerThreads) +# MaxPingTime +# Description: Time (in minutes) between database pings. +# Default: 30 # -LoginDatabase.SynchThreads = 1 -WorldDatabase.SynchThreads = 1 -CharacterDatabase.SynchThreads = 1 +MaxPingTime = 30 ################################################################################################### ###################################################################################################