I've got this code working, but the return data, which is about 20,000 rows and 96 columns takes over 10 minutes to finish showing up in Mozilla firefox. Does anyone see a way to speed this up? Thanks in advance for any help you can give me.
Cliff
sub getQuestionaire {
my($col, $count);
$count=0;
text('Here is the questionaire info:');
print "<table width='340' border='1' cellspacing='1' cellpadding='1'>"
+;
print "<tr>";
foreach $col(@cols){
print "<td><b>$col</b></td>";
}
print "</tr>";
my $table='p_questionnaire';
my $fields=join(",",@cols);
my($sth);
my $sql = qq{SELECT $fields FROM $table ORDER BY patient_id};
$sth = $dbhSt->prepare($sql);
$sth->execute;
my %rec =();
$sth->bind_columns(map {\$rec{$_}} @cols);
while ($sth->fetchrow_arrayref){
if($count eq 25){
print "<tr>";
foreach $col(@cols){
print "<td><b>$col</b></td>";
}
print "</tr>";
$count=0;
}
print "<tr>";
foreach $col(@cols){
my $val= $rec{$col};
if($val eq ''){
$val='NULL';
}
print "<td>$val</td>";
}
print "</tr>";
$count=$count +1;
}
$sth->fetchrow_arrayref;
$sth->finish;
print "</table>";
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.