In the past someone posted a problem with mod_perl and DbI giving blank 
pages from a SQL query. I did some digging around and found some info but I 
need someone to fill in the holes for me a little.

I created a DB Table "webtest". In the table, I filled it with the contents 
of /usr/local/dict/propernames. Fine! it worked beautifully. 

However, when I do a "random" query I get some blank pages. I traced this to 
the DBI Log using the "DBH->Trace(2, /tmp/DBI.log)". I found that sometimes 
the "execute()" returns "0E0". Does anybody knows why?? 

I did a simple logic to check for the value return by "execute()", if the 
value is "0E0" then do the same query. Do this same query until the value 
return by "execute()" is not "0E0". However, I am still getting blank pages. 

I am sending the actual script that I have been working on to provide a 
complete picture. 

Thank you in advanced 

 -max
====================SCRIPT==========================
     1 package DBNE2;
     2
     3 use strict;
     4 use vars qw($DBH);
     5 use Apache;
     6 use DBI();
     7
     8 sub handler {
     9         $DBH = DBI->connect("DBI:mysql:test","webuser","mult1scan") 
|| die $DBH->errstr;
    10         my $r = shift;
    11         my $h = $DBH->trace(2,"/tmp/DBNE2.log");
    12
    13         my $IdHandle = $DBH->prepare("SELECT MAX(id) FROM webtest");
    14         $IdHandle->execute;
    15         my $id = $IdHandle->fetchrow;
    16
    17         my $RowHandlesth = $DBH->prepare("SELECT * FROM webtest WHERE 
id = ROUND( (RAND() * ?) + 1)");
    18         $RowHandlesth->execute($id);
    19
    20         while (! $RowHandlesth ) {
    21                 $RowHandlesth->execute($id);
    22
    23                 if ( $RowHandlesth ) {
    24 #                       my @row = $RowHandlesth->fetchrow;
    25                         last;
    26                 }
    27         }
    28         my @row = $RowHandlesth->fetchrow;
    29
    30         $r->content_type("text/html");
    31         $r->send_http_header;
    32         $r->print(@row);
    33         $RowHandlesth->finish;
    34 }
    35
    36 1;

Reply via email to