Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core, SQL] Refactor to use mariadb-connector-cpp and introduce new db namespace #4601

Merged
merged 49 commits into from
Apr 1, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
8495c9c
[chore] Windows: Update MariaDB C connector
zach2good Oct 12, 2023
6a681ed
[ext] Add mariadb-connector-cpp dep
zach2good Dec 17, 2023
16d2c12
[core] Start of new SQL api
zach2good Dec 17, 2023
07a9e09
[core] Introduce new db namespace and refactor xi_world to use it
zach2good Dec 17, 2023
9c7095a
[core] Refactor xi_search to use new db API
zach2good Dec 17, 2023
62b0a1b
[core] Refactor xi_connect to not clash with new db API
zach2good Dec 17, 2023
a175df2
[core] General cleanup of xi_search
zach2good Dec 18, 2023
0f1f548
[core] First pass at db::preparedStmt
zach2good Dec 18, 2023
560d322
[core, db] Add warnings about 1-indexing
zach2good Dec 18, 2023
e0af489
[core, db] Add templates for db::preparedStmt and db::binder
zach2good Dec 18, 2023
12e20a7
[core, db] Clean up some risky indexes
zach2good Dec 18, 2023
3b3e62a
[core, db] Option to build mariadb-connector-cpp manually
zach2good Dec 18, 2023
c69cdb7
[chore] Retire Windows 32-bit build
zach2good Dec 18, 2023
b8b5f1f
[chore] Clean up MariaDBC/CPP resolution for Win64
zach2good Dec 18, 2023
3792ac2
[chore] GCC build working
zach2good Dec 18, 2023
bc09551
[core] Rename xi_map's global SqlConnection to _sql
zach2good Dec 18, 2023
3b70ba6
[tools] Add batch file for clang-format
zach2good Dec 18, 2023
28ab4fb
[core] Add database.h to pch.h
zach2good Dec 18, 2023
c0c3a68
[core] Audit local SqlConnection usage+naming
zach2good Dec 18, 2023
2d0c474
[world] Fix message dropping in message_server
zach2good Dec 18, 2023
d5cd43f
[core] Add db::lazyPreparedStmt and db::extractBlob
zach2good Dec 19, 2023
a63496d
[core] Allow db::extractBlob to handle null blobs
zach2good Dec 19, 2023
765250d
[core] Fix minor compiler issues with Tracy build
zach2good Dec 19, 2023
356d55d
[core] Improvements to db connection and overloading preparedStatement
zach2good Dec 19, 2023
2644557
[core] Introduce db::detail namespace
zach2good Dec 19, 2023
ed5dd49
[core] Add basic locking to new global db connection
zach2good Dec 19, 2023
38e4540
Convert a lot of db calls in LoadChar
zach2good Dec 21, 2023
4df2f4f
Convert NPC loading to db::
zach2good Dec 23, 2023
102dcf1
Add notes about thread safety
zach2good Dec 24, 2023
6d3e795
Formatting pass
zach2good Dec 30, 2023
185de30
Fix issue with perfect forwarding
zach2good Feb 22, 2024
f1ff959
[deps] Update ESFW
zach2good Mar 30, 2024
2215b08
[deps] Update mariadb-connector-cpp
zach2good Mar 30, 2024
d37c2d8
DB: Add encodeToBlob, rename extractFromBlob
zach2good Mar 30, 2024
4162750
Update comment for Win32 clang-format script
zach2good Mar 30, 2024
3e6d21d
Add notes to database functions
zach2good Mar 30, 2024
508ae02
[core] Convert conquest to new db and fix issues
zach2good Mar 30, 2024
616c606
DB: Get rid of raw mutex usage
zach2good Mar 31, 2024
390db43
DB: Only use lazy prepared statements
zach2good Mar 31, 2024
708b419
DB: Update blueutils
zach2good Mar 31, 2024
e7062b9
DB: Add some basic string-based sanitisation
zach2good Mar 31, 2024
6192cfb
DB: Remove trailing ;'s from internal queries
zach2good Mar 31, 2024
0b8e579
DB: Add internal impl of mysql_cset_escape_slashes
zach2good Mar 31, 2024
7920388
DB: Properly handle final case in binder
zach2good Mar 31, 2024
69b32fd
DB: Clean up LoadSpells
zach2good Mar 31, 2024
ec50181
DB: is_trivially_copyable asserts
zach2good Apr 1, 2024
63e9b69
DB: Fix encoding and add notes to encodeToBlob
zach2good Apr 1, 2024
3de2280
Chore: clang-format-15 pass
zach2good Apr 1, 2024
4b71970
DB: Remove db::detail::sanitise for now
zach2good Apr 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,30 +277,6 @@ jobs:
run: |
cmake --build build -j4

Windows_32bit:
needs: Sanity_Checks
runs-on: windows-latest
env:
MSBUILD_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Cache 'build' folder
uses: actions/cache@v3
with:
path: build
key: ${{ runner.os }}-msvc32
- name: Configure CMake
shell: cmd
run: |
mkdir -p build
cmake -S . -B build -A Win32
- name: Build
shell: cmd
run: |
cmake --build build -j4

Windows_64bit_Debug:
needs: Sanity_Checks
runs-on: windows-latest
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@

# Build results
build/
build*/
lbuild/
build_mariadb_32/
build_mariadb_64/
out/
[Dd]ebug/
[Rr]elease/
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@
"*.ipp": "cpp",
"ranges": "cpp",
"span": "cpp",
"expected": "cpp"
"expected": "cpp",
"string_view": "cpp"
},
}
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ link_libraries(${CMAKE_THREAD_LIBS_INIT})

# Find MariaDB
find_package(MariaDB REQUIRED)
find_package(MariaDBCPP REQUIRED)

# Find ZMQ
find_package(ZeroMQ REQUIRED)
Expand Down
24 changes: 0 additions & 24 deletions CMakeSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,6 @@
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
},
{
"name": "x86-Release",
WinterSolstice8 marked this conversation as resolved.
Show resolved Hide resolved
"generator": "Ninja",
"configurationType": "RelWithDebInfo",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
},
{
"name": "x86-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\build\\${name}",
"installRoot": "${projectDir}\\build\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x86" ],
"variables": []
}
]
}
34 changes: 31 additions & 3 deletions cmake/FindMariaDB.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
if(WIN32)
# How to build MariaDB Libs:
#
# <Clear your cache>
# It's easier to do this in two fresh build folders, so create build_mariadb_32 and build_mariadb_64 folders
# in your project root
#
WinterSolstice8 marked this conversation as resolved.
Show resolved Hide resolved
# cd to build_mariadb_32
#
# cmake -A Win32 -DCMAKE_BUILD_TYPE=Release -DBUILD_MARIADB_FROM_SOURCE=ON ..
# cmake --build . --config Release --target libmariadb
# cmake --build . --config Release --target copy_mariadb_dll_to_ext
#
# <Clear your cache>
# cd to build_mariadb_64
#
# cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DBUILD_MARIADB_FROM_SOURCE=ON ..
# cmake --build . --config Release --target libmariadb
Expand All @@ -16,13 +19,38 @@ if(WIN32)
# Remove any non-".h" files from the include folder
#
# Use tools/rename_dll.py to properly rename the x64 dll and lib to libmariadb64.lib/.dll
# From repo root in a vsvars/MSVC developer command prompt:
# .\tools\rename_dll.py .\ext\mariadb\lib64\libmariadb.dll libmariadb64.dll x64
# Rename libmariadb.dll to libmariadb64.dll (the previous step only handles the .lib)
#
# Move the x86 and x64 dlls into the repo root
#
# TEST AND MAKE SURE THAT EVERYTHING STILL WORKS!
#
# You can now delete build_mariadb_32 and build_mariadb_64

if(BUILD_MARIADB_FROM_SOURCE)
message(STATUS "BUILDING MARIADB FROM SOURCE!")

add_definitions(-DBUILD_STATIC_CURL)
CPMAddPackage(
NAME curl
GITHUB_REPOSITORY curl/curl
GIT_TAG 1f7d8cd478f024bc16cad204a9b62feb6e92a0c5
)

add_definitions(-DZSTD_BUILD_STATIC)
CPMAddPackage(
NAME ZSTD
GITHUB_REPOSITORY facebook/zstd
GIT_TAG c692b8d12d08eb3e460f99b43a7568ebbcb27acb
SOURCE_SUBDIR build/cmake
OPTIONS
"ZSTD_LEGACY_SUPPORT OFF"
)
link_libraries(libzstd_static)

message(STATUS "Adding mariadb")
CPMAddPackage(
NAME mariadb
GITHUB_REPOSITORY mariadb-corporation/mariadb-connector-c
Expand Down Expand Up @@ -57,7 +85,7 @@ endif()

find_library(MARIADB_LIBRARY
NAMES
libmariadb mariadb libmysql mysql libmariadb64 mariadb64 libmysql64 mysql64
libmariadb64 mariadb64 libmysql64 mysql64 libmariadb mariadb libmysql mysql
PATHS
${PROJECT_SOURCE_DIR}/ext/mariadb/${lib_dir}/
/usr/
Expand Down
Loading
Loading