webif/var/mongoose/cgi-bin/db.jim
hummypkg ded9495595 re-implemented package management. Initial suppor for remote scheduling
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@265 2a923420-c742-0410-a762-8d5b09965624
2011-07-11 23:29:21 +00:00

46 lines
1.0 KiB
Plaintext
Executable File

#!/mod/bin/jimsh
package require sqlite3
source /mod/var/mongoose/lib/setup
require altrow
proc db_info {db_file} {
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 "<h1>$db_file</h1>"
foreach table $tables {
set table_name [lindex $table 1]
set columns [$db query "pragma table_info($table_name)"]
set datas [$db query "SELECT * FROM $table_name"]
puts "<h2>$table_name</h2>"
puts "<table>"
puts " <tr>"
foreach column $columns {
puts " <th>[lindex $column 3]</th>"
}
puts " </tr>"
foreach data $datas {
altrow
for {set i 1} {$i < [llength $data]} {incr i 2} {
puts " <td>[lindex $data $i]</td>"
}
puts " </tr>"
}
puts "</table>"
}
$db close
}
puts {<style type="text/css">table, td, th {border-collapse:collapse; border:1px solid black;}</style>}
db_info /var/lib/humaxtv/rsv.db
db_info /var/lib/humaxtv/setup.db
db_info /var/lib/humaxtv/channel.db
#db_info /mnt/hd2/dms_cds.db