To catch an empty field out of my DB I use following code:
int score;
if (c.isNull(11)) {
score = 100;
} else {
score = c.getInt(11);
}
q.setScore(score);
But, it seems now that when I accidently have highlighted a cell in SQL Lite browser in the past, and export it (even left empty) it doesn’t appear as NULL anymore, but as ''
. I tried c.getInt(11) = ''but then again, this is not working…
Any ideas on how I could catch the '' as well?
If you are using
getInt(),nulland “empty” SQL values becomes0in Java (sincenullis not a valid Integer value), so use:If this creates a logic problem since
0might mean somthing else in your context, you can run an UPDATE command on your table to change every''value to-1in this particular column.