Quoting me, Simon Slavin writes:
> I, too, thought there should be something like that.
> Here is the .help portion for a shell enhancement I wrote awhile ago:
> .blobextract TABLE COL ROW FILE ?DB?     Extract DB blob to a file.  Table,
>                         column and row must specify a blob selected by:
>                         SELECT column FROM DB.table WHERE rowid = row .
>                         FILE may be '-' for extraction to stdout.
> .blobreplace TABLE COL ROW FILE ?DB?     Replace DB blob with file content,
>                         otherwise like .blobextract except that DB blob
>                         size must equal file size. (zeroblob(filesize))

Good idea for the function to create a file.  However, to conform closer to 
expectations of how SQL works, had you thought of creating a SQLite function 
which accepted a filename as a parameter and returned the contents of the file 
as the appropriate hex string ?  It could, of course, use significant memory if 
you tried to use it with a long file.

I wanted a solution which would work well with use of the shell in shell scripts, and I liked the streaming provision of SQLite's C API which allows very large BLOBs to be transferred without creating large, in-memory objects. So my shell enhancement exploits the streaming API, using only a few pages of memory.

I sort of like your approach, and maybe there is a way to get the best of your's and mine. Any ideas?
--
Larry Brasfield

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

Reply via email to