I don't see any reason for your code to hang in this snippet. Maybe you can optimize it a bit, as in the example below, but there is nothing so wrong that it could cause a halt.
sub fetchRowArray($$){ my $dbh = shift; my $sql = shift; my $sth = $dbh->prepare($sql) or die("statement can't be prepared"); $sth->execute() or die("Statement can't be executed"); my $columnNames = $sth->{NAME}; my $numfields= $sth->{NUM_OF_FIELDS}; my $matrix) = $sth->fetchall_arrayref(); return $matrix, $columnNames, $numfields; }
What is not clear in your request is this: you say that your code stops after 17 loops and later that the MySQL log shows 17 queries. Therefore, maybe the reason for hanging is not in this loop, but some other place in your script.
The candidates for further scrutiny are, then, your sub meldeFehler and the point from where your are calling fetchRowArray.
Please clarify what you mean by loop. If you mean that it hangs after 17 successful queries, then you may have a memory problem. If you mean that it hangs when the records are more than 17, then I don't see the cause here.
As a piece of practical advice, I would recommend to run this script from the command line, to see if the result is what you expected, and put some print statements in the critical points (printing, for example, "inside meldeFehler", "before calling fetchRowArray", and so on) so that you get a clear idea of where exactly the code stops.
HTH
In reply to Re: Re: mysql perl hangs on selects
by dbwiz
in thread mysql perl hangs on selects
by Murcia
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |