Drupal 8  8.0.2
Schema Class Reference
Inheritance diagram for Schema:

Public Member Functions

 tableExists ($table)
 
 fieldExists ($table, $column)
 
 createTableSql ($name, $table)
 
 getFieldTypeMap ()
 
 renameTable ($table, $new_name)
 
 dropTable ($table)
 
 addField ($table, $field, $specification, $keys_new=array())
 
 dropField ($table, $field)
 
 changeField ($table, $field, $field_new, $spec, $keys_new=array())
 
 addIndex ($table, $name, $fields, array $spec)
 
 indexExists ($table, $name)
 
 dropIndex ($table, $name)
 
 addUniqueKey ($table, $name, $fields)
 
 dropUniqueKey ($table, $name)
 
 addPrimaryKey ($table, $fields)
 
 dropPrimaryKey ($table)
 
 fieldSetDefault ($table, $field, $default)
 
 fieldSetNoDefault ($table, $field)
 
 findTables ($table_expression)
 
- Public Member Functions inherited from Schema
 __construct ($connection)
 
 __clone ()
 
 uniqueIdentifier ()
 
 nextPlaceholder ()
 
 prefixNonTable ($table)
 
 tableExists ($table)
 
 findTables ($table_expression)
 
 fieldExists ($table, $column)
 
 getFieldTypeMap ()
 
 renameTable ($table, $new_name)
 
 dropTable ($table)
 
 addField ($table, $field, $spec, $keys_new=array())
 
 dropField ($table, $field)
 
 fieldSetDefault ($table, $field, $default)
 
 fieldSetNoDefault ($table, $field)
 
 indexExists ($table, $name)
 
 addPrimaryKey ($table, $fields)
 
 dropPrimaryKey ($table)
 
 addUniqueKey ($table, $name, $fields)
 
 dropUniqueKey ($table, $name)
 
 addIndex ($table, $name, $fields, array $spec)
 
 dropIndex ($table, $name)
 
 changeField ($table, $field, $field_new, $spec, $keys_new=array())
 
 createTable ($name, $table)
 
 fieldNames ($fields)
 
 prepareComment ($comment, $length=NULL)
 

Protected Member Functions

 createIndexSql ($tablename, $schema)
 
 createColumnsSql ($tablename, $schema)
 
 createKeySql ($fields)
 
 processField ($field)
 
 createFieldSql ($name, $spec)
 
 alterTable ($table, $old_schema, $new_schema, array $mapping=array())
 
 introspectSchema ($table)
 
 mapKeyDefinition (array $key_definition, array $mapping)
 
- Protected Member Functions inherited from Schema
 getPrefixInfo ($table= 'default', $add_prefix=TRUE)
 
 buildTableNameCondition ($table_name, $operator= '=', $add_prefix=TRUE)
 
 escapeDefaultValue ($value)
 

Protected Attributes

 $defaultSchema = 'main'
 
- Protected Attributes inherited from Schema
 $connection
 
 $placeholder = 0
 
 $defaultSchema = 'public'
 
 $uniqueIdentifier
 

Detailed Description

SQLite implementation of .

Member Function Documentation

addIndex (   $table,
  $name,
  $fields,
array  $spec 
)

{}

References Schema\createIndexSql(), and t().

Here is the call graph for this function:

alterTable (   $table,
  $old_schema,
  $new_schema,
array  $mapping = array() 
)
protected

Create a table with a new schema containing the old content.

As SQLite does not support ALTER TABLE (with a few exceptions) it is necessary to create a new table and copy over the old content.

Parameters
$tableName of the table to be altered.
$old_schemaThe old schema array for the table.
$new_schemaThe new schema array for the table.
$mappingAn optional mapping between the fields of the old specification and the fields of the new specification. An associative array, whose keys are the fields of the new table, and values can take two possible forms:
  • a simple string, which is interpreted as the name of a field of the old table,
  • an associative array with two keys 'expression' and 'arguments', that will be used as an expression field.

References Schema\createTable().

Here is the call graph for this function:

createColumnsSql (   $tablename,
  $schema 
)
protected

Build the SQL expression for creating columns.

References Schema\createFieldSql(), Schema\createKeySql(), and Schema\processField().

Referenced by Schema\createTableSql().

Here is the call graph for this function:

Here is the caller graph for this function:

createFieldSql (   $name,
  $spec 
)
protected

Create an SQL string for a field to be used in table creation or alteration.

Before passing a field out of a schema definition into this function it has to be processed by db_processField().

Parameters
$nameName of the field.
$specThe field specification, as per the schema data structure format.

Referenced by Schema\createColumnsSql().

Here is the caller graph for this function:

createIndexSql (   $tablename,
  $schema 
)
protected

Build the SQL expression for indexes.

References Schema\createKeySql(), and Schema\getPrefixInfo().

Referenced by Schema\addIndex(), and Schema\createTableSql().

Here is the call graph for this function:

Here is the caller graph for this function:

createKeySql (   $fields)
protected

Build the SQL expression for keys.

Referenced by Schema\createColumnsSql(), and Schema\createIndexSql().

Here is the caller graph for this function:

createTableSql (   $name,
  $table 
)

Generate SQL to create a new table from a Drupal schema definition.

Parameters
$nameThe name of the table to create.
$tableA Schema API table definition array.
Returns
An array of SQL statements to create the table.

References Schema\createColumnsSql(), and Schema\createIndexSql().

Here is the call graph for this function:

findTables (   $table_expression)

{}

References db_query().

Here is the call graph for this function:

getFieldTypeMap ( )

This maps a generic data type in combination with its data size to the engine-specific data type.

Referenced by Schema\introspectSchema(), and Schema\processField().

Here is the caller graph for this function:

introspectSchema (   $table)
protected

Find out the schema of a table.

This function uses introspection methods provided by the database to create a schema array. This is useful, for example, during update when the old schema is not available.

Parameters
$tableName of the table.
Returns
An array representing the schema, from drupal_get_schema().

References Schema\getFieldTypeMap(), and Schema\getPrefixInfo().

Here is the call graph for this function:

mapKeyDefinition ( array  $key_definition,
array  $mapping 
)
protected

Utility method: rename columns in an index definition according to a new mapping.

Parameters
$key_definitionThe key definition.
$mappingThe new mapping.
processField (   $field)
protected

Set database-engine specific properties for a field.

Parameters
$fieldA field description array, as specified in the schema documentation.

References Schema\getFieldTypeMap(), and Unicode\strtoupper().

Referenced by Schema\createColumnsSql().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

$defaultSchema = 'main'
protected

Override DatabaseSchema::$defaultSchema


The documentation for this class was generated from the following file: