|P is for Practical|
Clarification required: multiple data sets from MySQL stored procedureby smiffy (Pilgrim)
|on Jan 03, 2009 at 00:45 UTC||Need Help??|
smiffy has asked for the
wisdom of the Perl Monks concerning the following question:
I have been reading through Multiple data sets in MySQL stored procedures and am seeking clarification of exactly what is going on.
The example uses a loop whilst $sth->more_results. This suggests a situation where the number of result sets is unknown. The procedure that I have in mind would return a fixed number of result sets so I was wondering if I could simplify to this (assumes three result sets returned):
...or whether I have got the wrong end of the stick entirely.
Having played around a bit, I have found that that $sth->more_results() must be called before the next result set appears so the code above does not work. This works:
I don't have time to write up a full example at present but can summarise that the only difference between retrieving multiple results sets is that you have to call $sth->more_results() between them.
There is now a node as a response to the original providing a cross-reference to this one.