On Wed, 18 Jan 2012 13:30:49 +0100, Petr Láz?ovský <la...@volny.cz>
wrote:

>
>>> have windows batch working with sqlite, may I insert image into database 
>>> and than read this images from?
>
>> Convert your image into a BLOB and store it as a BLOB.  BLOBs are just runs 
>> of bytes -- you can store anything you want as a BLOB.
>
>What you mean by "Convert image into a BLOB" is there some kind of SW to do 
>this? Does SQLite offer some way to do this? Sorry for dumb question, but I 
>googling about this some time with no luck..
>
>I found only http://www.vive.net/products/image2db.htm but this is GUI tool, 
>not suitable for scripting..


Try this one liner demo (wrapped by mail) to insert file contents into a
database table:

d=test.db3 ; echo "CREATE TABLE Files (name TEXT PRIMARY KEY,contents
BLOB);" | sqlite3 $d ; for f in yourfiles* ; do echo "INSERT INTO Files
(name,contents) VALUES ('$f',X'$(od -v -A n -t x1 $f|tr -d '\r\n\t
')');" | sqlite3 $d ; done

I'll leave the extraction from database to files as an exercise for the
reader.

-- 
Regards,

Kees Nuyt

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

Reply via email to