diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-05-25 13:42:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-05-25 13:42:56 +0000 |
commit | a98905f5c6696ef166ec797fc6ee80fe8f94f48f (patch) | |
tree | 8190afe432c33bf5756340bc432e84cdb5af4a1a /includes | |
parent | 76957a25e6eb2ce82fc3f52f6f4f97be4748f6e6 (diff) | |
download | brdo-a98905f5c6696ef166ec797fc6ee80fe8f94f48f.tar.gz brdo-a98905f5c6696ef166ec797fc6ee80fe8f94f48f.tar.bz2 |
- Patch #471800 by stella: more code style fixes.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/database/mysql/schema.inc | 2 | ||||
-rw-r--r-- | includes/database/pgsql/schema.inc | 2 | ||||
-rw-r--r-- | includes/database/schema.inc | 3 | ||||
-rw-r--r-- | includes/database/sqlite/schema.inc | 2 |
4 files changed, 9 insertions, 0 deletions
diff --git a/includes/database/mysql/schema.inc b/includes/database/mysql/schema.inc index ff380ba9d..45543d253 100644 --- a/includes/database/mysql/schema.inc +++ b/includes/database/mysql/schema.inc @@ -372,9 +372,11 @@ class DatabaseSchema_mysql extends DatabaseSchema { if (isset($column)) { $condition->condition('column_name', $column); $condition->compile($this->connection); + // Don't use {} around information_schema table. return db_query("SELECT column_comment FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchField(); } $condition->compile($this->connection); + // Don't use {} around information_schema table. $comment = db_query("SELECT table_comment FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField(); // Work-around for MySQL 5.0 bug http://bugs.mysql.com/bug.php?id=11379 return preg_replace('/; InnoDB free:.*$/', '', $comment); diff --git a/includes/database/pgsql/schema.inc b/includes/database/pgsql/schema.inc index 08b04b938..5135b90df 100644 --- a/includes/database/pgsql/schema.inc +++ b/includes/database/pgsql/schema.inc @@ -51,6 +51,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { 'blob_fields' => array(), 'sequences' => array(), ); + // Don't use {} around information_schema table. $result = db_query("SELECT column_name, data_type, column_default FROM information_schema.columns WHERE table_schema = :schema AND table_name = :table AND (data_type = 'bytea' OR (numeric_precision IS NOT NULL AND column_default LIKE :default))", array(':schema' => $schema, ':table' => $table_name, ':default' => '%nextval%')); foreach ($result as $column) { if ($column->data_type == 'bytea') { @@ -603,6 +604,7 @@ class DatabaseSchema_pgsql extends DatabaseSchema { */ public function getComment($table, $column = NULL) { $table = $this->connection->prefixTables('{' . $table . '}'); + // Don't use {} around pg_class, pg_attribute tables. if (isset($column)) { return db_query('SELECT col_description(oid, attnum) FROM pg_class, pg_attribute WHERE attrelid = oid AND relname = ? AND attname = ?', array($table, $column))->fetchField(); } diff --git a/includes/database/schema.inc b/includes/database/schema.inc index d6302e0c6..569a6b300 100644 --- a/includes/database/schema.inc +++ b/includes/database/schema.inc @@ -187,6 +187,7 @@ abstract class DatabaseSchema { // concatination for conditionals like this however, we // couldn't use db_select() here because it would prefix // information_schema.tables and the query would fail. + // Don't use {} around information_schema table. return db_query("SELECT table_name FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchField(); } @@ -206,6 +207,7 @@ abstract class DatabaseSchema { // concatination for conditionals like this however, we // couldn't use db_select() here because it would prefix // information_schema.tables and the query would fail. + // Don't use {} around information_schema table. return db_query("SELECT table_name FROM information_schema.tables WHERE " . (string) $condition, $condition->arguments())->fetchAllKeyed(0, 0); } @@ -220,6 +222,7 @@ abstract class DatabaseSchema { // concatination for conditionals like this however, we // couldn't use db_select() here because it would prefix // information_schema.tables and the query would fail. + // Don't use {} around information_schema table. return db_query("SELECT column_name FROM information_schema.columns WHERE " . (string) $condition, $condition->arguments())->fetchAllKeyed(0, 0); } diff --git a/includes/database/sqlite/schema.inc b/includes/database/sqlite/schema.inc index 137592bbf..834a93037 100644 --- a/includes/database/sqlite/schema.inc +++ b/includes/database/sqlite/schema.inc @@ -15,6 +15,7 @@ class DatabaseSchema_sqlite extends DatabaseSchema { public function tableExists($table) { + // Don't use {} around sqlite_master table. return (bool) $this->connection->query("SELECT name FROM sqlite_master WHERE type = 'table' AND name LIKE '{" . $table . "}'", array(), array())->fetchField(); } @@ -564,6 +565,7 @@ class DatabaseSchema_sqlite extends DatabaseSchema { * Array, both the keys and the values are the matching tables. */ public function findTables($table_expression) { + // Don't use {} around sqlite_master table. $result = db_query("SELECT name FROM sqlite_master WHERE name LIKE :table_name", array( ':table_name' => $table_expression, )); |