"aditya siram" <aditya.si...@gmail.com>
wrote in message
news:594f78210901021108o6cbdfbddxe6b80631fe3da...@mail.gmail.com
> How do I insert an image file into sqlite table? Can I just use a
> path-specifier? For instance,
> create table ("name" varchar, "data" blob);
> insert into table ("someBlob", "./blob.jpg");

No, SQLite won't read the file for you. You will have to read the data 
into memory yourself, then insert it into the table (you could possibly 
use memory-mapped files - see CreateFileMapping on Windows, mmap on 
Linux). The easiest way is perhaps to use a parameterized query - see 
sqlite3_bind_blob.

Alternatively, you could use incremental BLOB API 
(http://sqlite.org/c3ref/blob_open.html). Useful for large files, as you 
don't need to have all the data in memory at once.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to