2011-06-07 13:26:45 +00:00
|
|
|
#!/mod/bin/jimsh
|
|
|
|
|
|
|
|
package require sqlite3
|
2011-07-01 22:56:53 +00:00
|
|
|
source /mod/var/mongoose/lib/setup
|
|
|
|
require altrow
|
2011-06-08 23:33:35 +00:00
|
|
|
|
2011-06-07 13:26:45 +00:00
|
|
|
proc db_info {db_file} {
|
2011-07-07 22:33:19 +00:00
|
|
|
if {![file exists $db_file]} { return }
|
2011-06-07 13:26:45 +00:00
|
|
|
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 {
|
2011-06-08 23:33:35 +00:00
|
|
|
puts " <th>[lindex $column 3]</th>"
|
2011-06-07 13:26:45 +00:00
|
|
|
}
|
|
|
|
puts " </tr>"
|
|
|
|
foreach data $datas {
|
2011-06-08 23:33:35 +00:00
|
|
|
altrow
|
2011-06-07 13:26:45 +00:00
|
|
|
|
|
|
|
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
|
2011-07-07 22:33:19 +00:00
|
|
|
#db_info /mnt/hd2/dms_cds.db
|
2011-06-08 23:33:35 +00:00
|
|
|
|