From 356fbb03ea8eed0c704d94ab7d4249ee78d7ec2a Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 26 Apr 2010 19:46:07 +1200 Subject: [PATCH] Fix the SetConnection() method. --- inc/AwlQuery.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/AwlQuery.php b/inc/AwlQuery.php index 4332b898..45f4abb5 100644 --- a/inc/AwlQuery.php +++ b/inc/AwlQuery.php @@ -238,15 +238,15 @@ class AwlQuery * @param resource $new_connection The database connection to use. */ function SetConnection( $new_connection, $options = null ) { - if ( is_string($new_connection) ) { + if ( is_string($new_connection) || is_array($new_connection) ) { $dbuser = null; $dbpass = null; - if ( is_array($v) ) { - $dsn = $v['dsn']; - if ( isset($v['dbuser']) ) $dbuser = $v['dbuser']; - if ( isset($v['dbpass']) ) $dbpass = $v['dbpass']; + if ( is_array($new_connection) ) { + $dsn = $new_connection['dsn']; + if ( isset($new_connection['dbuser']) ) $dbuser = $new_connection['dbuser']; + if ( isset($new_connection['dbpass']) ) $dbpass = $new_connection['dbpass']; } - elseif ( preg_match( '/^(\S+:)?(.*)( user=(\S+))?( password=(\S+))?$/', $v, $matches ) ) { + elseif ( preg_match( '/^(\S+:)?(.*)( user=(\S+))?( password=(\S+))?$/', $new_connection, $matches ) ) { $dsn = $matches[2]; if ( isset($matches[1]) && $matches[1] != '' ) { $dsn = $matches[1] . $dsn;