<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/15117" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2007-12-15T12:44:47-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/15117</id>

		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-12-15T12:44:47-04:00</updated>

		<published>2007-12-15T12:44:47-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79348#p79348</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79348#p79348"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79348#p79348"><![CDATA[
That would depend on how mysqllib has been set up. all "mysqlping" does is extract the handle from the commandline, and call the function <a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-ping.html" class="postlink">int mysql_ping(MYSQL *mysql)</a> from the mysql C library.<br><br>If the "auto-reconnect" feature has been enabled, a new connection is attempted, and should be available once the command returns. If not, it will only return the current status of the connection handle. Wether "auto-reconnect" is enabled or not would be controlled by the <a href="http://dev.mysql.com/doc/refman/5.1/en/mysql-options.html" class="postlink">int mysql_options(MYSQL *mysql, enum mysql_option option, const void *arg)</a> C library function.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sat Dec 15, 2007 12:44 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[metroid]]></name></author>
		<updated>2007-12-15T11:23:30-04:00</updated>

		<published>2007-12-15T11:23:30-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79347#p79347</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79347#p79347"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79347#p79347"><![CDATA[
Actually, according to the documentation, it should already try to reconnect on it's own, if you open a new connection, won't you have 2 open?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=5078">metroid</a> — Sat Dec 15, 2007 11:23 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[_mAyDaY_]]></name></author>
		<updated>2007-12-13T16:07:33-04:00</updated>

		<published>2007-12-13T16:07:33-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79308#p79308</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79308#p79308"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79308#p79308"><![CDATA[
i'm gonna try option 1 first<br>have to wait 8 hours first till i know the effect <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><br><br>thnx for helping, i'll post the results tomorrow<br><br>EDIT: worked! thnx nml375 for your help!<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9541">_mAyDaY_</a> — Thu Dec 13, 2007 4:07 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-12-13T15:27:07-04:00</updated>

		<published>2007-12-13T15:27:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79307#p79307</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79307#p79307"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79307#p79307"><![CDATA[
<blockquote class="uncited"><div>would that be something like this? (i looked over mysqltcl documentation, and couldn't find how to close the connection manually)</div></blockquote>Yup, would be something like that. In order to close the connection, use "mysqlclose".<br><blockquote class="uncited"><div>how would that be done?<br><br>maybe this ... ?<div class="codebox"><p>Code: </p><pre><code>set result2 [mysqlping $db_handle]if (result2 == false)   mysqlconnect -host localhost....</code></pre></div></div></blockquote><br>Almost, use braces rather than parenthesis...<br>Also, you really don't need an interim variable, just put the test directly into the if-conditional:<div class="codebox"><p>Code: </p><pre><code>if {![mysqlping $db_handle]} { set db_handle [mysqlconnect.....]}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Dec 13, 2007 3:27 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[_mAyDaY_]]></name></author>
		<updated>2007-12-13T15:18:58-04:00</updated>

		<published>2007-12-13T15:18:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79306#p79306</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79306#p79306"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79306#p79306"><![CDATA[
hey nml375, thnx for responding again!<br><blockquote class="uncited"><div>Option 1:<br>Move the mysqlconnect command inside the proc, calling it at the beginning of the proc. Would probably be a good idea to close the connection manually at the end of the proc to preserve resources (don't remember if myslqtcl reuses existing connections or not).</div></blockquote>would that be something like this? (i looked over mysqltcl documentation, and couldn't find how to close the connection manually)<div class="codebox"><p>Code: </p><pre><code>.....proc inv_1 { nick uhost handle arg } {   global userchan   set db_handle [mysqlconnect -host localhost -socket /var/run/mysqld/mysqld.sock -user $dbuser -password $dbpassword -db $name]......</code></pre></div><blockquote class="uncited"><div>Option 2:<br>Use the mysqlping to test wether the connection is alive or not. If not, reconnect...</div></blockquote>how would that be done?<br><br>maybe this ... ?<div class="codebox"><p>Code: </p><pre><code>set result2 [mysqlping $db_handle]if (result2 == false)   mysqlconnect -host localhost....</code></pre></div>btw. quote from the mysqltcl man page about mysqlping...<br><blockquote class="uncited"><div>mysql::ping handle<br>    Checks whether the connection to the server is working. If it has gone down, an automatic reconnection is attempted.<br>    This function can be used by clients that remain idle for a long while, to check whether the server has closed the connection and reconnect if necessary.<br>    Return True if server is alive </div></blockquote><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9541">_mAyDaY_</a> — Thu Dec 13, 2007 3:18 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-12-13T14:41:34-04:00</updated>

		<published>2007-12-13T14:41:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79303#p79303</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79303#p79303"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79303#p79303"><![CDATA[
Option 1:<br>Move the mysqlconnect command inside the proc, calling it at the beginning of the proc. Would probably be a good idea to close the connection manually at the end of the proc to preserve resources (don't remember if myslqtcl reuses existing connections or not).<br><br>Option 2:<br>Use the mysqlping to test wether the connection is alive or not. If not, reconnect...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Thu Dec 13, 2007 2:41 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[_mAyDaY_]]></name></author>
		<updated>2007-12-13T12:04:54-04:00</updated>

		<published>2007-12-13T12:04:54-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79299#p79299</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79299#p79299"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79299#p79299"><![CDATA[
<blockquote class="uncited"><div>One option may be to open the sql-connection on each invocation of the command. Another would be to use the mysqlping command to check the status of the connection upon each invocation...</div></blockquote>About 1st option - how to do that? (ie. what modifications need to be made to the code above)<br><br>About 2nd option - please note that i already tryed that in the code (line above set sql)<br><blockquote class="uncited"><div>Ahh I misunderstood, sounded like the mysql server was dying.</div></blockquote>MySQL db is working the whole time, no problems with it, it's just that it closes the connection by default after 8 hours<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9541">_mAyDaY_</a> — Thu Dec 13, 2007 12:04 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-13T02:36:02-04:00</updated>

		<published>2007-12-13T02:36:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79295#p79295</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79295#p79295"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79295#p79295"><![CDATA[
Ahh I misunderstood, sounded like the mysql server was dying.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Thu Dec 13, 2007 2:36 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2007-12-12T15:36:07-04:00</updated>

		<published>2007-12-12T15:36:07-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79286#p79286</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79286#p79286"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79286#p79286"><![CDATA[
Memleaks??<br><br>It's just a simple matter of the mysql-server closing the connection to preserve resources.<br><br>One option may be to open the sql-connection on each invocation of the command. Another would be to use the mysqlping command to check the status of the connection upon each invocation...<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Wed Dec 12, 2007 3:36 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[rosc2112]]></name></author>
		<updated>2007-12-12T15:12:20-04:00</updated>

		<published>2007-12-12T15:12:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79285#p79285</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79285#p79285"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79285#p79285"><![CDATA[
mem leak in mysql making it crash?  You'd have to check your mysql logs and that's a different forum altogether to support mysql.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=7395">rosc2112</a> — Wed Dec 12, 2007 3:12 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[_mAyDaY_]]></name></author>
		<updated>2007-12-12T07:00:48-04:00</updated>

		<published>2007-12-12T07:00:48-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=79277#p79277</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=79277#p79277"/>
		<title type="html"><![CDATA[mysqltcl - problem with mysqlsel]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=79277#p79277"><![CDATA[
hello everyone,<br><br>after weeks of googling and trying different combinations with the code, i'm out of ideas and need your help  <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> <br><br>i'm using a simple script to invite users to a channel using the MySQL db..<br>user sends his password and username in exchange for a channel invite<br><br>it all works nice, until db pings out (after 8 hours) and then the following msg is shown in the bot's log<br><div class="codebox"><p>Code: </p><pre><code>Tcl error [inv_1]: mysqlsel/db server: MySQL server has gone away</code></pre></div>here's the code of the invite.tcl script<br><div class="codebox"><p>Code: </p><pre><code>package require mysqltclset dbuser "myDB_user"set dbpassword "myDB_password"set name "myDB_name"set db_handle [mysqlconnect -host localhost -socket /var/run/mysqld/mysqld.sock -user $dbuser -password $dbpassword -db $name]set userchan "#myChan"bind msg - !invite inv_1proc inv_1 { nick uhost handle arg } {global userchan db_handle set arg [split $arg " "]set user1 [lindex $arg 0]set user1 [string range $user1 0 end]set pass1 [lindex $arg 1]set pass1 [string range $pass1 0 end]if { $user1 == "" || $pass1 == "" } {  putserv "privmsg $nick :Use: !invite &lt;username&gt; &lt;irc-key&gt;"  return 0      }mysqlping $db_handleset sql "SELECT irckey FROM users WHERE username='[mysqlescape $user1]'"set result [mysqlsel $db_handle $sql -list]    if {$result &gt; 0} {        set record [lindex $result 0];        set pass [lindex $record 0];        if {$pass1 == $pass} {                                putserv "NOTICE $nick :Welcome :)"            putserv "invite $nick $userchan"        } else {            puthelp "NOTICE $nick :Wrong password!"        }    } else {        puthelp "NOTICE $nick :Your username ($user1) was not found in our records."    }    mysqlendquery $db_handle}</code></pre></div>is there a proper soultion to this problem?<br>if not, would it be wise to rehash the bot every 8 hours? (and how to do that?)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=9541">_mAyDaY_</a> — Wed Dec 12, 2007 7:00 am</p><hr />
]]></content>
	</entry>
	</feed>
