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 

Too many connections in server MySQL

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


Joined: 14 Aug 2009
Posts: 55

PostPosted: Tue Sep 14, 2010 2:35 pm    Post subject: Too many connections in server MySQL Reply with quote

Hello I tried to use mysql for storing data, but I encountered this problem

Quote:
Tcl error [Channel:check]: mysql::connect/db server: Trop de connections


This is code
Code:
bind pubm - * Word:check
proc Word:check {nick host hand chan text} {
   if {![channel get $chan badword]} { return 0 }
   if {[isop $nick]} {return 0}
   if {[matchattr $hand o|o $chan]} { return 0 }
   set conx [getConnection]
   set sqltext [::mysql::escape "SELECT * FROM ExceptWord where '$text' LIKE Mot"]
   set wordcheck [mysqlsel $conx $sqltext]
   if {$wordcheck  > 0} {putlog "$text existant" ; return 0}
   set sqltext [::mysql::escape "SELECT * FROM ExceptWord where '$text' LIKE Badword"]
   set Badwordcheck [mysqlsel $conx $sqltext]
   if {$Badwordcheck  > 0} {
      set why [mysqlsel $conx "SELECT Raison FROM BadWord WHERE '$text' LIKE Badword"]
      if {[llength $why] > 0} {
         set ban "*!*[string range $host [string first @ $host] e]"
         putserv "PRIVMSG X :ban $chan $ban 5 75 [lindex $why 0]"
         mysql::close $conx
      }
      return 0
   }
}


there must be a way to close the open connection thanks
Back to top
View user's profile Send private message
DarkRaptor
Voice


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

PostPosted: Tue Sep 14, 2010 6:03 pm    Post subject: Reply with quote

Hi,

Your code close the connection only if llenght $why is greater than 0. I suggest put mysql::close just before the last close-brace.
_________________
DarkRaptor @ irc.undernet.org
Back to top
View user's profile Send private message
neoclust
Halfop


Joined: 14 Aug 2009
Posts: 55

PostPosted: Tue Sep 14, 2010 6:49 pm    Post subject: Reply with quote

I have placed after return and the same message
Back to top
View user's profile Send private message
DarkRaptor
Voice


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

PostPosted: Tue Sep 14, 2010 8:10 pm    Post subject: Reply with quote

Code:
bind pubm - * Word:check
proc Word:check {nick host hand chan text} {
   if {![channel get $chan badword]} { return 0 }
   if {[isop $nick]} {return 0}
   if {[matchattr $hand o|o $chan]} { return 0 }
   set conx [getConnection]
   set sqltext [::mysql::escape "SELECT * FROM ExceptWord where '$text' LIKE Mot"]
   set wordcheck [mysqlsel $conx $sqltext]
   if {$wordcheck  > 0} {putlog "$text existant" ; return 0}
   set sqltext [::mysql::escape "SELECT * FROM ExceptWord where '$text' LIKE Badword"]
   set Badwordcheck [mysqlsel $conx $sqltext]
   if {$Badwordcheck  > 0} {
      set why [mysqlsel $conx "SELECT Raison FROM BadWord WHERE '$text' LIKE Badword"]
      if {[llength $why] > 0} {
         set ban "*!*[string range $host [string first @ $host] e]"
         putserv "PRIVMSG X :ban $chan $ban 5 75 [lindex $why 0]"
      }
      return 0
   }
   # here
   mysql::close $conx
   # 
}

_________________
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