Hello All,

I've got the following problem:

Using DBD::PgPP for Postgres works fine, as long as I don't do a fetch indside of a fetch. Running the following code:


$db1=DBI->connect("dbi:PgPP:dbname=$cfg{dbname};host=$cfg{dbhost};port=$cfg{dbport}",$cfg{dbuser},$cfg{dbpassword},{PrintError=>0,AutoCommit=> 1}) or $err=$DBI::errstr;
adminmail($err),exec ("$workdir/msmonbackup.pl") if (!$db1);
$statement="SELECT device_id FROM devices WHERE monitor=true";
$st1=$db1->prepare($statement) or $err=$DBI::errstr;
adminmail($err),exec ("$workdir/msmonbackup.pl") if (!$st1);
adminmail($DBI::errstr),exec ("$workdir/msmonbackup.pl") if (!$st1->execute);
while ($row1=$st1->fetchrow_arrayref) {
$statement="SELECT ip,probes,packetloss,duration,last_check,sms,mail FROM ip WHERE device_id=$row1->[0]";
$st2=$db1->prepare($statement) or $err=$DBI::errstr;
adminmail($err),exec ("$workdir/msmonbackup.pl") if (!$st2);
adminmail($DBI::errstr),exec ("$workdir/msmonbackup.pl") if (!$st2->execute);
while ($row2=$st2->fetchrow_arrayref) {
$device{$row2->[0]}=$row1->[0];
$probes{$row2->[0]}=$row2->[1];
$packetloss{$row2->[0]}=$row2->[2];
$duration{$row2->[0]}=$row2->[3];
$last_check{$row2->[0]}=$row2->[4];
}
}

gives me the error message:

_set_fbav(ARRAY(0x831217c)): array has 7 fields, should have 1X� at /usr/lib/perl5/site_perl/5.6.1/DBD/PgPP.pm line 336, <IN> line 6.

I think that this means that there is only memory reserved for one field. Now, that the second fetch ends up with seven fields seems to lead into problems. Shouldn't every handle be treated separately?
Am I doing something wrong or is there a problem with the driver?

Best regards,

Stephan

Reply via email to