In Android, is AbstractWindowedCursor.isBlob() guaranteed to be correct?
I see that AbstractWindowedCursor
has methods to check the type of a column. This is a great convenience! But when I look at the CursorWindow
class, I see that the documentatio开发者_JAVA技巧n for isBlob()
says:
Checks if a field contains either a blob or is null.
So, does this mean that if I run this check on, say, a String column that contains a NULL value, will it return true
? If so, this means I can't rely on that method as a guaranteed type check.
Checks if a field contains either a blob or is null.
So, does this mean that if I run this check on, say, a String column that contains a NULL value, will it return true?
I haven't tried it myself but I suspect the answer is 'yes' (either that or there's a typo in the docs).
However, if you run isNull() first and that returns 'true' then you know that it isn't going to be possible to tell what the 'column' type is anyway (the isXxxx methods check the type of data the 'field' contains not the 'column' type).
But if you run isNull() first and it returns 'false' then run isBlob(), if it returns true the field contains a blob.
精彩评论