Parent: [111ea9] (diff)

Download this file

mysqldb.tcl    49 lines (38 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env wish
package require sqlsc
# Things that you may want to change
set username ""
set hostname ""
set password ""
catch {set username $env(SQLSCUSER)}
catch {set hostname $env(SQLSCHOST)}
catch {set password $env(SQLSCPASSWORD)}
set dbname mysql
set table db
catch {unset env(CDKITDB)}
if {$argc != 0} {
puts "Usage: mysqldb.tcl"
exit 1
}
# Create Quit button
button .quit -text quit -command exit
pack .quit -side top -expand yes -fill x
# Create screen
set ${table}(window) .$table
set ${table}(database) $dbname
set ${table}(table) $table
set ${table}(allowdelete) ""
# No need to set the next 3 if you're connecting to the local host and
# don't need user name or passwd
set ${table}(sqlschost) $hostname
set ${table}(sqlscuser) $username
set ${table}(sqlscpasswd) $password
set ${table}(columns) {
host \n
user db \n
select_priv insert_priv update_priv \n
delete_priv create_priv drop_priv
}
puts "Connecting to $hostname, db $dbname, table $table as $username"
sqlscreen ${table}
pack .${table} -side top -expand 1 -fill x