On Jun 3, 2008, at 4:20 PM, Shailesh Birari wrote:

> Hello,
> I have a simple question here. I want to generate a insert query  
> (char*)
> which will insert a blob in a table. This blob is nothing but a C
> structure in my program.
>
> So the query would be something like this
>
> INSERT INTO table1 VALUES
> ('12323232\0\0\0\023232323\0\0\023232323\0\03445\0')
>
> where the blob field is having some null characters in it. I know  
> there
> is a way to use bind blob but I want to create this query. Are  
> there any
> APIs that sqlite provides so that given a blob of x bytes, it will
> generate corresponding string to be appended in the query?
>
> I looked at sqlite3_snprintf, but it will print only till first \0
> character in the string. I want to escape all the \0s till my x  
> bytes of
> buffer?
>
> Can someone please give me any pointers for this ?

Use the blob literal syntax described here:

   http://www.sqlite.org/lang_expr.html

Dan.

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

Reply via email to