sqlite-jdbc icon indicating copy to clipboard operation
sqlite-jdbc copied to clipboard

What are the chance I can get you to implement createArrayOf and setArray?

Open kyenos opened this issue 6 years ago • 4 comments

The prepared statement throws not implemented but when operating on complex queries, the IN clause can be a god send.

public void setArray(int i, Array x) throws SQLException { throw unused(); } I can mimic this but, I would prefer not to build strings rather I would prefer to let the Driver validate that the parameters / list being set meets the db specific type requirements.

The reality is that using the JDBC prepared statement abstraction becomes side stepped as my sql dialect is specific to whatever driver I'm using instead of being generic but I loose the very ANSI SQL idiom of the IN clause otherwise.

kyenos avatar Apr 04 '19 15:04 kyenos

So I thought I had it figured out... I was wrong. So I deleted my earlier comment.

Would you be willing to accept PR's on this issue if I do figure it out?

kyenos avatar Apr 04 '19 19:04 kyenos

Go for it! I won't pretend to speak for @xerial or anyone else for that matter, but I don't see any reason not to. I'm sure there's some other people out there who'd like the functionality.

Edit: Grammar

witmoca avatar Apr 04 '19 20:04 witmoca

Hi guys! 1st of all, thank you for your effort on sqlite-jdbc, you save my life! 2nd thing is that I encountered a problem with jdbi today due to createArrayOf not being implemented.

https://github.com/jdbi/jdbi/blob/0420cc462f98565062bd577cf5d3a4d92a621060/core/src/main/java/org/jdbi/v3/core/array/SqlArrayArgument.java#L42

Application simply crashes when I use .bindArray() method.

dmytro-y-dev avatar Jan 26 '22 23:01 dmytro-y-dev

I think it's similar to #708

PRs are welcome.

gotson avatar Jul 28 '22 08:07 gotson

I checked on this today, and found out a few things:

  • by default SQLite does not support arrays
  • support is only available via a loadable extension carray
  • the carray extension only supports those types:
    • 'int32'
    • 'int64'
    • 'double'
    • 'char*'

I am closing this issue in favor of #708 which already mentions the carray extension.

gotson avatar Aug 30 '22 09:08 gotson