This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

mysql connect

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
Fire-Fox
Master
Posts: 299
Joined: Sat Sep 23, 2006 9:01 pm
Location: /dev/null

mysql connect

Post by Fire-Fox »

Hey

How do i get the bot to keep connection to the mysql database, without replying "The connection to the mysql server has been lost." almost all the time?

Code: Select all

##################
### Mysql path ###
##################
if {![info exists db_handle] } {
set db_handle [mysqlconnect -host xxxx.xxxx.xxxxx -port xxxx -user xxx -password xxxxx -db xxxxxx]
}

Code: Select all

     if {[mysqlping $db_handle] != 1} { 
         putserv "PRIVMSG $channel :The connection to the mysql server has been lost."
         return 0
     }
GreatZ
Fire-Fox | Denmark

Scripts: Relay | Store Text | TvMaze
User avatar
DarkRaptor
Voice
Posts: 36
Joined: Sat Apr 15, 2006 2:39 am
Location: Trois-Rivières, Qc

Post by DarkRaptor »

Hi Fire-Fox,

I'm using this in my script.

Code: Select all

proc name { all arguments } {
   mysqlconnect

   conditions
   &
   commands

   mysqlclose
}
I'm sure to have a "fresh" connection to the mysql server.

Note: I put "mysqlclose" at each location that the script ends.
DarkRaptor @ irc.undernet.org
Post Reply