m0rb
m0rb

Reputation: 63

SQLite rawquery selectionArgs not working

i got the following rawquery

private static final String DB_QUERY_GETPOS = "select f._id, F.FName, F.FArt, P.VName, O.Gebaeude, O.Raum from Faecher as F " 
                                                     + "inner join profs as P on F.Prof_ID = P._id " 
                                                     + "inner join ort as o on F.ort_id = o._id " 
                                                     + "inner join position as PO on PO.pos=? and id is not null where f._id = PO.id and PO.pos=? order by f._id;";

Why do I get ArrayOutofBounds exceptions when accessing a Cursor or ArrayList Object filled with the result of this query?

Why don't the ? params pick up the args I pass to the rawquery?

Upvotes: 0

Views: 2226

Answers (1)

Dimse
Dimse

Reputation: 1506

When you work with cursors in Android, remember to use the moveToFirst function before reading the data. Otherwise it will result in ArrayOutOfBounds exceptions.

Upvotes: 1

Related Questions