Android的 - SQLite的光标getColumnIndex()是区分大小写? [英] Android - SQLite Cursor getColumnIndex() is case sensitive?
问题描述
虽然有SQLiteCursor在Android的工作我才知道,在 getColumnIndex()的行为的情况下,例如敏感的:
While working with SQLiteCursor in Android i came to know that the getColumnIndex() is behaving case sensitive for example:
示例:
Column Name in DB was: Rules
cursor.getColumnIndex("Rules") //workes fine
cursor.getColumnIndex("rules") //throws error, see the error detail
的文件没有提到的是,对于细节 <一个href="http://developer.android.com/reference/android/database/Cursor.html#getColumnIndex%28java.lang.String%29"相对=nofollow>请参阅此。
LogCat中说:
java.lang.IllegalStateException:无法读取行0,列-1从 CursorWindow。确保光标之前正确初始化 从它访问数据。
java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it
我对SQLiteCursor的这种行为感到困惑,有人可以帮助我,这是真的还是我做错了什么?如果需要的话,我可以提供code。
I am confused by this behavior of SQLiteCursor, can someone help me that this is true OR i am doing something wrong? I can provide the code if required.
感谢。
推荐答案
getColumnIndex()是区分大小写的:
getColumnIndex() is case sensitive:
栏目名称是:规则
cursor.getColumnIndex(规则) // workes细
cursor.getColumnIndex("Rules") //workes fine
cursor.getColumnIndex(规则)//抛出错误,请参阅错误详细
cursor.getColumnIndex("rules") //throws error, see the error detail
这篇关于Android的 - SQLite的光标getColumnIndex()是区分大小写?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!