From df7bcec717ad586b35b42dc850775e097ce384cc Mon Sep 17 00:00:00 2001
From: Angie Byron <webchick@24967.no-reply.drupal.org>
Date: Wed, 3 Sep 2008 12:04:49 +0000
Subject: [PATCH] #302395 by chx: Minor DBTNG clean-up.

---
 includes/database/database.inc |  6 +++---
 includes/database/schema.inc   | 16 ++++++++--------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/includes/database/database.inc b/includes/database/database.inc
index ea95fc3311ba..2dafd3d2e607 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -250,7 +250,7 @@ protected function prefixTables($sql) {
 
   /**
    * Prepare a query string and return the prepared statement.
-   * 
+   *
    * This method statically caches prepared statements, reusing them when
    * possible.  It also prefixes tables names enclosed in curly-braces.
    *
@@ -712,7 +712,7 @@ final public static function getConnection($key = 'default', $target = 'default'
    *   TRUE if there is at least one database connection established, FALSE otherwise.
    */
   final public static function isActiveConnection() {
-    return !empty(self::$connections);
+    return !empty(self::$activeKey) && !empty(self::$connections) && !empty(self::$connections[self::$activeKey]);
   }
 
   /**
@@ -1356,7 +1356,7 @@ function db_escape_table($table) {
  *     query: the SQL query executed, passed through check_plain()
  */
 function update_sql($sql) {
-  $result = Database::getActiveConnection()->query($sql/*, array(true)*/);
+  $result = Database::getActiveConnection()->query($sql);
   return array('success' => $result !== FALSE, 'query' => check_plain($sql));
 }
 
diff --git a/includes/database/schema.inc b/includes/database/schema.inc
index 4d04a15d6a59..03114d2cd9c9 100644
--- a/includes/database/schema.inc
+++ b/includes/database/schema.inc
@@ -117,29 +117,29 @@
  */
 
 abstract class DatabaseSchema {
-  
+
   protected $connection;
-  
+
   public function __construct($connection) {
     $this->connection = $connection;
   }
-  
+
   /**
    * Check if a table exists.
    */
   abstract public function tableExists($table);
-  
+
   /**
    * Check if a column exists in the given table.
    */
   abstract public function columnExists($table, $column);
-  
+
   /**
    * This maps a generic data type in combination with its data size
    * to the engine-specific data type.
    */
   abstract public function getFieldTypeMap();
-  
+
   /**
    * Rename a table.
    *
@@ -161,7 +161,7 @@ abstract public function renameTable(&$ret, $table, $new_name);
    *   The table to be dropped.
    */
   abstract public function dropTable(&$ret, $table);
-  
+
   /**
    * Add a new field to a table.
    *
@@ -380,7 +380,7 @@ public function createTable(&$ret, $name, $table) {
       $ret[] = update_sql($statement);
     }
   }
-  
+
   /**
    * Return an array of field names from an array of key/index column specifiers.
    *
-- 
GitLab