keung Voice
Joined: 30 Apr 2012 Posts: 5
|
Posted: Fri May 04, 2012 8:53 pm Post subject: Question regarding mysqltcl and moreresult |
|
|
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?  |
|