Nigel Verity <nigelver...@hotmail.com> wrote:
> I'm new to SQLite, coming from an Access/VB background. Having moved over to 
> Linux I'm now developing an application using
> Gambas. One of the requirements is to store a scanned document (PDF) in a 
> record as a blob, along with its metadata. I've no
> problem selecting the document, but I'm struggling to work out how to assign 
> it to the blob field.

There are two ways. If you have the whole document in a single memory buffer, 
then just prepare a statement like

insert into mytable(document) values (?);

use sqlite3_bind_blob to bind your memory buffer as a parameter, and run the 
statement.

Alternatively, you can use sqlite3_blob_open, sqlite3_blob_write et al. This 
way you don't need to have all the data in memory at once (useful for very 
large blobs), but you still have to know the size up front.
-- 
Igor Tandetnik

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

Reply via email to