I can't tell you for sure the cause of this strange behavior, but there are a couple of things that are worth saying about your problem.

HTH

Update

Just to explain better my story. The call to finish is always necessary. There are times when the DBI calls finish implicitly, for example, when you use a call to fetchall_* or selectall_* functions. The finish is also implicit when the fetch function is inside a loop. In all the other cases, you should call it. And, just to be paranoid, if you call it even after a loop, you don't do any damage. :)

A driver can be implemented in such a way that a call to finish is not necessary. For example, if the driver uses some sort of "fetch-at-once" mechanism, then the finish is not needed, because the driver itself, internally, has already retrieved ALL the records.

Update (2)

The DBI docs say that the driver should call finish "when all the data has been fetched." The driver has two ways of know that *ALL* the data is fetched: either you call a "fetch-all-at-once" routine or you call a "fetchrow_*" in a loop until it returns undef. When one of these cases happen, the driver calls finish.

If you call a fetchrow_* function only once, the driver does not know if there is more data to fetch or not.

_ _ _ _ (_|| | |(_|>< _|

In reply to Re: DBI (Prepare once execute many fails) by gmax
in thread DBI (Prepare once execute many fails) by ColtsFoot

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.