Repository navigation
feat(CrazyShop): support MySQL - #62
Merged
Merged
Conversation
The credits database only accepted the sqlite driver ("Only SQLITE is
supported"): with a mysql entry for FM_CrazyShop the handle was dropped and
nothing was saved. The tables are now created for MySQL too (same columns,
primary keys instead of the SQLite UNIQUE constraint) and the two upserts
use ON DUPLICATE KEY UPDATE on MySQL, ON CONFLICT on SQLite. The SELECT
and DELETE queries already run on both.
Unknown drivers are still rejected, with the driver name in the error.
README: databases.cfg examples for both drivers.
Version 3.1.4 -> 3.2.0.
WareZ57
approved these changes
Nov 4, 2026
WareZ57
left a comment
Contributor
There was a problem hiding this comment.
Tested the MySQL path on a throwaway MySQL 8.0.44 with the exact statements: tables created, a second INSERT … ON DUPLICATE KEY UPDATE updates credits (100 → 250) and item count (1 → 4), load SELECTs and the item DELETE work, a negative account id is accepted (signed INT, matching the %d formatting). The SQLite path is unchanged. Compiled on spcomp 1.12: 0 errors, 0 warnings.
FYI only: MySQL 8.0.20+ warns that VALUES() in ON DUPLICATE KEY UPDATE is deprecated (warning 1287). It still works, and the replacement (… AS new … new.col) isn't supported by MariaDB, so keeping VALUES() is the right choice for now.
This was referenced Nov 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fun_Modes/CrazyShop.sp):CrazyShop_DB_CreateTables()only accepted thesqlitedriver. With amysqlentry forFM_CrazyShopit logged "Only SQLITE is supported", deleted the handle, and credits and items were never saved. Both drivers are now supported:clients_datakeyed onclient_steamid,shop_items_datakeyed on (client_steamid,item) (a primary key instead of the SQLiteUNIQUEconstraint). The columns are signedINTlike the SQLiteINTEGERones, because the account id is formatted with%d;ON DUPLICATE KEY UPDATE ... VALUES()on MySQL and keepON CONFLICT ... excludedon SQLite. The SELECT and DELETE queries already run on both;databases.cfgexamples for both drivers. It recommends a dedicated database, because the table names are generic (SelfMute also has aclients_datatable).Test plan
"driver" "mysql"entry,sm_crazyshop_savecredits 1: credits and items survive a reconnect and a map change"driver" "sqlite"entry: data kept, no error