pushtorefresh / storio

Reactive API for SQLiteDatabase and ContentResolver.
Apache License 2.0
2.55k stars 182 forks source link

Multiple parameters in the method orderBy when creating queries #564

Closed oneassasin closed 9 years ago

oneassasin commented 9 years ago

Please, add, becouse options for sorting can be many.

artem-zinnatullin commented 9 years ago

You can specify multiple columns divided by , in orderBy clause. We've followed same semantic as SQLiteDatabase.query().

Example:

storIOSQLite
  .get()
  ...
  .withQuery(Query.builder()
    .table("some_table")
    .orderBy("column1, column2")
    .build())
oneassasin commented 9 years ago
@NonNull
public CompleteBuilder orderBy(@Nullable String orderBy) {
    this.orderBy = orderBy;
    return this;
}

StorIOSQLite 1.6.1

artem-zinnatullin commented 9 years ago

Yep, this orderBy string can contain multiple columns divided by comma , :smile:

oneassasin commented 9 years ago

Ooops. I do not write what he wanted. :smile:
Why do I generate this line, if you can do it within the library :question:

artem-zinnatullin commented 9 years ago

Simply because we don't want to do any kind of SQL parsing/processing/generating in the StorIO, it's not an ORM, it's a DAO. The same is applicable to Query.where() and Query.limit().