fix(game): Harmonize SQL query formatting, truncation logging, and DataPack lifecycle#1492
Open
Rushaway wants to merge 6 commits into
Open
fix(game): Harmonize SQL query formatting, truncation logging, and DataPack lifecycle#1492Rushaway wants to merge 6 commits into
Rushaway wants to merge 6 commits into
Conversation
… DataPack lifecycle - replace Escape + Format patterns with DB.Format/SQLiteDB.Format in main and comms - enforce placeholder policy: %!s for internal SQL identifiers/fragments, %s for runtime/user input - add/keep query buffer truncation guards before query execution - standardize truncation diagnostics on LogError across both plugins
rumblefrog
reviewed
Jun 1, 2026
rumblefrog
reviewed
Jun 1, 2026
There was a problem hiding this comment.
Pull request overview
This PR refactors the two SourceBans++ SourceMod plugins to standardize SQL query construction and error handling, primarily by replacing manual escaping + Format/FormatEx patterns with Database.Format/SQLiteDB.Format and adding consistent truncation guards.
Changes:
- Migrated query building to
DB.Format/db.Format/SQLiteDB.Formatwith consistent placeholder usage and truncation checks. - Standardized truncation diagnostics to
LogErrorand increased some query buffer sizes. - Adjusted
DataPackallocation timing in some paths to avoid unnecessary allocation when query formatting fails.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 35 comments.
| File | Description |
|---|---|
| game/addons/sourcemod/scripting/sbpp_main.sp | Reworked multiple ban/unban and queue queries to use DB.Format, added truncation guards, and adjusted some DataPack lifecycle decisions. |
| game/addons/sourcemod/scripting/sbpp_comms.sp | Reworked comms queries to use Database.Format, added truncation guards, and moved DataPack allocation in unblock paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1517
to
+1520
| { | ||
| LogError("SelectAddbanCallback insert query truncated"); | ||
| return; | ||
| } |
Added deletion of newDataPack on query truncation.
Removed unnecessary delete statements for dataPack. Added cleanup function for DataPack.
Contributor
Author
|
Removed unnecessary database escape calls for reason and target name.
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.
Description
This PR updates both SourceBans++ scripting plugins to apply a consistent SQL construction and error-handling pattern.
Updated files:
Key changes:
Motivation and Context
This change improves safety and consistency in SQL handling across plugins:
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note: If your PR touches
web/**and this is your firstcontribution to the web panel, the CLA bot will comment within
~30 seconds with one-line sign instructions. You only need to sign
once per repo. See
CLA.mdfor the full text andCONTRIBUTING.mdfor the rationale.