提交 c57f777a 编写于 作者: B ballacky13

【bug-fix】#196 在Android设备上浏览数据库表的时候,带有BLOB类型的不能浏览

先通过cursor.getType()先判断column类型,再调用cursor.getString()或者cursor.getBlob()
上级 364c2ea3
...@@ -43,10 +43,14 @@ public class DatabaseUtil { ...@@ -43,10 +43,14 @@ public class DatabaseUtil {
for (int y = 0; y <rowCount; y++) { for (int y = 0; y <rowCount; y++) {
if (cursor.moveToNext()) { if (cursor.moveToNext()) {
for (int x = 0; x < strings.length; x++) { for (int x = 0; x < strings.length; x++) {
if (cursor.getType(x) == Cursor.FIELD_TYPE_BLOB) {
words[x][y] = new String(cursor.getBlob(x));
} else {
words[x][y] = cursor.getString(x); words[x][y] = cursor.getString(x);
} }
} }
} }
}
cursor.close(); cursor.close();
return words; return words;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册