AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DatabaseWorkerPool.cpp File Reference
#include "DatabaseWorkerPool.h"
#include "AdhocStatement.h"
#include "CharacterDatabase.h"
#include "Errors.h"
#include "Log.h"
#include "LoginDatabase.h"
#include "MySQLPreparedStatement.h"
#include "MySQLWorkaround.h"
#include "PCQueue.h"
#include "PreparedStatement.h"
#include "QueryCallback.h"
#include "QueryHolder.h"
#include "QueryResult.h"
#include "SQLOperation.h"
#include "Transaction.h"
#include "WorldDatabase.h"
#include <limits>
#include <mysqld_error.h>
#include <sstream>
#include <vector>

Go to the source code of this file.

Classes

class  PingOperation
 

Functions

bool DatabaseIncompatibleVersion (std::string const mysqlVersion)
 Returns true if the version string given is incompatible. More...
 

Variables

template class AC_DATABASE_API DatabaseWorkerPool< LoginDatabaseConnection >
 
template class AC_DATABASE_API DatabaseWorkerPool< WorldDatabaseConnection >
 
template class AC_DATABASE_API DatabaseWorkerPool< CharacterDatabaseConnection >
 

Function Documentation

◆ DatabaseIncompatibleVersion()

bool DatabaseIncompatibleVersion ( std::string const  mysqlVersion)

Returns true if the version string given is incompatible.

Intended to be used with mysql_get_server_info()'s output as the source

DatabaseIncompatibleVersion("8.0.35") => false DatabaseIncompatibleVersion("5.6.6") => true

Adapted from stackoverflow response https://stackoverflow.com/a/2941508

Parameters
mysqlVersionThe output from GetServerInfo()/mysql_get_server_info()
Returns
Returns true if the Server version is incompatible
384{
385 // anon func to turn a version string into an array of uint8
386 // "1.2.3" => [1, 2, 3]
387 auto parse = [](std::string const& input)
388 {
389 std::vector<uint8> result;
390 std::istringstream parser(input);
391 result.push_back(parser.get());
392 for (int i = 1; i < 3; i++)
393 {
394 // Skip period
395 parser.get();
396 // Append int from parser to output
397 result.push_back(parser.get());
398 }
399 return result;
400 };
401
402 // default to values for MySQL
403 uint8 offset = 0;
404 std::string minVersion = MIN_MYSQL_SERVER_VERSION;
405
406 auto parsedMySQLVersion = parse(mysqlVersion.substr(offset));
407 auto parsedMinVersion = parse(minVersion);
408
409 return std::lexicographical_compare(parsedMySQLVersion.begin(), parsedMySQLVersion.end(),
410 parsedMinVersion.begin(), parsedMinVersion.end());
411}
std::uint8_t uint8
Definition: Define.h:109
#define MIN_MYSQL_SERVER_VERSION
Definition: DatabaseWorkerPool.h:39

References MIN_MYSQL_SERVER_VERSION.

Referenced by DatabaseWorkerPool< T >::OpenConnections().

Variable Documentation

◆ DatabaseWorkerPool< CharacterDatabaseConnection >

◆ DatabaseWorkerPool< LoginDatabaseConnection >

◆ DatabaseWorkerPool< WorldDatabaseConnection >