cycle / database

Database Abstraction Layer, Schema Introspection, Schema Generation, Query Builders
MIT License
53 stars 22 forks source link

Fixing `whereJsonContains` and `whereJsonDoesntContain` methods with a single column name #143

Closed msmakouz closed 8 months ago

msmakouz commented 8 months ago

Bug

When calling the whereJsonContains and whereJsonDoesntContain methods and passing only the column name to PostgreSQL:

$data = $database->select()
    ->from('users')
    ->whereJsonDoesntContain('permissions', [])
    ->fetchAll();

We get the error Cycle\Database\Exception\DriverException : Invalid statement. Unable to extract attribute. instead of getting results.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (2e04ba4) 95.02% compared to head (7272ea6) 95.03%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## 2.x #143 +/- ## ========================================= Coverage 95.02% 95.03% - Complexity 1795 1798 +3 ========================================= Files 128 128 Lines 4945 4952 +7 ========================================= + Hits 4699 4706 +7 Misses 246 246 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.