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

	<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>2012-07-02T05:41:27-04:00</updated>

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

		<entry>
		<author><name><![CDATA[MasterOfX]]></name></author>
		<updated>2012-07-02T05:41:27-04:00</updated>

		<published>2012-07-02T05:41:27-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=99656#p99656</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=99656#p99656"/>
		<title type="html"><![CDATA[mysqltcl: cannot access additional result sets]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=99656#p99656"><![CDATA[
mysqltcl works very well for most of what I need done, but I tend to write procs so that the error trapping can be managed more centrally.  So here's the problem.  I have procedures that return multiple result sets.  I can access the first result set, and I know the additional sets are there because the ::mysql::state says "RESULT_PENDING"<br><br>However, I cannot feed it an appropriate query handle to pull the records from the pending results, because I can't find a procedure that returns a new handle to me.  In PHP this would be done using something like store_result, but they also have a special method for working with multi-set queries;  mysqltcl has no documented implementation of multiquery, and they have no listed procs that return a new query handle;  furthermore, the original query handle is, as expected, no longer useful after the last record's been fetched.  <br><br>I should add here that I have already enabled Multiple Statements and Multiple Results in the connection, and I have even called ::mysql::setserveroption -multi_statment_on as demonstrated in the final procedure post.<br><br>The procedure follows.  Line 24 (Base 1) is where I'm having the issue.  If there's someone here that can help me, or refer me to a reference other than the ones that resemble <a href="http://makelinux.org/man/3/M/mysqltcl" class="postlink">http://makelinux.org/man/3/M/mysqltcl</a> and <a href="http://manpages.ubuntu.com/manpages/precise/man3/mysqltcl.3.html" class="postlink">http://manpages.ubuntu.com/manpages/pre ... tcl.3.html</a>, I'd be much obliged.  It's not a time critical thing, no business functions are going to crash, no chat rooms will be inaccessible;  It's just something I'd like to be able to implement in multiple applications.<br><br>Thanks in advance!<br><br><br><div class="codebox"><p>Code: </p><pre><code>proc loadbstriggers {} {  global botscenetriggers  set mysqliCN [getMysqliCN]  set list {}  set sql "call GetBotScene_Triggers();"  putlog "loadbstriggers 1 - sql:$sql"  if {[catch {::mysql::query $mysqliCN $sql} rs] == 1} {    putlog "loadbstriggers 1a - sql:$sql \nError:$rs"  } else {    putlog "loadbstriggers 1b - rs:$rs"    while {[set row [::mysql::fetch $rs]]!=""} {      lassign $row triggerID triggerName      lappend list [list $triggerID $triggerName {}]    }    lset botscenetriggers {} $list    if {[catch {::mysql::moreresult $mysqliCN} more] == 1} {      putlog "loadbstriggers 1c - \nError:$more"    } else {      putlog "loadbstriggers 1d - ::mysql::moreresult: $more"      if {$more != 0} {        set rows [::mysql::nextresult $mysqliCN]        putlog "loadbstriggers 1e - rows:$rows"        while {[set row [::mysql::fetch $rs]]!=""} {          lassign $row triggerID triggerName          putlog "loadbstriggers 1f - row:$row"          lappend list [list $triggerID $triggerName {}]        }        lset botscenetriggers {} $list      }    }    ::mysql::endquery $mysqliCN  }}</code></pre></div>For those that would like to be certain I'm envoking the connection properly, I've included my mysqltcl connection routine<br><div class="codebox"><p>Code: </p><pre><code>proc getMysqliCN {args} {  global mysqliCN  set state [::mysql::state $mysqliCN]  #putlog "getMysqliCN -state:$state"  if {$state == 0 || $state == 1 || $state == "NOT_A_HANDLE" || $state == "UNCONNECTED" } {    set mysqliCN [::mysql::connect -multistatement 1 -multiresult 1 -user dbuser -host 127.0.0.1 -db dbname -password password]    ::mysql::setserveroption $mysqliCN -multi_statment_on    putlog "getMysqliCN - connecting to mysql: $mysqliCN"  } elseif { $state == 4 ||$state == "RESULT_PENDING" } {    set trash [::mysql::sel $mysqliCN "select 0" -flatlist]  }  return $mysqliCN}</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=12023">MasterOfX</a> — Mon Jul 02, 2012 5:41 am</p><hr />
]]></content>
	</entry>
	</feed>
