Updated 2011-10-11 10:25:42 by dkf

Tiago Dionizio wrote on comp.lang.tcl: I have ... written a SQLite based TclVFS for personal use ... and it seems stable. Used it to build a tclkit based app without problems. (minor text changes and hyperlinks added by DRH)

Here is a link to the script file: http://web.ist.utl.pt/~tiago.dionizio/tcl/sqlite3vfs.tcl

TD: example usage
        # mount a sqlite3 db file, store the identifier in $fd
        set fd [vfs::sqlite3::Mount test.db test]
        # now you have a test directory available in the tcl filesystem.
        
        # you can do any normal file operation on the recently added directory (filesystem)
        file copy file.txt test/file.txt
        file copy test/file.txt file2.txt
        # etc...
        
        # because modifying operations on a sqlite3 database can take some time
        # i included a special function to help with writing operations, using a single
        # transaction so it doesn't take too much time to write hundreds of files:
        vfs::sqlite3::Runlock $fd {
            foreach f [glob *.html] {
                file copy $f test
            }
        }; # can specify lock type. ex: IMMEDIATE or DEFERRED
        
        # unmount the filesystem. (test is the local directory)
        vfs::sqlite3::Unmount $fd test