Baby Moose Has a Bug?

Well it get lucky postette day here in the Moose-Pen.

Well I left off yesterday a little worried that I was only testing half of the execute_array as I never actually got down into the DBI code of things. So I decided lets give it a try on that pre-installed 'DBD::DBM' that I used in my '10_crud_basic.t' test case as according to the DBI docs there shold be a defult implimentsion of 'execute_array''

Well I opened that sucker up and added this in

$container = [{username=>'Bill',address =>'ABC'},
              {username=>'Jane',address =>'DEF'},
              {username=>'John',address =>'HIJ'},
              {username=>'Joe',address =>'KLM'},
$user->create( $utils->connect(),$container);
and then got

DBD::DBM::st execute_array failed: 4 bind values supplied but 2 expected [for Statement "INSERT INTO user ( user.address, user.username ) VALUES( ?, ? )"] at D:\GitHub\database-accessor-driver-dbi\lib/Database/Accessor/Driver/ line 99.
hmm perhaps things will work out as it look like I get into my DBI code and the SQL;

INSERT INTO user ( user.address, user.username ) VALUES( ?, ? );
parsed what failed I was trying to bind more that two params. That led me to this block of code where I might have a problem;

--->foreach my $index (1..$self->param_count()){
          if ($self->is_exe_array()){
          else {
           $sth->bind_param( $index,$self->params->[$index-1]->value ); 

I was thinking I can not just use 'param_count' because in a normal bind it is the total number of params is two while in the case of an Array_bind it is two but it will have to happen 4 times. Now on second look the above code is correct I my iterate four times but I bind only twice as $result->params()->[0] is this array ref;

so what gives; I just happen to have an Oracle DB handy so I created the same test table, connected to Oracle with DBD::Oracle and I got 4 records added Hmm I then trying the same thing on a Postgress DB and it work. Could there bug in DBI or DBD::DBM?.

Oh well at least I have my post for tomorrow.


Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations