Parent: [b3547e] (diff)

Child: [cd2840] (diff)

Download this file

mysqldb.tcl    52 lines (40 with data), 1.3 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
49
50
51
#!/usr/local/bin/wish -f
# A script connecting to mysql's db table. This is just to show how
# you can specify the field setup by listing the columns
# You just need to change the database and table names and the list
# of columns if you want to connect to another test table
package require sqlsc
# Things that you may want to change
set username ""
set hostname localhost
set password ""
set dbname mysql
set table db
set env(SQLDBTYPE) MYSQL
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