From baf629e272f04b04a1fd21a21e5419c1bacfb9cd Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 28 Dec 2009 00:23:25 +1300 Subject: [PATCH] Fix problems with logging of failed queries. --- inc/AwlQuery.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/AwlQuery.php b/inc/AwlQuery.php index c1283253..0a488d9b 100644 --- a/inc/AwlQuery.php +++ b/inc/AwlQuery.php @@ -389,10 +389,12 @@ class AwlQuery } + $success = true; $t1 = microtime(true); // get start time if ( isset($this->sth) && $this->sth !== false ) { if ( ! $this->sth->execute( $this->bound_parameters ) ) { $this->error_info = $this->sth->errorInfo(); + $success = false; } else $this->error_info = null; } @@ -405,11 +407,11 @@ class AwlQuery $this->sth = $this->connection->query( $this->querystring ); if ( ! $this->sth ) { $this->error_info = $this->connection->errorInfo(); + $success = false; } else $this->error_info = null; } - $success = !isset($this->error_info); - $this->rows = $this->sth->rowCount(); + if ( $success ) $this->rows = $this->sth->rowCount(); $t2 = microtime(true); // get end time $i_took = $t2 - $t1; $c->total_query_time += $i_took;