Skip to content

fix: use Database.Format for SQL escaping instead of manual Escape - #24

Open
Rushaway wants to merge 1 commit into
masterfrom
fix/sql-format-escaping
Open

fix: use Database.Format for SQL escaping instead of manual Escape#24
Rushaway wants to merge 1 commit into
masterfrom
fix/sql-format-escaping

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

  • Replace manual g_hDatabase.Escape + separate escaped buffers with g_hDatabase.Format, which escapes %s string arguments directly against the query, in Database.sp and UTIL.sp.
  • Bump version (3.1.1 R -> 3.1.2 R).

Why

Database.Format is cleaner than a manual escape-then-format call per parameter and avoids extra driver/threading touchpoints from calling Escape directly.

Notes

  • UTIL_SET_VIP_PLAYER's locally-computed szName was already unused after being escaped (never written into the DataPack, so SQL_UpdateVIP never reads it back) — that's a pre-existing bug unrelated to escaping and left untouched here; this PR only removes the now-unnecessary manual escape call in that function.

Test plan

  • Compile plugin and confirm no errors
  • Add/update a VIP with a client name containing quotes and confirm the query still succeeds

g_hDatabase.Format escapes %s arguments directly against the query,
so the manual escape-into-buffer step before FormatEx is no longer
needed.
Copilot AI lite review requested due to automatic review settings August 24, 2026 20:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants