如何读取存储在 sqlite 数据库中的 blob 类型?

时间:2021-07-08 10:27:57

标签: java android sqlite blob

我成功地在 SQLite 数据库中存储了一个 blob 类型,但我以后无法正确检索它:

我是这样做的:

byte[] miniatura= cursor.getBlob(cursor.getColumnIndex(MySqliteHelper.thumbnail));

但它失败了:

java.lang.IllegalStateException: Couldn't read row 0, col -1 from CursorWindow.  Make sure the Cursor is initialized correctly before accessing data from it.

尽管有消息,但我不认为光标是问题,就好像我将提到的指令更改为类似:

String cadena= cursor.getString(cursor.getColumnIndex(MySqliteHelper.fieldofTypeText));

cadena 具有应有的价值。

那么,我该怎么做才能正确获取 Blob 值?

0 个答案:

没有答案
相关问题