From a78bc3b21eac3f68e4579c3d7295777ad1bad9d9 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Fri, 28 May 2010 23:32:08 +1200 Subject: [PATCH] [AwlQuery] Fixing backward compatibility with PgQuery. --- inc/AwlQuery.php | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/inc/AwlQuery.php b/inc/AwlQuery.php index 70441e7..91e6327 100644 --- a/inc/AwlQuery.php +++ b/inc/AwlQuery.php @@ -227,6 +227,7 @@ class AwlQuery $this->bound_parameters = $args[0]; else $this->bound_parameters = $args; +// print_r( $this->bound_parameters ); } return $this; @@ -371,18 +372,26 @@ class AwlQuery $this->connection = $GLOBALS['_awl_dbconn']; } - $this->bound_querystring = $this->querystring; - if ( isset($c->expand_pdo_parameters) && $c->expand_pdo_parameters - && isset($this->bound_parameters) ) { - $this->bound_querystring = $this->connection->ReplaceParameters($this->querystring,$this->bound_parameters); + if ( isset($c->expand_pdo_parameters) && $c->expand_pdo_parameters ) { + $this->bound_querystring = $this->querystring; + if ( isset($this->bound_parameters) ) { + $this->bound_querystring = $this->connection->ReplaceParameters($this->querystring,$this->bound_parameters); +// printf( "\n=============================================================== OQ\n%s\n", $this->querystring); +// printf( "\n=============================================================== QQ\n%s\n", $this->bound_querystring); +// print_r( $this->bound_parameters ); + } + $t1 = microtime(true); // get start time + $this->sth = $this->connection->query($this->bound_querystring); + } + else { + $t1 = microtime(true); // get start time + $this->sth = $this->connection->prepare($this->querystring); + if ( $this->sth ) $this->sth->execute($this->bound_parameters); // printf( "\n=============================================================== OQ\n%s\n", $this->querystring); -// printf( "\n=============================================================== QQ\n%s\n", $this->bound_querystring); // print_r( $this->bound_parameters ); } - - $t1 = microtime(true); // get start time - $this->sth = $this->connection->query($this->bound_querystring); $this->bound_querystring = null; + if ( ! $this->sth ) { $this->error_info = $this->connection->errorInfo(); return false; -- 2.11.4.GIT