diff -U5 -r ./client/pifr_client.review.inc /home/neil/projects/drupaltestbot/pg_misc/project_issue_file_review/client/pifr_client.review.inc
--- ./client/pifr_client.review.inc	2009-12-18 11:49:00.000000000 +1300
+++ /home/neil/projects/drupaltestbot/pg_misc/project_issue_file_review/client/pifr_client.review.inc	2010-09-14 14:02:11.000000000 +1200
@@ -153,18 +153,19 @@
  * @param string $type Test type, 'default', 'quick', 'fail', 'd6'.
  * @return array Pre-built test information array.
  */
 function pifr_client_review_pre_built_test($type) {
   if ($type == 'default' || $type == 'quick' || $type == 'fail') {
+    $db_type = pifr_client_review_database_type();
     // Provide Drupal HEAD repository and blank patch.
     $test = array(
       'test_id' => '17',
       'review' => array(
         'plugin' => 'pifr_simpletest',
         'argument' => array(
           'core' => 7,
-          'database' => 'mysql-5.0-isam',
+          'database' => $db_type,
           'tests' => array(),
           'modules' => array(),
         ),
       ),
       'vcs' => array(
diff -U5 -r ./client/review/db/pgsql.inc /home/neil/projects/drupaltestbot/pg_misc/project_issue_file_review/client/review/db/pgsql.inc
--- ./client/review/db/pgsql.inc	2009-12-29 14:23:34.000000000 +1300
+++ /home/neil/projects/drupaltestbot/pg_misc/project_issue_file_review/client/review/db/pgsql.inc	2010-09-14 14:02:11.000000000 +1200
@@ -11,11 +11,31 @@
 /**
  * PostgreSQL implementation of review interface.
  */
 class pifr_client_db_interface_pgsql implements pifr_client_db_interface {
 
-  function get_information() {
+  // Connection to the checked out database.
+  protected $pdo;
+
+  // Connection to the postgreSQL database.
+  // Sudo connection for creating/droping databases.
+  protected $sudo_pdo;
+
+  public function __construct() {
+    $info = $this->get_information();
+    $this->sudo_conn = new PDO('pgsql:dbname=postgres;host=' . $info['host'], $info['username'], $info['password']);
+  }
+
+  protected function pg_conn() {
+    $info = $this->get_information();
+    if (!$this->pdo) {
+      $this->pdo = new PDO('pgsql:dbname=' . $info['name'] . ';host=' . $info['host'], $info['username'], $info['password']);
+    }
+    return $this->pdo;
+  }
+
+  public function get_information() {
     global $db_url;
 
     $url = parse_url($db_url['pifr_checkout']);
     $db = array();
     $db['name'] = substr(urldecode($url['path']), 1);
@@ -26,41 +46,41 @@
   }
 
   public function create_database() {
     global $db_url;
     $database = substr(parse_url($db_url['pifr_checkout'], PHP_URL_PATH), 1);
-    return (bool) db_query('CREATE DATABASE "%s"', $database);
+    return $this->sudo_conn->query('CREATE DATABASE "' . $database . '" WITH ENCODING \'UNICODE\'');
   }
 
   public function drop_database() {
     global $db_url;
     $database = substr(parse_url($db_url['pifr_checkout'], PHP_URL_PATH), 1);
-    return (bool) db_query('DROP DATABASE "%s"', $database);
+    return $this->sudo_conn->query('DROP DATABASE "' . $database . '"');
   }
 
   public function set_variable($name, $value) {
-    if (db_set_active('pifr_checkout')) {
-      $status = db_query("REPLACE INTO {variable} (name, value)
-                VALUES ('%s', '%s')", $name, serialize($value));
-      $status = $status && db_query('TRUNCATE TABLE cache');
-      db_set_active();
-      return $status;
-    }
-    return FALSE;
+    $this->query("DELETE FROM {variable} WHERE name = ?", array($name));
+    $status = $this->query("INSERT INTO {variable} (name, value) VALUES (?, ?)", array($name, serialize($value)));
+    $this->query('TRUNCATE TABLE {cache}');
+    return $status;
   }
 
-  public function query($sql) {
-    if (db_set_active('pifr_checkout')) {
-      $result = @db_query($sql);
-      $rows = array();
-      while ($row = db_fetch_array($result)) {
-        $rows[] = $row;
+  public function query($sql, $args = array()) {
+    try {
+      if (empty($args)) {
+        $rs = $this->pg_conn()->query(db_prefix_tables($sql));
+      }
+      else {
+        $rs = $this->pg_conn()
+          ->prepare(db_prefix_tables($sql))
+          ->execute($args);
       }
-      db_set_active();
-      return $rows;
+      return is_object($rs) ? $rs->fetchAll() : $rs;
+    }
+    catch (Exception $e) {
+      return FALSE;
     }
-    return FALSE;
   }
 
   public function import($file) {
     if ($this->query(file_get_contents($file))) {
       $information = $this->get_information();
@@ -69,5 +89,6 @@
       return count($tables);
     }
     return FALSE;
   }
 }
+
