lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Thu, Oct 30, 2008 at 10:38 AM, Scott Morgan <blumf@blueyonder.co.uk> wrote:
> Greg Hill wrote:
>>
>> I'm using LuaSQL with a sqlite3 database.  I would like to store binary
>> data in
>> the database or at least some data with singles quotes.  Can someone point
>> me to
>> an example of how to do this?
>
> Use the connection's 'escape' method to deal with single quotes and any
> other DB specific problem chars in a string:
>
> safe_str = con:escape("can't")
>
> Binary data itself is rather awkward and not something LuaSQL specifically
> handles in it's current state. The queries are passed as strings, so
> embedded zeros can cause problems when handling BLOBs.

if they're not too big, the simplest solution would be to use hex-encode it.

check 'blob literals' in http://sqlite.org/lang_expr.html

-- 
Javier