Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Skyfire::Database Namespace Reference

Classes

struct  SetupOptions
struct  SetupPlan
struct  SetupRuntimeContext
struct  SetupState
struct  SqlStatementContext
struct  SqlUpdateFile

Functions

bool ApplyPendingSetupUpdates (MYSQL *setupConnection, SetupOptions const &options, SetupPlan const &plan, SetupRuntimeContext const &context)
bool BaselineSetupUpdates (MYSQL *setupConnection, SetupOptions const &options, SetupPlan const &plan, SetupRuntimeContext const &context)
SetupPlan BuildAuthDatabaseSetupPlan (SetupOptions const &options, SetupState const &state, bool baseSqlExists, std::vector< SqlUpdateFile > const &updates)
SetupPlan BuildCharacterDatabaseSetupPlan (SetupOptions const &options, SetupState const &state, bool baseSqlExists, std::vector< SqlUpdateFile > const &updates)
std::string BuildCreateDatabaseSql (std::string const &databaseName)
SetupPlan BuildDatabaseSetupPlan (SetupOptions const &options, SetupState const &state, bool baseSqlExists, std::vector< SqlUpdateFile > const &updates)
std::string BuildDbUpdateAuditInsertSql (std::string const &filename)
std::string BuildDbUpdateAuditTableSql ()
std::string BuildSetupPlanSummary (std::string const &databaseName, SetupPlan const &plan, std::size_t discoveredUpdateCount, bool appliesRequiredSql)
std::vector< SqlUpdateFileBuildSortedSqlUpdateList (std::vector< std::string > const &names, std::string const &directory)
std::string BuildUpdateTrackingInsertSql (std::string const &domain, std::string const &filename, std::string const &hash)
std::string BuildUpdateTrackingTableSql ()
SetupPlan BuildWorldDatabaseSetupPlan (SetupOptions const &options, SetupState const &state, bool externalBaseSqlExists, bool requiredBaseSqlExists, std::vector< SqlUpdateFile > const &updates)
std::string CalculateStableSqlHash (std::string const &sql)
bool ConnectToMySQLServer (MySQLConnectionInfo const &connectionInfo, char const *databaseName, MYSQL *&handle, SetupRuntimeContext const &context)
std::vector< SqlUpdateFileDiscoverSqlUpdates (SetupOptions const &options)
bool EnsureDatabaseExists (MySQLConnectionInfo const &connectionInfo, SetupOptions const &options, SetupRuntimeContext const &context)
bool EnsureSetupTrackingTables (MYSQL *setupConnection, SetupRuntimeContext const &context)
std::string EscapeSqlIdentifier (std::string const &identifier)
std::string EscapeSqlString (std::string const &value)
bool ExecuteSqlFile (MYSQL *setupConnection, std::filesystem::path const &path, std::string &contents, SetupRuntimeContext const &context)
bool ExecuteSqlScript (std::string const &sql, std::function< bool(std::string const &)> const &executor)
bool ExecuteSqlStream (std::istream &input, std::uintmax_t totalBytes, std::function< bool(std::string const &, SqlStatementContext const &)> const &executor)
std::filesystem::path GetDatabaseBaseSqlPath (SetupOptions const &options)
std::filesystem::path GetDatabaseBaseSqlPath (SetupOptions const &options, std::string const &baseFileName)
bool LoadDatabaseSetupState (MYSQL *setupConnection, SetupOptions const &options, SetupState &state, SetupRuntimeContext const &context)
void LogSetupPlan (SetupPlan const &plan, std::size_t discoveredUpdateCount, bool appliesRequiredSql, SetupRuntimeContext const &context)
SetupOptions MakeAuthDatabaseSetupOptions (bool autoSetup, bool autoCreate, bool autoBaseline, std::string sqlPath)
SetupOptions MakeAuthDatabaseSetupOptions (bool autoSetup, bool autoCreate, std::string sqlPath)
SetupOptions MakeCharacterDatabaseSetupOptions (bool autoSetup, bool autoCreate, bool autoBaseline, std::string sqlPath)
SetupOptions MakeCharacterDatabaseSetupOptions (bool autoSetup, bool autoCreate, std::string sqlPath)
SetupOptions MakeWorldDatabaseSetupOptions (bool autoSetup, bool autoCreate, bool autoBaseline, std::string sqlPath, std::string externalBaseFile)
SetupOptions MakeWorldDatabaseSetupOptions (bool autoSetup, bool autoCreate, std::string sqlPath, std::string externalBaseFile)
std::vector< std::string > SplitSqlStatements (std::string const &sql)

Function Documentation

◆ ApplyPendingSetupUpdates()

◆ BaselineSetupUpdates()

◆ BuildAuthDatabaseSetupPlan()

SetupPlan Skyfire::Database::BuildAuthDatabaseSetupPlan ( SetupOptions const & options,
SetupState const & state,
bool baseSqlExists,
std::vector< SqlUpdateFile > const & updates )

Definition at line 644 of file DatabaseSetup.cpp.

References BuildDatabaseSetupPlan().

◆ BuildCharacterDatabaseSetupPlan()

SetupPlan Skyfire::Database::BuildCharacterDatabaseSetupPlan ( SetupOptions const & options,
SetupState const & state,
bool baseSqlExists,
std::vector< SqlUpdateFile > const & updates )

Definition at line 650 of file DatabaseSetup.cpp.

References BuildDatabaseSetupPlan().

◆ BuildCreateDatabaseSql()

std::string Skyfire::Database::BuildCreateDatabaseSql ( std::string const & databaseName)

Definition at line 490 of file DatabaseSetup.cpp.

References EscapeSqlIdentifier().

Referenced by EnsureDatabaseExists().

◆ BuildDatabaseSetupPlan()

◆ BuildDbUpdateAuditInsertSql()

std::string Skyfire::Database::BuildDbUpdateAuditInsertSql ( std::string const & filename)

Definition at line 524 of file DatabaseSetup.cpp.

References EscapeSqlString().

◆ BuildDbUpdateAuditTableSql()

std::string Skyfire::Database::BuildDbUpdateAuditTableSql ( )

Definition at line 515 of file DatabaseSetup.cpp.

Referenced by EnsureSetupTrackingTables().

◆ BuildSetupPlanSummary()

std::string Skyfire::Database::BuildSetupPlanSummary ( std::string const & databaseName,
SetupPlan const & plan,
std::size_t discoveredUpdateCount,
bool appliesRequiredSql )

◆ BuildSortedSqlUpdateList()

std::vector< SqlUpdateFile > Skyfire::Database::BuildSortedSqlUpdateList ( std::vector< std::string > const & names,
std::string const & directory )

Definition at line 259 of file DatabaseSetup.cpp.

Referenced by DiscoverSqlUpdates().

◆ BuildUpdateTrackingInsertSql()

std::string Skyfire::Database::BuildUpdateTrackingInsertSql ( std::string const & domain,
std::string const & filename,
std::string const & hash )

Definition at line 507 of file DatabaseSetup.cpp.

References EscapeSqlString().

◆ BuildUpdateTrackingTableSql()

std::string Skyfire::Database::BuildUpdateTrackingTableSql ( )

Definition at line 496 of file DatabaseSetup.cpp.

Referenced by EnsureSetupTrackingTables().

◆ BuildWorldDatabaseSetupPlan()

SetupPlan Skyfire::Database::BuildWorldDatabaseSetupPlan ( SetupOptions const & options,
SetupState const & state,
bool externalBaseSqlExists,
bool requiredBaseSqlExists,
std::vector< SqlUpdateFile > const & updates )

◆ CalculateStableSqlHash()

std::string Skyfire::Database::CalculateStableSqlHash ( std::string const & sql)

Definition at line 443 of file DatabaseSetup.cpp.

Referenced by DiscoverSqlUpdates().

◆ ConnectToMySQLServer()

bool Skyfire::Database::ConnectToMySQLServer ( MySQLConnectionInfo const & connectionInfo,
char const * databaseName,
MYSQL *& handle,
SetupRuntimeContext const & context )

◆ DiscoverSqlUpdates()

◆ EnsureDatabaseExists()

◆ EnsureSetupTrackingTables()

bool Skyfire::Database::EnsureSetupTrackingTables ( MYSQL * setupConnection,
SetupRuntimeContext const & context )

◆ EscapeSqlIdentifier()

std::string Skyfire::Database::EscapeSqlIdentifier ( std::string const & identifier)

Definition at line 474 of file DatabaseSetup.cpp.

Referenced by BuildCreateDatabaseSql().

◆ EscapeSqlString()

std::string Skyfire::Database::EscapeSqlString ( std::string const & value)

◆ ExecuteSqlFile()

◆ ExecuteSqlScript()

bool Skyfire::Database::ExecuteSqlScript ( std::string const & sql,
std::function< bool(std::string const &)> const & executor )

Definition at line 381 of file DatabaseSetup.cpp.

References ExecuteSqlStream().

◆ ExecuteSqlStream()

bool Skyfire::Database::ExecuteSqlStream ( std::istream & input,
std::uintmax_t totalBytes,
std::function< bool(std::string const &, SqlStatementContext const &)> const & executor )

◆ GetDatabaseBaseSqlPath() [1/2]

std::filesystem::path Skyfire::Database::GetDatabaseBaseSqlPath ( SetupOptions const & options)

◆ GetDatabaseBaseSqlPath() [2/2]

std::filesystem::path Skyfire::Database::GetDatabaseBaseSqlPath ( SetupOptions const & options,
std::string const & baseFileName )

◆ LoadDatabaseSetupState()

◆ LogSetupPlan()

◆ MakeAuthDatabaseSetupOptions() [1/2]

◆ MakeAuthDatabaseSetupOptions() [2/2]

SetupOptions Skyfire::Database::MakeAuthDatabaseSetupOptions ( bool autoSetup,
bool autoCreate,
std::string sqlPath )

Definition at line 195 of file DatabaseSetup.cpp.

References MakeAuthDatabaseSetupOptions().

Referenced by MakeAuthDatabaseSetupOptions().

◆ MakeCharacterDatabaseSetupOptions() [1/2]

◆ MakeCharacterDatabaseSetupOptions() [2/2]

SetupOptions Skyfire::Database::MakeCharacterDatabaseSetupOptions ( bool autoSetup,
bool autoCreate,
std::string sqlPath )

Definition at line 215 of file DatabaseSetup.cpp.

References MakeCharacterDatabaseSetupOptions().

Referenced by MakeCharacterDatabaseSetupOptions().

◆ MakeWorldDatabaseSetupOptions() [1/2]

◆ MakeWorldDatabaseSetupOptions() [2/2]

SetupOptions Skyfire::Database::MakeWorldDatabaseSetupOptions ( bool autoSetup,
bool autoCreate,
std::string sqlPath,
std::string externalBaseFile )

Definition at line 235 of file DatabaseSetup.cpp.

References MakeWorldDatabaseSetupOptions().

Referenced by MakeWorldDatabaseSetupOptions().

◆ SplitSqlStatements()

std::vector< std::string > Skyfire::Database::SplitSqlStatements ( std::string const & sql)

Definition at line 340 of file DatabaseSetup.cpp.