sockeqwe/sqlbrite-dao

Mapper function which does not throw on missing column

Closed this issue · 5 comments

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

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

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?

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
#20 (comment)
.

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 ...

Got it