Commit bf5540e
fix(adapter): use JSON_CONTAINS / json_each for array CONTAINS
The LIKE `%json_encode%` pattern produces false positives on array
columns: searching `2` in a TINYINT array matches `[12, 200]`,
searching `"apple"` matches `["pineapple"]`, etc. Route onArray()
CONTAINS / CONTAINS_ANY / NOT_CONTAINS through exact-element
operators instead:
- MariaDB: JSON_OVERLAPS when supported, JSON_CONTAINS per element
OR'd together as fallback. The LIKE branch no longer special-cases
arrays.
- SQLite: EXISTS (SELECT 1 FROM json_each(col) WHERE value IN (...))
via a new buildArrayContainsCondition routed from getSQLCondition
before the LIKE handler.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 93a0575 commit bf5540e
2 files changed
Lines changed: 71 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1627 | 1627 | | |
1628 | 1628 | | |
1629 | 1629 | | |
1630 | | - | |
1631 | | - | |
| 1630 | + | |
1632 | 1631 | | |
1633 | | - | |
1634 | | - | |
1635 | | - | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1636 | 1654 | | |
1637 | 1655 | | |
1638 | 1656 | | |
| |||
1649 | 1667 | | |
1650 | 1668 | | |
1651 | 1669 | | |
1652 | | - | |
1653 | | - | |
| 1670 | + | |
1654 | 1671 | | |
1655 | 1672 | | |
1656 | 1673 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3162 | 3162 | | |
3163 | 3163 | | |
3164 | 3164 | | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
| 3174 | + | |
| 3175 | + | |
3165 | 3176 | | |
3166 | 3177 | | |
3167 | 3178 | | |
| |||
3218 | 3229 | | |
3219 | 3230 | | |
3220 | 3231 | | |
| 3232 | + | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
3221 | 3267 | | |
3222 | 3268 | | |
3223 | 3269 | | |
| |||
3276 | 3322 | | |
3277 | 3323 | | |
3278 | 3324 | | |
3279 | | - | |
3280 | | - | |
3281 | 3325 | | |
3282 | 3326 | | |
3283 | 3327 | | |
3284 | 3328 | | |
3285 | 3329 | | |
3286 | | - | |
3287 | | - | |
3288 | | - | |
| 3330 | + | |
3289 | 3331 | | |
3290 | 3332 | | |
3291 | 3333 | | |
| |||
0 commit comments