yahoo / squidb

SquiDB is a SQLite database library for Android and iOS
https://github.com/yahoo/squidb/wiki
Apache License 2.0
1.31k stars 132 forks source link

Create Index on multiple columns? #101

Closed inawlaljar closed 8 years ago

inawlaljar commented 8 years ago

Is it possible to create index on multiple columns?

for e.g. tryCreateIndex(User.TABLE.index("ss_fb_def_item_idx", [User.ADDRESS_ID, User.ORG_ID, User.EDUCATION_ID]));

jdkoren commented 8 years ago

Sure you can. The Table.index() method (and the Index constructor) accepts a variable number of Property<?> objects. You can write it like this:

User.TABLE.index("ss_fb_def_item_idx", User.ADDRESS_ID, User.ORG_ID, User.EDUCATION_ID)

You could also declare an array if you wanted to since var-args can accept an array.

inawlaljar commented 8 years ago

THanks.