Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: MariaDB - Count methods using OR condition in query #83

Closed
2 tasks done
TorstenDittmann opened this issue Nov 16, 2021 · 0 comments · Fixed by #86
Closed
2 tasks done

🐛 Bug Report: MariaDB - Count methods using OR condition in query #83

TorstenDittmann opened this issue Nov 16, 2021 · 0 comments · Fixed by #86
Assignees
Labels
bug Something isn't working

Comments

@TorstenDittmann
Copy link
Contributor

TorstenDittmann commented Nov 16, 2021

👟 Reproduction steps

$db->count(
    Audit::COLLECTION, 
    [
        new Query('column1', Query::EQUALS, ['test'],
        new Query('column2', Query::EQUALS, ['a', 'b']
    ]
);

Will produce following conditions in the SQL query:

  AND table_main.column1 = 'test'
  AND table_main.column2 = 'a'
  OR table_main.column2 = 'b'

👍 Expected behavior

AND table_main.column1 = 'test'
AND 
    (
        table_main.column2 = 'a'
        OR table_main.column2 = 'b'
    )

👎 Actual Behavior

see above.

Example from the complete query:

SELECT COUNT(1) as sum 
FROM (
    SELECT 1 
    FROM project_console_internal.audit table_main
    WHERE 1=1 
    AND 1=1 
    AND table_main.resource = :attribute_0_0_resource 
    AND table_main.event = :attribute_1_0_event 
    OR table_main.event = :a
) table_count

🎲 Utopia Database version

Version 0.10.x

🐘 PHP Version

PHP 8.0.x

💻 Operating system

MacOS

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants