How large (in KB) can a TEXT-type row be in an SQL DB?
i'm encodding images with Base64 into Strings, and i am uploading these images into a remote database, in a row of the table USER. That row is TEXT, because i dont know if there is anothr String type with more space than TEXT.
When i store very small images, with 5 or 10 KB of space, they store OK, and when i get these images back from the sql DB into my app, i can decode them into BitMap and show them into a ImageView.
THE PROBLEM: When i store images with for example 110 KB of space, i think they doesn't store OK in the TEXT row of my table USE开发者_运维知识库R in the SQL DB, because when i try to decode them, i got an error, they can't be decoded, but i dont know why, because the decode function of Base64 simply returns null when he can't decode.
There is a way to solve my problem?
How large (in KB) can a TEXT-type row be in an SQL DB?
Is using TEXT the best option here? Or there is another Type that can store much longer Strings (eg much larger than 100KB)?
thanks
I would use BLOB instead of TEXT.
However I think the better approach would be to store image pathes in the DB while the images are stored on SDCard. The reason for this is DB is stored on device internal memory (in many cases it is just 20 - 50 MB available). So if there are lots of images, then it is possible to utilize whole internal memory making the entire device almost unoperatable.
When you insert data into a column marked TEXT, it gets converted to one of the supported character encodings. You should take a look at the SQLite 3 Datatypes definitions. I would imagine you would want your data stored in a BLOB since you want the raw data to be stored without regard to the actual encoded string.
精彩评论