Index: client/review/db/pgsql.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/client/review/db/pgsql.inc,v
retrieving revision 1.8
diff -u -r1.8 pgsql.inc
--- client/review/db/pgsql.inc	17 Jul 2009 23:49:16 -0000	1.8
+++ client/review/db/pgsql.inc	22 Jul 2009 04:42:34 -0000
@@ -43,8 +43,12 @@
     if (db_set_active('pifr_checkout')) {
       $result = @db_query('SELECT *
                            FROM {simpletest}');
+      $assertions = array();
+      while ($assertion = db_fetch_array($result)) {
+        $assertions[] = $assertion;
+      }
       db_set_active();
-      return $result;
+      return $assertions;
     }
     return FALSE;
   }
Index: client/review/db/mysql.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/client/review/db/mysql.inc,v
retrieving revision 1.8
diff -u -r1.8 mysql.inc
--- client/review/db/mysql.inc	17 Jul 2009 20:46:14 -0000	1.8
+++ client/review/db/mysql.inc	22 Jul 2009 04:42:34 -0000
@@ -41,8 +41,12 @@
     if (db_set_active('pifr_checkout')) {
       $result = @db_query('SELECT *
                            FROM {simpletest}');
+      $assertions = array();
+      while ($assertion = db_fetch_array($result)) {
+        $assertions[] = $assertion;
+      }
       db_set_active();
-      return $result;
+      return $assertions;
     }
     return FALSE;
   }
Index: client/pifr_client.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/client/pifr_client.admin.inc,v
retrieving revision 1.10
diff -u -r1.10 pifr_client.admin.inc
--- client/pifr_client.admin.inc	17 Jul 2009 19:44:45 -0000	1.10
+++ client/pifr_client.admin.inc	22 Jul 2009 04:42:34 -0000
@@ -39,12 +39,7 @@
   $database = 'PIFRClientReviewDB_' . PIFR_CLIENT_DB;
   $database = new $database;
 
-  $assertions = $database->getAssertions();
-  $count = 0;
-  while ($assertion = db_fetch_array($assertions)) {
-    $count++;
-  }
-  return $count;
+  return count($database->getAssertions());
 }
 
 /**
Index: client/review/pifr_client_review.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue_file_review/client/review/pifr_client_review.inc,v
retrieving revision 1.27
diff -u -r1.27 pifr_client_review.inc
--- client/review/pifr_client_review.inc	20 Jul 2009 18:52:17 -0000	1.27
+++ client/review/pifr_client_review.inc	22 Jul 2009 04:42:34 -0000
@@ -409,7 +409,7 @@
 
     // Cycle through assertions to fill in results.
     $assertions = $this->database->getAssertions();
-    while ($assertion = db_fetch_array($assertions)) {
+    foreach ($assertions as $assertion) {
       // Add up summary totals for entire test suite.
       $result[$assertion['status']]++;
 
Index: client/review/db/sqlite.inc
===================================================================
RCS file: client/review/db/sqlite.inc
diff -N client/review/db/sqlite.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ client/review/db/sqlite.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,59 @@
+<?php
+// $Id$
+/**
+ * @file
+ * SQLite review backend.
+ *
+ * @author Karoly Negyesi ("chx", http://drupal.org/user/9446)
+ *
+ * Copyright 2008-2009 by Jimmy Berry ("boombatower", http://drupal.org/user/214218)
+ */
+
+class PIFRClientReviewDB_sqlite implements PIFRClientReviewDB {
+
+  /**
+   * The PDO connection used for SQLite.
+   *
+   * @var Resource
+   */
+  protected $connection = FALSE;
+
+  public function createDatabase() {
+    global $db_url;
+    if (!isset($db_url['pifr_checkout'])) {
+      return FALSE;
+    }
+    $path = parse_url($db_url['pifr_checkout'], PHP_URL_PATH);
+
+    // Ensure that path points to a location inside the root of the checkout
+    // directory. The database will then be destroyed when checkout directory
+    // is cleared.
+    if (preg_match('/checkout\/[^\/]+$/', $path)) {
+      $this->connection = new PDO('sqlite:' . $path);
+    }
+    return (bool) $this->connection;
+  }
+
+  public function dropDatabase() {
+    // Database file is stored in checkout directory which gets cleared.
+    return TRUE;
+  }
+
+  public function setVariable($name, $value) {
+    if ($this->connection) {
+      $status = $this->connection
+        ->prepare(db_prefix_tables('INSERT INTO {variables} variable (name, value) VALUES (:name, :value)'))
+        ->execute(array('name' => $name, 'value' => serialize($value)));
+      return $status && $this->connection->exec(db_prefix_tables('TRUNCATE TABLE {cache}')) !== FALSE;
+    }
+    return FALSE;
+  }
+
+  public function getAssertions() {
+    if ($this->connection) {
+      $db_prefix = is_array($this->db_prefix) && isset($this->db_prefix['simpletest']) ? $this->db_prefix['simpletest'] : $this->db_prefix;
+      return $this->connection->prepare(db_prefix_tables('SELECT * FROM {simpletest}')->execute()->fetchAll(PDO::FETCH_ASSOC));
+    }
+    return FALSE;
+  }
+}
