? sites/default/modules
? sites/default/settings.php
Index: includes/database/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/database.inc,v
retrieving revision 1.16
diff -u -p -r1.16 database.inc
--- includes/database/database.inc	25 Oct 2008 02:03:54 -0000	1.16
+++ includes/database/database.inc	29 Oct 2008 10:03:46 -0000
@@ -1370,10 +1370,8 @@ function db_query($query, $args = array(
  *   named and unnamed placeholders, named placeholders are strongly preferred
  *   as they are more self-documenting.
  * @param $args
- *   An array of values to substitute into the query.  If the query uses named
- *   placeholders, this is an associative array in any order.  If the query uses
- *   unnamed placeholders (?), this is an indexed array and the order must match
- *   the order of placeholders in the query string.
+ *   An array of values to substitute into the query. The query should use
+ *   named placeholders, and this is an associative array in any order.
  * @param $from
  *   The first record from the result set to return.
  * @param $limit
Index: includes/database/mysql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/database.inc,v
retrieving revision 1.4
diff -u -p -r1.4 database.inc
--- includes/database/mysql/database.inc	25 Oct 2008 02:03:55 -0000	1.4
+++ includes/database/mysql/database.inc	29 Oct 2008 10:03:46 -0000
@@ -40,9 +40,6 @@ class DatabaseConnection_mysql extends D
   }
 
   public function queryRange($query, Array $args, $from, $count, Array $options) {
-    // Backward compatibility hack, temporary.
-    $query = str_replace(array('%d' , '%f' , '%b' , "'%s'"), '?', $query);
-
     return $this->query($query . ' LIMIT ' . $from . ', ' . $count, $args, $options);
   }
 
Index: includes/database/pgsql/database.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/database.inc,v
retrieving revision 1.4
diff -u -p -r1.4 database.inc
--- includes/database/pgsql/database.inc	25 Oct 2008 02:12:35 -0000	1.4
+++ includes/database/pgsql/database.inc	29 Oct 2008 10:03:46 -0000
@@ -76,9 +76,6 @@ class DatabaseConnection_pgsql extends D
   }
 
   public function queryRange($query, Array $args, $from, $count, Array $options) {
-    // Backward compatibility hack, temporary.
-    $query = str_replace(array('%d' , '%f' , '%b' , "'%s'"), '?', $query);
-
     return $this->query($query . ' LIMIT ' . $count . ' OFFSET ' . $from, $args, $options);
   }
 
Index: modules/simpletest/tests/database_test.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v
retrieving revision 1.13
diff -u -p -r1.13 database_test.test
--- modules/simpletest/tests/database_test.test	25 Oct 2008 04:26:30 -0000	1.13
+++ modules/simpletest/tests/database_test.test	29 Oct 2008 10:03:46 -0000
@@ -1884,3 +1884,28 @@ class DatabaseLoggingTestCase extends Da
     }
   }
 }
+
+/**
+ * Range query tests.
+ */
+class DatabaseRangeQueryTestCase extends DatabaseTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Range query test'),
+      'description' => t('Test the Range query builder.'),
+      'group' => t('Database'),
+    );
+  }
+
+  /**
+   * Confirm that range query work and return limited result.
+   */
+  function testRangeQuery() {
+    // Query should return 3 successful results, but we just fetch 2 of it.
+    $count = 2;
+    $results = db_query_range("SELECT * FROM {test} WHERE age >= :age", array(':age' => 26), 1, $count);
+    $rows = count($results->fetchAll());
+    $this->assertEqual($rows, $count, t('Range query work and return limited result.'));
+  }
+}
