Reputation: 16851
This is how i creted my Database using sqlite
Pro:~ dd$ sqlite3 db.db
SQLite version 3.7.7 2011-06-25 16:35:41
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table cus(id integer primary key, firstname varchar(30));
sqlite> inser into cus(firstname)values('f');
Error: near "inser": syntax error
sqlite> insert into cus(firstname)values('f');
sqlite> select * from cus;
1|f
sqlite>
Now i need to insert Images, i read that we could save images as BLOB
files, Can someone show me how to save an image to a database file and retrieve the image and display in imageview
? A tutorial or sample code
Upvotes: 0
Views: 1454
Reputation: 39306
You're better off storing paths or relative paths to the files on disk in the database. The filesystem is optimized for loading and storing blob data while a database is optimized for relational data to query on and store transactionally.
It allows you to keep your database small and light while you control the memory footprint of the images (and what you choose to cache and how).
Related posts:
Android sqlite / BLOB perfomance issue
http://groups.google.com/group/alt.comp.lang.borland-delphi/browse_thread/thread/fdc16d03b613a00e
Upvotes: 1