Android-Android.database.sqlite.SQLiteException:未知错误(代码0):nativeGetBlob中的整数数据
我正在处理数据库并将数据从数据库导出到xml文件,但我在这一行遇到了这个错误Android-Android.database.sqlite.SQLiteException:未知错误(代码0):nativeGetBlob中的整数数据,android,sqlite,Android,Sqlite,我正在处理数据库并将数据从数据库导出到xml文件,但我在这一行遇到了这个错误byte[]s=cur.getBlob(idx)。在我使用这条线之前字符串s=cur.getString(idx)。但这也是一个错误。然后我找到了在blob类型中更改它的解决方案。这是我的密码。请给出一些建议或回答 private void exportTable(String tableName) throws IOException { mExporter.startTable(tableName)
byte[]s=cur.getBlob(idx)代码>。在我使用这条线之前<代码>字符串s=cur.getString(idx)代码>。但这也是一个错误。然后我找到了在blob
类型中更改它的解决方案。这是我的密码。请给出一些建议或回答
private void exportTable(String tableName) throws IOException {
mExporter.startTable(tableName);
// get everything from the table
String sql = "select * from " + tableName;
Cursor cur = mDb.rawQuery(sql, new String[0]);
int numcols = cur.getColumnCount();
cur.moveToFirst();
// move through the table, creating rows
// and adding each column with name and value
// to the row
while (cur.getPosition() < cur.getCount()) {
mExporter.startRow();
String name;
String val;
for (int idx = 0; idx < numcols; idx++) {
name = cur.getColumnName(idx);
byte[] s = cur.getBlob(idx);
val=new String(s,"UTF-8");
mExporter.addColumn(name, val);
}
mExporter.endRow();
cur.moveToNext();
}
cur.close();
mExporter.endTable();
}
nativeGetBlob中的整数数据
我猜你的答案就在这里
您正试图使用getBlob()
获取Integer
数据,它应该是getInt()
数据库中的数据可能是整数类型。所以您需要使用Cursor.getInt()。什么是错误日志!尝试字节[]s=cur.getBlob(名称);
cur.getInt(idx);