> Also note that some objects have stringifying methods which allow you
> to use "" or qq() to convert the objects into a useful string.  None
> of that applies to normal DBI placeholders though.
>
> Alex:
>
> I hope you aren't depending on $rv4 to tell you whether a select
> found any rows.  The return value from execute() is not generally a
> dependable row count for SELECT statements.

oh - why not? i have tryed with a debug line and i've tested this... of no
match is found i will get 0E0 back and if one is found it will give me 1
back... should i change this? how - what is bedder?


 my $sth4 = $dbh->prepare("
   SELECT
    REMOTE_ADDR,
    FIRST_ACCESS,
    HTTP_USER_AGENT
   FROM
    $dbtable_reclickcheck
   WHERE
    (REMOTE_ADDR=?) and
    (FIRST_ACCESS > SUBDATE(NOW(),INTERVAL 30 MINUTE)) and
    (HTTP_USER_AGENT=?)
   ");

 print "DEBUG: $ip, $http_user_agent\n" if ($debug);
 my $rv4 = $sth4->execute($ip,$http_user_agent);

 print "DEBUG: $rv4 row(s) found rv4\n" if ($debug);
 if ($rv4 eq '0E0') {
  $dbh->do("
   INSERT INTO $dbtable_reclickcheck
    (
    REMOTE_ADDR,
    FIRST_ACCESS,
    HTTP_USER_AGENT
    )
   VALUES (
    '$ip',
    NOW(),
    '$http_user_agent'
    )
   ");
 }
 $sth4->finish();


Alex


Reply via email to