Hi All,

I'm having trouble with using placeholders.  I had an sql statement that was
execute using a simple prepare, execute and fetchrow_hashref functions. Now
I'm trying to get it to work with place holders so I can get some
performance increase, since this block of code runs to many times not to
take advantage of prepared statements.

#   my $statement = "select count(*) viewable from pf_funding where ".
#                  "target_id = '$trg_id' and amt_allocated > 0.01 and year
= '" . $self->{year} . "'";

my $statement = "select count(*) as viewable from pf_funding where ".
                   "target_id = ? and amt_allocated > 0.01 and year = '" .
$self->{year} . "'";

   if (! defined($sth)) {
     $sth = $dbh->prepare($statement);
   }

   $sth->bind_param(1, $trg_id);
   $sth->execute();

   my $temp_values_hash_ref = $sth->fetchrow_hashref();
   foreach $key (keys %$temp_values_hash_ref) {
   warn "$key: ". $$temp_values_hash_ref{$key};
#              $$r_val_hash{$key} = $$temp_values_hash_ref{$key};
    }

I have done this before in some other applications and should not have any
problems. But in this case viewable always comeback as 0.

Also $sth->execute() returns E0E but there is nothing in $DBI::errstr

Am at the end of the line here folks and running out of ideas, i even tried
to do trace but that didn't give me any bigger insight on what is happening
here.

Thank you,

Anton Kokarski

Reply via email to