I'm having trouble using bind_param in DBI with the Postgresql driver. I'm using the results of one query as bind params for a second query. The loop does print out $bind_class, but bind_param statement seems to do nothing. Only the bind_param outside of the loop results in something being returned. What have I done wrong?
my $sth = $dbh->prepare( $query ) || die "Could not prepare" ;
foreach my $row ( @$class_arrayref )
( $bind_class ) = @$row;
print "class = ".$bind_class."\n"; #debugging, works!
$sth->bind_param( 1, $bind_class ); # does not work
my $class = 'debian%';
$sth->bind_param( 1, $class ); # works!
my $rows = $sth->fetchall_arrayref();
I did not understand how bind_param works. I understood that this would execute the same statement multiple times with a different where clause and I could combine the results. I now see that was silly and inefficient of me. Sorry for the noise. Feel free to reap this node.