egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

mysql connect

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Fire-Fox
Master


Joined: 23 Sep 2006
Posts: 270
Location: /dev/null

PostPosted: Mon Nov 16, 2009 5:04 am    Post subject: mysql connect Reply with quote

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:
##################
### Mysql path ###
##################
if {![info exists db_handle] } {
set db_handle [mysqlconnect -host xxxx.xxxx.xxxxx -port xxxx -user xxx -password xxxxx -db xxxxxx]
}

Code:

     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
Back to top
View user's profile Send private message MSN Messenger
DarkRaptor
Voice


Joined: 15 Apr 2006
Posts: 36
Location: Trois-Rivières, Qc

PostPosted: Mon Nov 23, 2009 12:05 am    Post subject: Reply with quote

Hi Fire-Fox,

I'm using this in my script.

Code:

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber