Bind for IN operator RHS; available? Upcoming?

19 views
Skip to first unread message

tio...@gmail.com

unread,
Mar 26, 2015, 5:51:43 PM3/26/15
to sqlit...@googlegroups.com
A facility exists in sqlite4java where you can extract large reams of single-column data as a long[] or int[], but I am in a situation where it would be nice to have the opposite operator. Example code:


SQLiteStatement stat = connection.prepare("DELETE FROM objectlist WHERE id IN :ids");
stat.bindList(":ids", purge_list);
stat.stepThrough();


Ideally, accepted types for purge_list would be a Collection<Long>, a java.nio.LongBuffer, or a long[]. At present, the only options for performing this same operation are one-by-one exec(), single bind()/stepThrough()/reset(), or using StringBuilder or SQLParts to assemble the ID list as a string. None of which are proving particularly high performance.

Is this something I might be able to look forward to in a future release?

Igor Sereda

unread,
Mar 26, 2015, 5:54:23 PM3/26/15
to sqlit...@googlegroups.com
It’s already there - check out SQLiteConnection.createArray() and SQLiteLongArray.


Kind regards,
Igor
--
You received this message because you are subscribed to the Google Groups "sqlite4java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlite4java...@googlegroups.com.
To post to this group, send email to sqlit...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlite4java.
For more options, visit https://groups.google.com/d/optout.

Tiogshi Laj

unread,
Mar 31, 2015, 5:13:43 PM3/31/15
to sqlit...@googlegroups.com, ser...@almworks.com
Ah, bingo; I knew the inverse operation should have existed, but I got it stuck in my head somehow that it had to be in the SQLiteStatement class, not SQLiteConnection. Thanks!
Reply all
Reply to author
Forward
0 new messages