-
Notifications
You must be signed in to change notification settings - Fork 86
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
Improve IN statement for 3.0 release #161
Comments
FYI : https://github.com/atlasphp/Atlas.Query ;) . May be you are interested ? |
Thank you, i already know it, and it's SqlQuery i need ;-) |
I already thought that this library did this... I was just about to log this as a bug! Aura.SQL does array quoting, so I assumed this one did too. |
Noting the same in 3.0-dev (513747a) and 2.7.1. According to https://github.com/auraphp/Aura.SqlQuery/blob/3.x/docs/select.md#where it should work but I'm having issues which is the current latest on 3.x branch, specifically pulling in 513747a . To make sure I wasn't going mental I created a test table:
Then I wrote a small test page:
Pretty simple, it should output rows 1 and 2 of the test table, however I actually get:
Line 20 being So I believe there is still an issue here where getBindValues() doesn't output as their docs seem to suggest. |
@jimbo8098 if you are starting to use this package, I would recommend you use https://github.com/atlasphp/Atlas.Query which is a descendant of Aura.SqlQuery . |
I did make a similar workaround last night for MySQL but it was a different project. My solution involved generating a list of variables and using bindValue to assign the intended value to the variable. Happy to PR my solution but I'm not 100% if it would be applicable in other drivers. If someone could advise on that, it would be excellent. Meantime I will PR for MySQL and I'll look to add a test to the phpunit declarations (which only use having()) |
There is already a PR : #162 |
Thanks @harikt , that PR would be perfect. The use of Aura.SqlQuery is the descision of the project maintainer. Without wishing to rock the boat too much, I wouldn't be able to change it at the moment. |
Hello,
I think we can improve the IN statement for 3.0 release.
Maybe allow this syntax :
$query->where('user_Id IN (?)', [1, 2, 3, 4, 5]);
And the builder will expand the ? into ?, ?, ?, ?, ?
If this solution is ok for you i can make a PR.
The text was updated successfully, but these errors were encountered: