#302395 by chx: Minor DBTNG clean-up.

merge-requests/26/head
Angie Byron 2008-09-03 12:04:49 +00:00
parent c17a5e70bc
commit df7bcec717
2 changed files with 11 additions and 11 deletions

View File

@ -250,7 +250,7 @@ abstract class DatabaseConnection extends PDO {
/** /**
* Prepare a query string and return the prepared statement. * Prepare a query string and return the prepared statement.
* *
* This method statically caches prepared statements, reusing them when * This method statically caches prepared statements, reusing them when
* possible. It also prefixes tables names enclosed in curly-braces. * possible. It also prefixes tables names enclosed in curly-braces.
* *
@ -712,7 +712,7 @@ abstract class Database {
* TRUE if there is at least one database connection established, FALSE otherwise. * TRUE if there is at least one database connection established, FALSE otherwise.
*/ */
final public static function isActiveConnection() { 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() * query: the SQL query executed, passed through check_plain()
*/ */
function update_sql($sql) { 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)); return array('success' => $result !== FALSE, 'query' => check_plain($sql));
} }

View File

@ -117,29 +117,29 @@
*/ */
abstract class DatabaseSchema { abstract class DatabaseSchema {
protected $connection; protected $connection;
public function __construct($connection) { public function __construct($connection) {
$this->connection = $connection; $this->connection = $connection;
} }
/** /**
* Check if a table exists. * Check if a table exists.
*/ */
abstract public function tableExists($table); abstract public function tableExists($table);
/** /**
* Check if a column exists in the given table. * Check if a column exists in the given table.
*/ */
abstract public function columnExists($table, $column); abstract public function columnExists($table, $column);
/** /**
* This maps a generic data type in combination with its data size * This maps a generic data type in combination with its data size
* to the engine-specific data type. * to the engine-specific data type.
*/ */
abstract public function getFieldTypeMap(); abstract public function getFieldTypeMap();
/** /**
* Rename a table. * Rename a table.
* *
@ -161,7 +161,7 @@ abstract class DatabaseSchema {
* The table to be dropped. * The table to be dropped.
*/ */
abstract public function dropTable(&$ret, $table); abstract public function dropTable(&$ret, $table);
/** /**
* Add a new field to a table. * Add a new field to a table.
* *
@ -380,7 +380,7 @@ abstract class DatabaseSchema {
$ret[] = update_sql($statement); $ret[] = update_sql($statement);
} }
} }
/** /**
* Return an array of field names from an array of key/index column specifiers. * Return an array of field names from an array of key/index column specifiers.
* *