You are here

function schema_dbobject in Schema 7

Same name and namespace in other branches
  1. 8 schema.module \schema_dbobject()

Fetch a schema engine class instance for a given database connection.

Parameters

string $connection: A database connection key, defaults to the schema_database_connection variable, which itself defaults to 'default'.

Return value

object A schema engine class set to the given connection.

File

./schema.module, line 155
The Schema module provides functionality built on the Schema API.

Code

function schema_dbobject($connection = NULL) {
  if (!isset($connection)) {
    $connection = variable_get('schema_database_connection', 'default');
  }
  if ($class = schema_get_connection_engine_class($connection)) {
    return new $class(Database::getConnection('default', $connection));
  }
}