 drupal_page_footer();
Index: includes/database/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/schema.inc,v
retrieving revision 1.4
diff -u -9 -p -r1.4 schema.inc
--- includes/database/schema.inc	31 Oct 2008 15:46:16 -0000	1.4
+++ includes/database/schema.inc	3 Nov 2008 22:38:03 -0000
@@ -121,24 +121,60 @@ abstract class DatabaseSchema {
   protected $connection;
 
   public function __construct($connection) {
     $this->connection = $connection;
   }
 
   /**
    * Check if a table exists.
    */
-  abstract public function tableExists($table);
+  public function tableExists($table) {
+    $split = explode('.', $this->connection->prefixTables('{' . $table . '}'), 2);
+    if (sizeof($split) == 2) {
+      $args = array(
+        ':database' => $split[0],
+        ':table' => $split[1],
+      );
+    }
+    else {
+      $info = Database::getConnectionInfo();
+      $args = array(
+        ':database' => $info['default']['database'],
+        ':table' => $split[0],
+      );
+    }
+    $result = db_query('SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = :database AND table_name = :table', $args);
+    return (bool)$result->fetchField();
+  }
 
   /**
    * Check if a column exists in the given table.
    */
-  abstract public function columnExists($table, $column);
+  public function columnExists($table, $column) {
+    $split = explode('.', $this->connection->prefixTables('{' . $table . '}'), 2);
+    if (sizeof($split) == 2) {
+      $args = array(
+        ':database' => $split[0],
+        ':table' => $split[1],
+        ':column' => $column,
+      );
+    }
+    else {
+      $info = Database::getConnectionInfo();
+      $args = array(
+        ':database' => $info['default']['database'],
+        ':table' => $split[0],
+        ':column' => $column,
+      );
+    }
+    $result = db_query('SELECT COUNT(*) FROM information_schema.columns WHERE table_schema = :database AND table_name = :table AND column_name = :column', $args);
+    return (bool)$result->fetchField();
+  }
 
   /**
    * 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.
Index: includes/database/mysql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v
retrieving revision 1.4
diff -u -9 -p -r1.4 schema.inc
--- includes/database/mysql/schema.inc	8 Oct 2008 11:09:16 -0000	1.4
+++ includes/database/mysql/schema.inc	3 Nov 2008 22:38:03 -0000
@@ -8,27 +8,18 @@
 
 
 /**
  * @ingroup schemaapi
  * @{
  */
 
 class DatabaseSchema_mysql extends DatabaseSchema {
 
-  public function tableExists($table) {
-    return (bool) $this->connection->query("SHOW TABLES LIKE '{" . $table . "}'", array(), array())->fetchField();
-  }
-
-  public function columnExists($table, $column) {
-    return (bool) $this->connection->query("SHOW COLUMNS FROM {" . $this->connection->escapeTable($table) . "} LIKE '" . $this->connection->escapeTable($column) . "'", array(), array())->fetchField();
-  }
-
-
   /**
    * Generate SQL to create a new table from a Drupal schema definition.
    *
    * @param $name
    *   The name of the table to create.
    * @param $table
    *   A Schema API table definition array.
    * @return
    *   An array of SQL statements to create the table.
Index: includes/database/pgsql/schema.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/database/pgsql/schema.inc,v
retrieving revision 1.2
diff -u -9 -p -r1.2 schema.inc
--- includes/database/pgsql/schema.inc	15 Sep 2008 20:48:07 -0000	1.2
+++ includes/database/pgsql/schema.inc	3 Nov 2008 22:38:03 -0000
@@ -7,26 +7,18 @@
  */
 
 /**
  * @ingroup schemaapi
  * @{
  */
 
 class DatabaseSchema_pgsql extends DatabaseSchema {
 
-  public function tableExists($table) {
-    return (bool) db_result(db_query("SELECT COUNT(*) FROM pg_class WHERE relname = '{" . db_escape_table($table) . "}'"));
-  }
-
-  public function columnExists($table, $column) {
-    return (bool) db_result(db_query("SELECT COUNT(pg_attribute.attname) FROM pg_class, pg_attribute WHERE pg_attribute.attrelid = pg_class.oid AND pg_class.relname = '{" . db_escape_table($table) . "}' AND attname = '" . db_escape_table($column) . "'"));
-  }
-
   /**
    * Generate SQL to create a new table from a Drupal schema definition.
    *
    * @param $name
    *   The name of the table to create.
    * @param $table
    *   A Schema API table definition array.
    * @return
    *   An array of SQL statements to create the table.
