=== modified file 'includes/database/database.inc'
--- includes/database/database.inc	2009-08-22 19:10:33 +0000
+++ includes/database/database.inc	2009-08-24 05:39:56 +0000
@@ -316,13 +316,6 @@ abstract class DatabaseConnection extend
    */
   protected $schema = NULL;
 
-  /**
-   * A unique number used for dynamic placeholders.
-   *
-   * It gets reset after every executed query.
-   */
-  protected $nextPlaceholder = 1;
-
   function __construct($dsn, $username, $password, $driver_options = array()) {
     // Because the other methods don't seem to work right.
     $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
@@ -337,20 +330,6 @@ abstract class DatabaseConnection extend
   }
 
   /**
-   * Reset the next placeholder number back to 1.
-   */
-  public function resetPlaceholder() {
-    $this->nextPlaceholder = 1;
-  }
-
-  /**
-   * Get the current unique placeholder number and increment it.
-   */
-  public function getNextPlaceholder() {
-    return $this->nextPlaceholder++;
-  }
-
-  /**
    * Return the default query options for any given query.
    *
    * A given query can be customized with a number of option flags in an
@@ -588,9 +567,6 @@ abstract class DatabaseConnection extend
         $stmt->execute($args, $options);
       }
 
-      // Reset the placeholder numbering.
-      $this->resetPlaceholder();
-
       // Depending on the type of query we may need to return a different value.
       // See DatabaseConnection::defaultOptions() for a description of each value.
       switch ($options['return']) {

=== modified file 'includes/database/pgsql/database.inc'
--- includes/database/pgsql/database.inc	2009-08-22 19:10:33 +0000
+++ includes/database/pgsql/database.inc	2009-08-24 05:39:57 +0000
@@ -68,8 +68,6 @@ class DatabaseConnection_pgsql extends D
         $stmt = $this->prepareQuery($query, !$modified);
         $stmt->execute($args, $options);
       }
-      // Reset the placeholder numbering.
-      $this->resetPlaceholder();
 
       switch ($options['return']) {
         case Database::RETURN_STATEMENT:

=== modified file 'includes/database/query.inc'
--- includes/database/query.inc	2009-08-22 19:10:33 +0000
+++ includes/database/query.inc	2009-08-24 05:39:59 +0000
@@ -1161,6 +1161,13 @@ class DatabaseCondition implements Query
   }
 
   public function compile(DatabaseConnection $connection) {
+    // This value is static, so it will increment across the entire request
+    // rather than just this query. That is OK, because we only need definitive
+    // placeholder names if we're going to use them for _alter hooks, which we
+    // are not. The alter hook would intervene before compilation.
+    // $next_placeholder does not use drupal_static as it increments and should
+    // never be reset during a request.
+    static $next_placeholder = 1;
 
     if ($this->changed) {
 
@@ -1213,7 +1220,7 @@ class DatabaseCondition implements Query
             }
             if ($operator['use_value']) {
               foreach ($condition['value'] as $value) {
-                $placeholder = ':db_condition_placeholder_' . $connection->getNextPlaceholder();
+                $placeholder = ':db_condition_placeholder_' . $next_placeholder++;
                 $arguments[$placeholder] = $value;
                 $placeholders[] = $placeholder;
               }

