I download a db from internet. I save it in my datases folder and I open it. Inside the db there is a table "Ads" with 6 fields. 2 of these fields are BLOB. When I want to read from this table... I have some problem... I noticed that when I read a row with a blob field more bigger than 1 mega byte, this causes an exception... "get field slot from row 0 col 0 failed". if it's a little blob, all is ok... thanks in advance :)
相关问题
- Views base64 encoded blob in HTML with PHP
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Reading a BLOB that is less than 100KB from a SQLite database is faster than reading the same from the file system. However, anything greater than that is best kept on the disk, with a reference in the db. More at: http://www.sqlite.org/intern-v-extern-blob.html
There's a limit of 1MB on internal assets due to dynamic decompression; the 1MB limit also seems to apply to Cursor blobs but this doesn't seem to be documented anywhere.
Generally you should avoid blobs in SQLite as they perform poorly; instead save the blob data as a file and store the location of the file in your DB.
Is the query you're using 'selecting' said blob? Can you omit it? If you can't, are you using:
or
The first method will let you read the blob in chunks. The second is going to have the blob loaded all at once.
There is a 1MB limit per operation. (I am unsure if this is per row, or per column in the case of SQLite queries). The limit is due to the SQLite API interacting with sqlite out-of-process over the Binder/Parcel IPC system. The same limit applies for values within a Bundle (Intent extras, for instance).
See: http://developer.android.com/reference/android/os/TransactionTooLargeException.html
Looks like BLOB support in Android isn't implemented yet...
http://www.basic4ppc.com/forum/basic4android-updates-questions/6648-support-sqlite-blob.html
What data is stored in the BLOB fields? I would guess pictures.
I would recommend NOT using BLOBs. The file system is a much better choice for binary data.
Can you explain a bit more about what you want to accomplish with the database?