在 Android 中,AbstractWindowedCursor.isBlob() 是否保证正确? [英] In Android, is AbstractWindowedCursor.isBlob() guaranteed to be correct?

查看:23
本文介绍了在 Android 中,AbstractWindowedCursor.isBlob() 是否保证正确?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到 AbstractWindowedCursor 有检查列类型的方法.这是一个很大的方便!但是当我查看 CursorWindow 类时,我看到 isBlob() 的文档说:

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 documentation for isBlob() says:

检查字段是否包含 blob 或为空.

Checks if a field contains either a blob or is null.

那么,这是否意味着如果我对包含 NULL 值的字符串列运行此检查,它会返回 true 吗?如果是这样,这意味着我不能依赖该方法作为有保证的类型检查.

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.

推荐答案

检查字段是否包含 blob 或为空.

Checks if a field contains either a blob or is null.

那么,这是否意味着如果我对包含 NULL 值的 String 列运行此检查,它会返回 true 吗?

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

但是,如果您首先运行 isNull() 并返回true",那么您知道无论如何都无法分辨列"类型是什么(isXxxx 方法检查数据的类型)字段"不包含列"类型).

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

但是,如果您先运行 isNull() 并且它返回false",然后运行 ​​isBlob(),如果它返回 true,则该字段包含一个 blob.

But if you run isNull() first and it returns 'false' then run isBlob(), if it returns true the field contains a blob.

这篇关于在 Android 中,AbstractWindowedCursor.isBlob() 是否保证正确?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆