On Jul 25, 2008, at 12:05 PM, Sherief N. Farouk wrote:

> I'm having a problem with the last parameter, the function used to  
> dispose
> of the blob. Does sqlite defer actually inserting the blob into the  
> database
> somehow? In other words, will I get into trouble if I do:
>
> Sqlite3_bind_blob(Statement, 1, BlobData, BlobSize, do_nothing);
> Delete [] BlobData;
>

Use SQLITE_TRANSIENT.

Dan.

> ?
>
> - Sherief
>
>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:sqlite-users-
>> [EMAIL PROTECTED] On Behalf Of Dan
>> Sent: Friday, July 25, 2008 12:51 AM
>> To: General Discussion of SQLite Database
>> Subject: Re: [sqlite] Hard time with blobs
>>
>>
>> On Jul 25, 2008, at 10:35 AM, Sherief N. Farouk wrote:
>>
>>> I want to use blobs to store binary objects in the database, but
>>> I'm having
>>> a hard time understanding how they work. First of all, I don't see
>>> a way to
>>> set a blob's size, and sqlite3_blob_write doesn't increase the size
>>> of the
>>> blob, which is putting me in a weird catch-22 situation.
>>>
>>> What's the best solution for storing a bunch of binary objects,
>>> given the
>>> two alternatives: They may be immutable (write once, read many), or
>>> mutable
>>> (write many, possibly overwriting regions or appending, write many)?
>>
>> You can work with blobs without using the sqlite3_blob_XXX() APIs.
>> Insert
>> blobs by binding them with sqlite3_bind_blob(), retrieve them using
>> sqlite3_column_blob().
>>
>> Sometimes it is better to use the sqlite3_blob_XXX() APIs because  
>> they
>> allow sqlite to work with large blobs without creating a copy of the
>> blob in memory. To create a large zeroed blob in the database, use
>> either sqlite3_bind_zeroblob() or the "zeroblob" SQL function. Then
>> populate it using sqlite3_blob_XXX() after it has been inserted.
>>
>> Dan.
>>
>> _______________________________________________
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

Reply via email to