<?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/17538" />

	<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>2010-01-24T13:28:51-04:00</updated>

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

		<entry>
		<author><name><![CDATA[inaba]]></name></author>
		<updated>2010-01-24T13:28:51-04:00</updated>

		<published>2010-01-24T13:28:51-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91817#p91817</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91817#p91817"/>
		<title type="html"><![CDATA[mysql tcl and variables woes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91817#p91817"><![CDATA[
<img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_biggrin.gif" width="15" height="15" alt=":D" title="Very Happy"><br><br>Got it working as expected thank you very much ^-^<br><div class="codebox"><p>Code: </p><pre><code>set r [mysqlconnect -host $db(host) -user $db(user) -db $db(name) -password $db(pass)]  mysqluse $r $db(name)  foreach idr [mysqlsel $r "select id from users WHERE username = '$nick'" -list] {      puts $idr  }  mysqlclose $r</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11074">inaba</a> — Sun Jan 24, 2010 1:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-01-24T12:06:56-04:00</updated>

		<published>2010-01-24T12:06:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91814#p91814</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91814#p91814"/>
		<title type="html"><![CDATA[mysql tcl and variables woes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91814#p91814"><![CDATA[
One more thing, you can't use variable- or command-substitutions within {}. You'll have to use "" instead for this..<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Jan 24, 2010 12:06 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[inaba]]></name></author>
		<updated>2010-01-24T11:38:08-04:00</updated>

		<published>2010-01-24T11:38:08-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91812#p91812</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91812#p91812"/>
		<title type="html"><![CDATA[mysql tcl and variables woes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91812#p91812"><![CDATA[
okays, change the select query and still getting the same behaviour:<br><div class="codebox"><p>Code: </p><pre><code>set r [mysqlconnect -host $db(host) -user $db(user) -db $db(name) -password $db(pass)] mysqluse $r $db(name) foreach idr [mysqlsel $r {select id from users WHERE username = '$nick'} -flatlist] {     puts $idr } mysqlclose $r</code></pre></div>Thanks for the help, and as is evident, I'm pretty new to tcl &gt;.&lt;<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11074">inaba</a> — Sun Jan 24, 2010 11:38 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[nml375]]></name></author>
		<updated>2010-01-24T10:44:34-04:00</updated>

		<published>2010-01-24T10:44:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91809#p91809</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91809#p91809"/>
		<title type="html"><![CDATA[mysql tcl and variables woes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91809#p91809"><![CDATA[
Please read the documentation for the mysqlexec command:<blockquote class="uncited"><div>::mysql::exec handle sql-statement<br>    Send sql-statement, a MySQL non-SELECT statement, to the server. The handle must be in use (through ::mysql::connect and ::mysql::use).<br><br>    ::mysql::exec implicitly cancels any previous result pending for the handle.<br><br>    <strong class="text-strong">If sql-statement is a valid MySQL SELECT statement, the statement is executed, but the result is discarded. No Tcl error is generated. This amounts to a (potentially costly) no-op. Use the ::mysql::sel command for SELECT statements.</strong><br><br>    ::mysql::exec returns the number of affected rows (DELETE, UPDATE). In case of multiple statement ::mysql::exec returns a list of number of affected rows.</div></blockquote>As suggested, use the mysqlsel command instead, or the mysqlquery command along with mysqlresult.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8052">nml375</a> — Sun Jan 24, 2010 10:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[inaba]]></name></author>
		<updated>2010-01-23T21:17:27-04:00</updated>

		<published>2010-01-23T21:17:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=91804#p91804</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=91804#p91804"/>
		<title type="html"><![CDATA[mysql tcl and variables woes]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=91804#p91804"><![CDATA[
I'm trying to get a variable by using sql, and then go on to use said variable in the next sql query, but things dont go as planned <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_sad.gif" width="15" height="15" alt=":(" title="Sad"><br><br>this is my current proc:<br><div class="codebox"><p>Code: </p><pre><code>proc to_shoutbox {nick uhost hand chan text} {global db botid botnm idrset message [lrange $text 0 end]if { $message == "" } {putquick "NOTICE $nick : !shout &lt;message&gt;"} else {set added [clock seconds]set id "select id from users where username = '$nick'";set db_hand [mysqlconnect -host $db(host) -user $db(user) -password $db(pass) -db $db(name)]set idr [mysqlexec $dbhand $id]if { $idr == 0 } {putquick "NOTICE $nick : UID grab failed!"} else {putquick "NOTICE $nick : UID grab possible success!"}mysqlclose $dbhandset query "INSERT INTO chat(id, uid, time, name,text) VALUES('','$idr','$added','$botnm - $nick','$message')";set db_hand [mysqlconnect -host $db(host) -user $db(user) -password $db(pass) -db $db(name)]set result [mysqlexec $db_hand $query]if { $result == 1 } {putquick "NOTICE $nick : Shout sent!"} else {putquick "NOTICE $nick : There was an error!"}mysqlclose $db_hand}}</code></pre></div>I cant for the life of me see whats going wrong, the sql works fine for SSH, and returns the expected value, but in the tcl, it doesnt cause an error, but it always returns with 0, so when I call on $idr in the second query it will always input 0, regardless of what it should be.<br><br>Any help would be appreciated :3<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=11074">inaba</a> — Sat Jan 23, 2010 9:17 pm</p><hr />
]]></content>
	</entry>
	</feed>
