Coderifous
Programmer
Hey all,
I'm developing Perl-Powered websites w/ backend DB's in MySQL. I use DBI.pm. For admin use, I have a script that dumps the contents of a MySQL table, into an HTML table to the browser. This works 99% of the time without a hitch. I mean - it takes a minute, but thousands of lines will dump to the browser if that's what I tell it to do. No problem there.
Here's the problem:
I wrote a script to do this routine 'dump' on another routine table. As you can see, there is nothing special so far. However, when I execute the script via browser - it hangs. It 'prints' everything up to the beginning of the table and then stops. (So I can see the page title, header, and that's it). After waiting any arbitrary amount of time (it can be 2 seconds or 10 minutes - doesn't matter) I'll click the 'stop' button on my browser, and that's when (using MS Internet Explorer) the available tables contents are displayed. It's not the whole table though. The HTML stops at the same point everytime. Like for some reason MySQL just stops talking right there, and the rest of the processes are just sitting there waiting - wondering.
I don't know if I was very clear on this, but the bottom line is, MySQL is causing my script to hang and it shouldn't. Has anyone else heard of/dealt with this behavior? Would enjoy a little assistance. And oh yea, here is some of my code (I'll abrreviate some peices):
Keep in mind that, syntactically, everything is fine. I don't think it's Apache since other similar scripts run just fine (and return larger and smaller datasets). I really think it's MySQL.
Thanks - I hope.
--jim
I'm developing Perl-Powered websites w/ backend DB's in MySQL. I use DBI.pm. For admin use, I have a script that dumps the contents of a MySQL table, into an HTML table to the browser. This works 99% of the time without a hitch. I mean - it takes a minute, but thousands of lines will dump to the browser if that's what I tell it to do. No problem there.
Here's the problem:
I wrote a script to do this routine 'dump' on another routine table. As you can see, there is nothing special so far. However, when I execute the script via browser - it hangs. It 'prints' everything up to the beginning of the table and then stops. (So I can see the page title, header, and that's it). After waiting any arbitrary amount of time (it can be 2 seconds or 10 minutes - doesn't matter) I'll click the 'stop' button on my browser, and that's when (using MS Internet Explorer) the available tables contents are displayed. It's not the whole table though. The HTML stops at the same point everytime. Like for some reason MySQL just stops talking right there, and the rest of the processes are just sitting there waiting - wondering.
I don't know if I was very clear on this, but the bottom line is, MySQL is causing my script to hang and it shouldn't. Has anyone else heard of/dealt with this behavior? Would enjoy a little assistance. And oh yea, here is some of my code (I'll abrreviate some peices):
Code:
...
my $query = "SELECT * FROM access_log ORDER BY date";
my $dbh = WebDB::connect('access'); #personal module
my $sth = $dbh->prepare($query);
$sth->execute();
print <<EOF;
<!-- Some HTML here that starts the table -->
EOF
while(my @results = $sth->fetchrow_array()){
local $\ = "\n";
print "<TR>";
shift @results; # toss the id field,
# don't need it here
print "<TD>$_</TD>" for @results;
print "</TR>";
}
print "</TABLE>";
...
Keep in mind that, syntactically, everything is fine. I don't think it's Apache since other similar scripts run just fine (and return larger and smaller datasets). I really think it's MySQL.
Thanks - I hope.
--jim