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 

Question regarding mysqltcl and moreresult

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


Joined: 30 Apr 2012
Posts: 5

PostPosted: Fri May 04, 2012 8:53 pm    Post subject: Question regarding mysqltcl and moreresult Reply with quote

As I haven't been able to track down a more suitable forum for this API, I hope it's okay that I ask this here.

I have been playing around abit lately with the mysqltcl API, but I've stumbled upon something that I do not understand. From what I can gather from the manual and this example, using mysql::moreresult should return true if there are more data available from a SELECT statement. This is the code I'm running:

Code:
set sqlLink [::mysql::connect -host $sqlHostname -user $sqlUsername -password $sqlPassword -db $sqlDatabase]
set sql "SELECT * FROM tcltest"
set query [::mysql::query $sqlLink $sql]

puts "moreresult: [::mysql::moreresult $query]"

if {[::mysql::moreresult $query]} {

        puts [::mysql::fetch $query]
        puts [::mysql::fetch $query]
        puts [::mysql::fetch $query]

}


I know that the test table only holds three rows, which is why I've conveniently lined up three fetch's in a row. But, the thing is, this does not have the outcome I expect. This is what I get when I run the tcl:

Code:
keung@coeus:~/tcl$ ./mysql.tcl
moreresult: 0


Now, if I remove the if-statement completely, this is the result:

Code:
keung@coeus:~/tcl$ ./mysql.tcl
moreresult: 0
1 keung gnuek ungke
2 bla inst prep
3 eon pondus m


Does anyone know what I am doing wrong? Smile
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