On Fri, 3 Jan 2003 18:34:36 -0500 (EST) Paul Boutros <[EMAIL PROTECTED]> wrote:
> > On Fri, Jan 03, 2003 at 07:57:01AM -0800, Michael Peppler wrote: > > The DBD::Sybase execute() method should effectively call finish() if > > the statement handle is 'Active' when execute is called. That's one > > of the main reasons the flag exists at all. > > I see this problem routinely when working with DBD::ODBC and using "Select > count(*)" statements within a while loop. Because I know there is only > one row to retrieve I don't bother running the fetch in a loop. And, to > get the code to run I always seem to have to at the ->finish(). Are you > saying that DBD::ODBC should be checking for me if the $sth is still > active, and finishing it? If so, is something else going on in the cases > where I have to add the ->finish()? > > Hope this isn't a trivial question, but I've been curious about this for a > long time given the recommendation in the DBI perldoc not to use > ->finish() and my own experience that it seems required in some cases. That is one the situations where $sth->finish() *should* be called. Until you try to fetch the row after the last one, DBI doesn't know that all rows have been fetched. When the fine manual says 'fetching all the data', it normally means 'fetching all the data and stopping because fetch said there was no more'. The tricky part is figuring out how to describe that situation without doubling the size of the manual. The current wording assumes you either fetch a fixed number of rows and don't run off the end (so you need to call finish()) or you keep fetching until fetch*() tells you to stop because you tried to fetch an extra row or had an error. -- Mac :}) ** I normally forward private questions to the appropriate mail list. ** Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html Give a hobbit a fish and he eats fish for a day. Give a hobbit a ring and he eats fish for an age.
