Skip to content

Comments

Refactor SQL queries: enforce parameterized bindings and consistent style#49

Draft
solverat wants to merge 1 commit into1.xfrom
fix_sql_statements
Draft

Refactor SQL queries: enforce parameterized bindings and consistent style#49
solverat wants to merge 1 commit into1.xfrom
fix_sql_statements

Conversation

@solverat
Copy link
Contributor

Audit and cleanup of all raw SQL queries across the codebase (~114 query sites).

  • Replace executeQuery() with executeStatement() for all DML (INSERT/UPDATE/DELETE)
  • Eliminate $db->quote() value embedding in favor of ? / :name parameter bindings
  • Refactor buildConditionPartsFromDescriptor() to return [$conditions, $params] instead of inlining quoted values
  • Replace string concatenation for dynamic table names with sprintf()
  • Apply consistent style: single-quoted PHP strings, SQL keywords uppercase, multi-line formatting for long queries, no trailing semicolons

Deprecations

  • OpenDxp\Db\Helper::fetchPairs => No replacement
  • OpenDxp\Db\Helper::selectAndDeleteWhere => No replacement
  • OpenDxp\Db\Helper::quoteInto => Use parameterized queries with ? or :name placeholders instead.

@solverat solverat self-assigned this Feb 23, 2026
@solverat solverat added the enhancement New feature or request label Feb 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant