Work with older versions of mysqltcl.

git-svn-id: svn://10.0.0.236/trunk@29863 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
terry%mozilla.org
1999-04-30 19:12:13 +00:00
parent 66e0ced058
commit bbefbe9e20
2 changed files with 8 additions and 2 deletions

View File

@@ -37,7 +37,8 @@ set userdomain somedomain
# User and password for access to the MySQL bonsai database
# use empty string ("") for password if you want to access the database
# without using a password (not recommended)
# without using a password (not recommended). If you are using an older
# version of mysqltcl, you may also need to set the username to be "".
set mysqluser nobody
set mysqlpassword ""

View File

@@ -73,11 +73,16 @@ if {[info exists tcl_version] && $tcl_version >= 8.0} {
proc NOTDEF {foo} {
}
proc ConnectToDatabase {} {
global mysqlhandle mysqluser mysqlpassword
if {![info exists mysqlhandle]} {
if { $mysqlpassword == "" } {
set mysqlhandle [mysqlconnect -user "$mysqluser"]
if { $mysqluser == "" } {
set mysqlhandle [mysqlconnect]
} else {
set mysqlhandle [mysqlconnect -user "$mysqluser"]
}
} else {
set mysqlhandle [mysqlconnect -user "$mysqluser" -password "$mysqlpassword"]
}