Openning Blob Data stored in Sqlite as a File with Tcl/Tk
Posted
by dmullins
on Stack Overflow
See other posts from Stack Overflow
or by dmullins
Published on 2010-05-17T18:26:26Z
Indexed on
2010/05/17
18:30 UTC
Read the original article
Hit count: 319
Hello:
I am using the following tcl code to store a file from my deskstop into a Sqlite database as blob data ($fileText is a path to a text file):
sqlite3 db Docs.db
set fileID [open $fileText RDONLY]
fconfigure $fileID -translation binary
set content [read $fileID]
close $fileID
db eval {insert into Document (Doc) VALUES ($content)}
db close
I have found many resources on how to open the blob data to read and write to it, but I cannot find any resources on openning the blob data as a file. For example, if $fileText was a pdf, how would I open it, from Sqlite, as a pdf?
Thanks,
DFM
© Stack Overflow or respective owner