Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

https://stackoverflow.com/questions/17605253/database-query-using-array-in-ruby

Any chance of an implementation of this?

You must be logged in to vote

Replies: 4 comments

Comment options

Unfortunately, the sqlite database API does not support binding arrays to a prepared statement: https://www.sqlite.org/c3ref/bind_blob.html

I want to suggest that you assemble the query string based on the arguments -- the suggested implementation in SO seems reasonable.

Or, you may want to look into an ORM that is a bit higher-level and will provide support for more complex queries.

You must be logged in to vote
0 replies
Comment options

Oh, so the limitation is there. Have you (or anyone) requested this from Dwayne? What is their position on the matter?

You must be logged in to vote
0 replies
Comment options

@forthrin I don't know of any SQL database that supports such a feature. I briefly looked at postgresql and mysql docs and they have similar APIs.

If this is something you're interested in pursuing, I'd recommend you bring it up with the upstream projects.

You must be logged in to vote
0 replies
Comment options

Kind of you to do a round trip. I truly support developer restraint to prevent software bloat, but it would be interesting to know why it's not considered important enough, particularly since it paves the way for malicious injection.

The thing that comes to mind is that in/exclusion in a SQL paradigm is most commonly done by joining against other tables, and checking against lists inserted from code might be considered "unclean".

Also, if exclusions are one per row, they can just as well be done in code afterwards, but obviously exclusions that hit many rows per entry would be very ineffective that way.

I'll consider posting a request on the SQLite forum, referring to this posting.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #397 on September 04, 2023 01:22.

Morty Proxy This is a proxified and sanitized view of the page, visit original site.