| View previous topic :: View next topic |
| Author |
Message |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Tue Sep 14, 2010 2:35 pm Post subject: Too many connections in server MySQL |
|
|
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 |
|
 |
DarkRaptor Voice

Joined: 15 Apr 2006 Posts: 36 Location: Trois-Rivières, Qc
|
Posted: Tue Sep 14, 2010 6:03 pm Post subject: |
|
|
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 |
|
 |
neoclust Halfop
Joined: 14 Aug 2009 Posts: 55
|
Posted: Tue Sep 14, 2010 6:49 pm Post subject: |
|
|
| I have placed after return and the same message |
|
| Back to top |
|
 |
DarkRaptor Voice

Joined: 15 Apr 2006 Posts: 36 Location: Trois-Rivières, Qc
|
Posted: Tue Sep 14, 2010 8:10 pm Post subject: |
|
|
| 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 |
|
 |
|