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
[FEATURE REQUEST] Pass array to WHERE IN statements. #972
Comments
Hi @johnnybigoode Investigations are underway, we'll let you know soon! |
@cheenamalhotra Thank you. If you need help to implement a solution, just pass me some direction that I'll gladly do it. |
Hi @johnnybigoode As per JDBC Specifications, I'm sure you're aware that SQL Server has no SQL ARRAY equivalent Type. Hence the driver cannot send a SQL ARRAY type object to database. This is the main reason why this API could never be supported. Now coming to your proposal, if you are trying to work with
IMO, I don't like the idea and it does not seem a promising solution due to many factors, some of which are below:
It looks like a forced solution to make the API work, and not something that respects specifications with a clean defined solution. If you think differently and have a cleaner solution to answer all the concerns I mentioned, please go ahead with a PR against |
Oh wow, thanks for the detailed reply. I trully appreciate it. And I guess since SQL Server has no SQL ARRAY, it's obviously not a good idea to implement a hack for a specific use-case. I guess this issue should be closed until further notice. |
I'm a little irritated when I need to use JDBC for any kind of query that demands complicated WHERE clauses.
Since requirements state that we are able to filter the lowest grain over 11 different parameters of a query, WHERE X IN (Z), where Z is an array would be the logical solution.
So, getting the array information from a request could lead to a prepared statement like this:
But any attempt of using the setArray returns throwNotSupportedException, according to source code:
Stackoverflow seems to understand this as stated in the top voted answer:
Another reply to another question seems more concise:
But he states in the end:
In the other question there's a small implementation which solves the problem:
The setArray example in JDBC 4.1 specs states that
and while the example mentioned talks about storing array objects, its use for IN or X = ANY(y) seems universal, while not generally implemented.
The text was updated successfully, but these errors were encountered: