> On 23 Jun 2014, at 4:10pm, Carlos Ferreira <car...@csiberkeley.com> wrote:
> 
> To access Blobs I use the direct access BLOB api from SQLite.
> 
> However, what is the best way to update a record that contains a BLOB, and 
> the only goals is to update the BLOB...
> 
> The BLOB may shrink or increase...and that is the reason why I cannot use the 
> BLOB Write and...
> 
> 
> It does not seem reasonable to create a Statement with the BLOB string ...

There is no reason not to use a normal UPDATE command, either including the 
BLOB as a hex string or binding the blob from memory using

int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));

as detailed here:

<http://www.sqlite.org/c3ref/bind_blob.html>

with location and length (it is stupid that that parameter is called 'n' since 
it always represents length).  The fifth parameter allows you to supply a 
destructor routine so you can decide exactly how to free the memory your BLOB 
is in.  You can provide your own routine, or tell SQLite that not to worry 
about it, or tell SQLite that it needs to make its own copy which it can then 
dispose of when it no longer needs it.

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

Reply via email to