#!/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