Operators binds#909
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR refactors how operator bind parameters are managed across all SQL adapters. Instead of a two-pass approach — first generating SQL with integer-indexed placeholders (
Confidence Score: 5/5Safe to merge; the refactor is mechanical and the new design eliminates the class of bugs where SQL placeholder order and binding order could diverge. Every SQL adapter now generates placeholder names and registers their values in one atomic call, removing the fragile two-pass counter that the old code required. The removed No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "Revert greptile comments" | Re-trigger Greptile |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Database/Adapter/SQLite.php (1)
2169-2179: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winPreserve JSON scalar types in
ARRAY_REMOVE. Casting every non-array operand to string prevents SQLite from matching numeric and boolean JSON values, andnullneeds its ownIS NOT NULLbranch. Keep numbers/booleans typed and special-casenull.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/Database/Adapter/SQLite.php` around lines 2169 - 2179, The ARRAY_REMOVE handling in SQLite::compileOperator currently string-casts every non-array value, which breaks matching for numeric and boolean JSON scalars and does not handle null correctly. Update the TYPE_ARRAY_REMOVE branch to preserve the operand’s native JSON scalar type when binding, and add a dedicated null path so the json_each() filter uses an IS NOT NULL-style condition instead of comparing against a bound string. Use the existing SQLite::registerOperatorBind flow and the TYPE_ARRAY_REMOVE case to locate and adjust the logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/Database/Adapter/SQLite.php`:
- Around line 2169-2179: The ARRAY_REMOVE handling in SQLite::compileOperator
currently string-casts every non-array value, which breaks matching for numeric
and boolean JSON scalars and does not handle null correctly. Update the
TYPE_ARRAY_REMOVE branch to preserve the operand’s native JSON scalar type when
binding, and add a dedicated null path so the json_each() filter uses an IS NOT
NULL-style condition instead of comparing against a bound string. Use the
existing SQLite::registerOperatorBind flow and the TYPE_ARRAY_REMOVE case to
locate and adjust the logic.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: e607a877-8811-475e-9c34-c1fdd70bd97a
📒 Files selected for processing (5)
src/Database/Adapter/MariaDB.phpsrc/Database/Adapter/MySQL.phpsrc/Database/Adapter/Postgres.phpsrc/Database/Adapter/SQL.phpsrc/Database/Adapter/SQLite.php
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Summary by CodeRabbit