On Thu, Jan 15, 2004 at 09:59:38AM -0500, Chris Braiotta wrote:

> $prep = $conn->prepare($get_uptime_sql)
>       or die "Can't prepare: $conn->errstr\n";
> $exec = $prep->execute
>       or die "Can't execute: $conn->errstr\n";
> 
> LOOP: while (my @sql = $prep->fetchrow_array) {
>       my ($host, $state, $date) = @sql;
>       blah blah blah
> }
> 
> ---------
> 
> When I run the script, the MySQL lookup does return some results, but 
> it also throws an error: "DBD::mysql::st fetchrow_array failed: fetch() 
> without execute() at ./load_executive_snapshot.pl line [line number]". 
> Since there is quite obviously an execute statement there, this would 
> seem to indicate a problem with my SQL statement. However, I'm fairly 
> confident that this isn't the case, because of the following:
> 
> 1) I've had the script print out the SQL it's generating for 
> $get_uptime_sql, and I've run that query at a MySQL prompt. It 
> functions properly, returning 305,403 rows in just over a minute.
> 
> 2) Simply adding a "LIMIT 500" to the end of the SQL query, or using a 
> more restrictive set of dates than the script is meant to use, 
> eliminates the error.
> 
> It seems to me, then, that DBD::mysql (or, at least, my particular 
> DBD:mysql environment) isn't handling such a large result gracefully. I 
> can think of workarounds for this, but I shouldn't have to, since I can 
> get this to run just fine using, for example, a backticked reference to 
> MySQL. Does anyone have any comments, or similar experiences?

Alternatively, something in the "blah blah blah" section of the code may be
affecting your statement handle.  Does your code run through all the
results if the loop doesn't do anything besides the fetch?

Ronald
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to