Jenda Krynicky wrote:
> From: "Martin J. Evans" <martin.ev...@easysoft.com>
>> I've written up some of the issues causing confusion on dbi-users (and 
>> to me personally) with DBD::ODBC and MS SQL Server here:
>>
>> http://www.martin-evans.me.uk/node/58
>>
>> I encourage all feedback.

Thanks for your comments.

> SET NOCOUNT ON
> 
> and most of the resultsets with zero columns are gone. It's a good 
> idea anyway as it conserves some resources that would otherwise be 
> wasted on providing the data you are not interested in.

Yes, you are correct and that is most definitely worth mentioning.

> And I don't think "doesn't batch the statements" is a good way to 
> explain this. If the INSERT/UPDATE/DELETE happened to be inside a 
> loop, you'd get as many resultsets as the number of iterations. And 
> you do not "move from one (statement) to the next" by calling the 
> SQLMoreResults, you merely move from the RESULTS of one to the 
> RESULTS of the other. MSSQL AFAIK doesn't wait till you process the 
> results before it starts processing the next statement.

I meant result and not statements - thanks for pointing that out.

I'm not sure it is relevant (in the context of what I'm talking about -
ODBC) what MSSQL itself does when executing a procedure which generates
multiple results i.e., whether it waits until you process the results,
because you cannot move on to the next set of results in ODBC terms
until you call SQLMoreResults. What I was attempting to explain is that
in DBD::ODBC, when you have called a procedure which generates multiple
result-sets, DBD::ODBC automatically calls SQLMoreResults if a)
SQLNumResultCols returns 0 (indicating it is a non-result-set generating
statement [as you correctly point out SET NOCOUNT ON affects this]) or
b) if you fetch data from the result-set until SQLFetch returns
SQL_NO_DATA. Then, in DBD::ODBC, calling odbc_more_results simply tells
you whether the SQLMoreResults call DBD::ODBC made returned successfully
(indicating more results) or with SQL_NO_DATA (indicating no more
results). Perhaps I did not make that clear enough and I'll review that.


> Jenda
> ===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
> When it comes to wine, women and song, wizards are allowed 
> to get drunk and croon as much as they like.
>       -- Terry Pratchett in Sourcery
> 
> 

Thanks for your feedback, it is much appreciated.

Martin
-- 
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to