This has been a puzzler for me for some time, so hopefully
someone can edify me.

I have a pure Perl driver on which I'm doing some serious
refactoring (removing 6 years of accumulated cruft),
and added a simple function to build $sth's from an input
argument hash. Since most of the arguments are just
$sth attributes, I simply called

$sth = DBI::_new_sth($dbh, \%args);

which works fine...until I later attempt to call $sth->_set_fbav()
to stash a row, where it chokes with "NUM_OF_FIELDS probably isn't
set right". After verifying everything is where I expect it
to be, I run with DBI::PurePerl...and it runs just fine.

So after a lot of trial & error messing about with _new_sth(),
I discover I can pass in all of my argument hash *except* NUM_OF_FIELDS;
it has to be set *after* I create the $sth...even tho I've set
all of NUM_OF_PARAMS/NAME/TYPE/PRECISION/etc. in the call to _new_sth().

Is this a bug, or is there a reason for this ? If the latter, is it
documented anywhere ? As the author of several pure Perl DBD's,
(and hopefully a few more in the near future), I've always worked
around this with lots of explicit per-field assignment code
that could've/should've just been passed to the constructor.
Even if I have to leave that code in place, it would be nice to
understand why...

- Dean

Reply via email to