tcldb , by Wojciech Kocjan, is a database abstraction layer
Resolving Table Creation Dependencies with tcldb:
# move the old proc command out of the way
rename proc ::tcl::proc
# create a replacement proc that registers all occurrences of proc creation
# into the global proc_to_filename_map variable
::tcl::proc proc args {
global proc_to_filename_map
set proc_to_filename_map([lindex $args 0]) [info script]
uplevel 1 [linsert $args 0 ::tcl::proc]
}WK:
It may not be the most lightweight interface, but it seems to do the trick. It also (which IMHO is more important) handles some differences between databases (like FORMAT_DATE vs TO_CHAR, NOW vs CURRENT_* and so on).
tcldb includes a record and replay system for Tcl/Tk: "... all that is needed to do this (and do fancy widget matching).
See ... http://dqsoftware.cvs.sourceforge.net/dqsoftware/tcldb/lib/tcldb/tests/ to have a quick tour on how it works. Look for tcldb::testwidget."