mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
feat: allow SQLite database backend (#1663)
* simplify leaderboard code, fully abstract database * update exception catching * update exception catching and sql references, remove ugc from gamemessages fix deleting model remove unrelated changes Update GameMessages.cpp * remove ugc from gamemessages * Update GameMessages.cpp * Update Leaderboard.cpp * bug fixes * fix racing leaderboard * remove extra stuff * update * add sqlite * use a default for optimizations * update sqlite * Fix limits on update and delete * fix bugs * use definition to switch between databases * add switch for different backends * fix include guard and includes * always build both * add mysql if block * Update Database.cpp * add new options and add check to prevent overriding mysql * correct config names * Update README.md * Update README.md * merge to 1 sql file for sqlite database * move to sqlite folder * add back mysql migrations * Update README.md * add migration to correct the folder name or mysql * yes aron * updates * Update CMakeLists.txt * dont use paths at all, add where check to only update if folder name still exist check also doesnt check for slashes and assumes one will be there since it will be. * default dont auto create account for releases we can change this flag * default 0 * add times played query * fix leaderboard not incrementing on a not better score * add env vars with defaults for docker * use an "enum" * default to mariadb * Update .env.example
This commit is contained in:
2
thirdparty/SQLite/CMakeLists.txt
vendored
2
thirdparty/SQLite/CMakeLists.txt
vendored
@@ -3,7 +3,7 @@ set (SQLITE3_SOURCES
|
||||
"sqlite3.c"
|
||||
)
|
||||
|
||||
add_library (sqlite3 ${SQLITE3_SOURCES})
|
||||
add_library(sqlite3 ${SQLITE3_SOURCES})
|
||||
|
||||
if(UNIX)
|
||||
# Add warning disable flags and link Unix libraries to sqlite3
|
||||
|
20
thirdparty/SQLite/CppSQLite3.cpp
vendored
20
thirdparty/SQLite/CppSQLite3.cpp
vendored
@@ -1016,6 +1016,20 @@ void CppSQLite3Statement::bind(int nParam, const int nValue)
|
||||
}
|
||||
|
||||
|
||||
void CppSQLite3Statement::bind(int nParam, const sqlite_int64 nValue)
|
||||
{
|
||||
checkVM();
|
||||
int nRes = sqlite3_bind_int64(mpVM, nParam, nValue);
|
||||
|
||||
if (nRes != SQLITE_OK)
|
||||
{
|
||||
throw CppSQLite3Exception(nRes,
|
||||
(char*)"Error binding int64 param",
|
||||
DONT_DELETE_MSG);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CppSQLite3Statement::bind(int nParam, const double dValue)
|
||||
{
|
||||
checkVM();
|
||||
@@ -1097,6 +1111,12 @@ void CppSQLite3Statement::bind(const char* szParam, const int nValue)
|
||||
bind(nParam, nValue);
|
||||
}
|
||||
|
||||
void CppSQLite3Statement::bind(const char* szParam, const sqlite_int64 nValue)
|
||||
{
|
||||
int nParam = bindParameterIndex(szParam);
|
||||
bind(nParam, nValue);
|
||||
}
|
||||
|
||||
void CppSQLite3Statement::bind(const char* szParam, const double dwValue)
|
||||
{
|
||||
int nParam = bindParameterIndex(szParam);
|
||||
|
2
thirdparty/SQLite/CppSQLite3.h
vendored
2
thirdparty/SQLite/CppSQLite3.h
vendored
@@ -252,6 +252,7 @@ public:
|
||||
void bind(int nParam, const char* szValue);
|
||||
void bind(int nParam, const int nValue);
|
||||
void bind(int nParam, const double dwValue);
|
||||
void bind(int nParam, const sqlite_int64 llValue);
|
||||
void bind(int nParam, const unsigned char* blobValue, int nLen);
|
||||
void bindNull(int nParam);
|
||||
|
||||
@@ -259,6 +260,7 @@ public:
|
||||
void bind(const char* szParam, const char* szValue);
|
||||
void bind(const char* szParam, const int nValue);
|
||||
void bind(const char* szParam, const double dwValue);
|
||||
void bind(const char* szParam, const sqlite_int64 llValue);
|
||||
void bind(const char* szParam, const unsigned char* blobValue, int nLen);
|
||||
void bindNull(const char* szParam);
|
||||
|
||||
|
Reference in New Issue
Block a user