#!/mod/bin/jimsh package require cgi package require sqlite3 source /mod/var/mongoose/lib/setup require altrow puts "Content-Type: text/html" puts "" set databases { /var/lib/humaxtv/rsvp.db /var/lib/humaxtv/rsv.db /var/lib/humaxtv/setup.db /var/lib/humaxtv/channel.db /mnt/hd2/dms_cds.db } header cgi_input #cgi_dump set ftab [cgi_get tab] set fdb [cgi_get db] if {$fdb != 0} { puts "

Remove filters

" } proc db_info {db_file} { global _cgi fdb ftab if {$fdb != 0 && [file tail $db_file] ne $fdb} { return } if {![file exists $db_file]} { return } set db [sqlite3.open $db_file] set tables [$db query { select name from sqlite_master where type='table' order by name }] puts "

$db_file

" foreach table $tables { set table [lindex $table 1] if {$ftab != 0 && $ftab ne $table} { continue } set columns [$db query "pragma table_info($table)"] set datas [$db query "SELECT * FROM $table order by 1"] puts "

$table

" puts "" puts " " foreach column $columns { puts " " } puts " " foreach data $datas { altrow for {set i 1} {$i < [llength $data]} {incr i 2} { puts " " } puts " " } puts "
[lindex $column 3]
[lindex $data $i]
" } $db close } if {$fdb == 0} { puts "Please choose database to view:" } else { foreach db $databases { db_info $db } } footer