Posted to tcl by Gerry at Sat Sep 15 20:03:02 GMT 2012view pretty
if {[set filename [tk_getOpenFile]] != {} } { db eval {create table if not exists main.blobs(filename text, time text default current_timestamp, content blob)} db transaction { db eval {insert into main.blobs(filename) values(:filename)} set rowid [db eval {select last_insert_rowid()}] set bloblength [file size $filename] db eval {update main.blobs set content = zeroblob(:bloblength) where rowid = :rowid} set infile [open $filename {RDONLY BINARY}] set blobchan [db incrblob main blobs content $rowid] puts -nonewline $blobchan [read $infile] flush $blobchan close $infile close $blobchan ::GEB::fillwins } }