in reply to Re^2: sth fetch only grabbing back first result
in thread sth fetch only grabbing back first result

It may not solve Anonymous Monk's problem, but it does remove a specific issue: fetch is not a documented method of statement handles, so its behavior is effectively undefined. Switching to a documented method such as fetchrow_hashref should result in predictable behavior from the statement handle, which lets us focus on whatever may be causing the behavior. And if changing to the defined method results in the problem going away, well that's just groovy.

Update: Okay, so it is documented after all. Took me a while to scan through DBI, but fetch is an alias for fetchrow_arrayref with the apparent difference that:

If any method except fetch fails, and "RaiseError" is not set, selectcol_arrayref will return undef. If fetch fails and "RaiseError" is not set, then it will return with whatever data it has fetched thus far. $DBI::err should be checked to catch that.

So it's there in the docs after all, but it's not nearly as well defined as the others. That's what I get for just scanning through the headers of the POD rather than looking at the examples. Oy.

  • Comment on Re^3: sth fetch only grabbing back first result