Closed tadas-subonis closed 9 years ago
Yep, just like in SQLiteDatabase
:
storIOSQLite
.get()
.listOfObjects(Tweet.class)
.withQuery(Query.builder()
.table("tweets")
.where(TweetTableMeta.COLUMN_ID + " IN (?,?,?)")
.whereArgs(1, 2, 3)
.build())
.prepare()
.createObservable()
.subscribe(tweets -> ...)
Hmm... In my case a number of arguments (number of entries in a list varies that I use for IN condition) is a variable so I guess I'll have to stick with RawQuery :/
On Thu, Jul 30, 2015 at 7:39 PM, Artem Zinnatullin <notifications@github.com
wrote:
Yep, just like in SQLiteDatabase:
storIOSQLite .get() .listOfObjects(Tweet.class) .withQuery(Query.builder() .table("tweets") .where(TweetTableMeta.COLUMN_ID + " IN (?,?,?)") .whereArgs(1, 2, 3) .build()) .prepare() .createObservable() .subscribe(tweets -> ...)
— Reply to this email directly or view it on GitHub https://github.com/pushtorefresh/storio/issues/474#issuecomment-126396935 .
Kind Regards, Tadas Šubonis
Just write func that generates ?,?,?
string and use args :)
@tadas-subonis can we close this issue?
Well, it would be nice to have more streamlined support for that but I guess we can close this at the moment :)
Thanks!
On Thu, Jul 30, 2015 at 8:36 PM, Artem Zinnatullin <notifications@github.com
wrote:
@tadas-subonis https://github.com/tadas-subonis can we close this issue?
— Reply to this email directly or view it on GitHub https://github.com/pushtorefresh/storio/issues/474#issuecomment-126412868 .
Kind Regards, Tadas Šubonis
Okay, we'll think about it and comment here.
@tadas-subonis PTAL at #485, today I needed WHERE IN (?,?,?)
too and decided to add it to the StorIO
:)
@tadas-subonis with StorIO
1.2.0 you can use Queries.placeholders(numberOfPlaceholders)
to generate ?,?,?
.
For example:
List<Author> authors;
storIOSQLite
.get()
.listOfObjects(Tweet.class)
.withQuery(Query.builder()
.table("tweets")
.where("author IN (" + placeholders(authors.size()) + ")")
.whereArgs(authors.toArray())
.build())
.prepare()
.createObservable()
Nice! Thanks :)
On Fri, Aug 7, 2015 at 6:54 PM, Artem Zinnatullin notifications@github.com wrote:
@tadas-subonis https://github.com/tadas-subonis with StorIO 1.2.0 you can use Queries.placeholders(numberOfPlaceholders) to generate ?,?,?.
For example:
List
authors; storIOSQLite .get() .listOfObjects(Tweet.class) .withQuery(Query.builder() .table("tweets") .where("author IN (" + placeholders(authors.size()) + ")") .whereArgs(authors.toArray()) .build()) .prepare() .createObservable()
— Reply to this email directly or view it on GitHub https://github.com/pushtorefresh/storio/issues/474#issuecomment-128745728 .
Kind Regards, Tadas Šubonis
Hi,
Is there a support for such queries or an example of that?
Thanks