30 lines
626 B
Tcl
30 lines
626 B
Tcl
####################################################################
|
|
#
|
|
# dumpdata.tcl
|
|
#
|
|
# Dump data from every table of the database to a file.
|
|
#
|
|
# Uses utility procedure DumpTable in file datautil.tcl
|
|
#
|
|
|
|
# Create the db, if not yet created.
|
|
source createdb.tcl
|
|
|
|
# Populate some data to tables
|
|
if {[db "select count(*) from table1"] == 0} {source populate.tcl}
|
|
|
|
####################################################################
|
|
#
|
|
# Execution starts here
|
|
#
|
|
|
|
set tables [db tables]
|
|
|
|
foreach i $tables {
|
|
# exclude system tables
|
|
if {![string compare [lindex $i 3] TABLE]} {
|
|
tclodbc::DumpTable db [lindex $i 2]
|
|
}
|
|
}
|
|
|