prisma / quaint

SQL Query AST and Visitor for Rust
Apache License 2.0
583 stars 61 forks source link

fix(mariadb): json array filters #319

Closed Weakky closed 3 years ago

Weakky commented 3 years ago

Overview

Fixes json_array_starts_with, json_not_array_starts_with, json_array_ends_into, json_array_not_ends_into for MariaDB.

Deeper dive

The fix removes all usages of CAST(? AS JSON) (which, as a reminder, does not work on MariaDB).

I essentially tried to rely on the existing code to deal with JSON equality. This comes at the cost of more complex queries and potentially less performant too.

I added comments already to guide the review.