sockeqwe / sqlbrite-dao

DAO for SQLBrite
http://hannesdorfmann.com/android/sqlbrite-dao
Apache License 2.0
182 stars 22 forks source link

Mapper function which does not throw on missing column #20

Closed ghost closed 8 years ago

ghost commented 8 years ago

Since 0.4.0 it's not possible to not have a column in select since the mapper function throws an error

ghost commented 8 years ago

Since it is an rxjava function the only solution I see is to have a secondary function which doesn't thrown an exception

sockeqwe commented 8 years ago

What exactly do you mean with

not possible to not have a column in select since

can you post the generated mapper function and a sample query?

ghost commented 8 years ago

Suppose the table has 3 columns and I select only two, the generated mapper function throws an error because of cursor#getColumnIndexOrThrow as the mapper tries get the index of every column this was not so by default in the previous version On 18-Oct-2015 4:20 pm, "Hannes Dorfmann" notifications@github.com wrote:

What exactly do you mean with

not possible to not have a column in select since

can you post the generated mapper function and a use case?

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/sqlbrite-dao/issues/20#issuecomment-149000941 .

sockeqwe commented 8 years ago

I see ... That has been changed in 0.4.0 and is now configureable for each column via Annotaion @Column(throwOnColumnIndexNotFound = false) (true is the default). The idea is to mark those columns as optional with throwOnColumnIndexNotFound = false ...

ghost commented 8 years ago

Got it