From 4f69708107ede3b013f9822ce83eec3c19cdf175 Mon Sep 17 00:00:00 2001
From: xjm <xjm@65776.no-reply.drupal.org>
Date: Mon, 27 Apr 2015 03:01:36 -0500
Subject: [PATCH] Issue #2475177 by amateescu: SQLite: Fix
 system\Tests\Database\FetchTest

---
 core/lib/Drupal/Core/Database/StatementPrefetch.php | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/core/lib/Drupal/Core/Database/StatementPrefetch.php b/core/lib/Drupal/Core/Database/StatementPrefetch.php
index 58b48c69c380..e3d9dedacbc8 100644
--- a/core/lib/Drupal/Core/Database/StatementPrefetch.php
+++ b/core/lib/Drupal/Core/Database/StatementPrefetch.php
@@ -356,10 +356,17 @@ public function valid() {
     return isset($this->currentRow);
   }
 
-  /* Implementations of StatementInterface. */
-
+  /**
+   * {@inheritdoc}
+   */
   public function rowCount() {
-    return $this->rowCount;
+    // SELECT query should not use the method.
+    if ($this->allowRowCount) {
+      return $this->rowCount;
+    }
+    else {
+      throw new RowCountException();
+    }
   }
 
   public function fetch($fetch_style = NULL, $cursor_orientation = \PDO::FETCH_ORI_NEXT, $cursor_offset = NULL) {
-- 
GitLab