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

🐛 Incorrect insertion of FragmentInterface parameters into WHERE IN queries #164

Open
1 task done
iGrog opened this issue Mar 9, 2024 · 4 comments
Open
1 task done
Assignees
Labels
DX type:bug Bug type:question Further information is requested

Comments

@iGrog
Copy link

iGrog commented Mar 9, 2024

No duplicates 🥲.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

Database

MySQL

What happened?

Continue of #145

$products = $this->select()->andWhere('productGuid', 'IN', $productGuids)->fetchData();

with empty array $productGuids resulting the following sql:

AND `xxx`.`ProductGuid` IN() 

and database error is raised, as there is nothing in IN

Version

database 2.8.1
PHP 8.3
@iGrog iGrog added status:to be verified Needs to be reproduced and validated. type:bug Bug labels Mar 9, 2024
@roxblnfk
Copy link
Member

Hi. What do you expect from ORM in case of passing an empty list?

@roxblnfk roxblnfk added type:question Further information is requested DX and removed status:to be verified Needs to be reproduced and validated. labels Mar 10, 2024
@iGrog
Copy link
Author

iGrog commented Mar 11, 2024

Hi, maybe not to generate AND xxx.ProductGuid IN() at all?

@roxblnfk
Copy link
Member

roxblnfk commented Mar 11, 2024

Hi, maybe not to generate AND xxx.ProductGuid IN() at all?

or generate FALSE instead? because the IN operator is used to define a white list. And if the list is empty it equals to FALSE

@roxblnfk
Copy link
Member

Yet another option -- generate xxx.ProductGuid is null. Wny not?
The values list has no values. Shouldn't we check that field has no value too? :)

@roxblnfk roxblnfk assigned msmakouz and unassigned roxblnfk Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX type:bug Bug type:question Further information is requested
Projects
Status: No status
Development

No branches or pull requests

3 participants