Nice. For general use, you may also need to include duplicates in "od". For the GNU coreutils and Solaris 10 implementations, this would be the -v or --output-duplicates option.
--David Garfield Kees Nuyt writes: > On Wed, 30 Mar 2011 12:51:11 -0400, "Santin, Gloria" > <sant...@westinghouse.com> wrote: > > >Sorry, my question was not clear enough... > >I need to open a file and store the contents into the BLOB field. Some of > >the files are images and some are document templates. > >Can I do that using just SQL commands from a command line? > > > >Thanks, > >Gloria > > Yes, here's a oneliner (tested on Solaris): > > 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 -A n -t x1 > $f|tr -d '\r\n\t ')');" | sqlite3 $d ; done > > HTH > -- > ( Kees Nuyt > ) > c[_] > _______________________________________________ > 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