void alterTable(
string
$name,
$changes, boolean
$check
)
|
|
alter an existing table (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the table that is intended to be changed. |
array |
$changes: |
associative array that contains the details of each type of change that is intended to be performed. The types of changes that are currently supported are defined as follows: name New name for the table. add Associative array with the names of fields to be added as indexes of the array. The value of each entry of the array should be set to another associative array with the properties of the fields to be added. The properties of the fields should be the same as defined by the MDB2 parser. remove Associative array with the names of fields to be removed as indexes of the array. Currently the values assigned to each entry are ignored. An empty array should be used for future compatibility. rename Associative array with the names of fields to be renamed as indexes of the array. The value of each entry of the array should be set to another associative array with the entry named name with the new field name and the entry named Declaration that is expected to contain the portion of the field declaration already in DBMS specific SQL code as it is used in the CREATE TABLE statement. change Associative array with the names of the fields to be changed as indexes of the array. Keep in mind that if it is intended to change either the name of a field and any other properties, the change array entries should have the new names of the fields as array indexes. The value of each entry of the array should be set to another associative array with the properties of the fields to that are meant to be changed as array entries. These entries should be assigned to the new values of the respective properties. The properties of the fields should be the same as defined by the MDB2 parser. Example array( 'name' => 'userlist', 'add' => array( 'quota' => array( 'type' => 'integer', 'unsigned' => 1 ) ), 'remove' => array( 'file_limit' => array(), 'time_limit' => array() ), 'change' => array( 'name' => array( 'length' => '20', 'definition' => array( 'type' => 'text', 'length' => 20, ), ) ), 'rename' => array( 'sex' => array( 'name' => 'gender', 'definition' => array( 'type' => 'text', 'length' => 1, 'default' => 'M', ), ) ) ) |
boolean |
$check: |
indicates whether the function should just check if the DBMS driver can perform the requested table alterations if the value is true or actually perform them otherwise. |
API Tags:
Redefined in descendants as:
string alterTableSql(
string
$name,
$changes, boolean
$check
)
|
|
generates the sql for altering an existing table (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the table that is intended to be changed. |
array |
$changes: |
associative array that contains the details of each type * |
boolean |
$check: |
indicates whether the function should just check if the DBMS driver can perform the requested table alterations if the value is true or actually perform them otherwise. |
API Tags:
Redefined in descendants as:
void createConstraint(
string
$table, string
$name, array
$definition
)
|
|
create a constraint on a table
Parameters:
string |
$table: |
name of the table on which the constraint is to be created |
string |
$name: |
name of the constraint to be created |
array |
$definition: |
associative array that defines properties of the constraint to be created. Currently, only one property named FIELDS is supported. This property is also an associative with the names of the constraint fields as array constraints. Each entry of this array is set to another type of associative array that specifies properties of the constraint that are specific to each field. Example array( 'fields' => array( 'user_name' => array(), 'last_login' => array() ) ) |
API Tags:
Redefined in descendants as:
void createConstraintSql(
string
$table, string
$name, array
$definition
)
|
|
create a constraint on a table
Parameters:
string |
$table: |
name of the table on which the constraint is to be created |
string |
$name: |
name of the constraint to be created |
array |
$definition: |
associative array that defines properties of the constraint to be created. Currently, only one property named FIELDS is supported. This property is also an associative with the names of the constraint fields as array constraints. Each entry of this array is set to another type of associative array that specifies properties of the constraint that are specific to each field. Example array( 'fields' => array( 'user_name' => array(), 'last_login' => array() ) ) |
API Tags:
void createDatabase(
$database, string
$name
)
|
|
create a new database (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the database that should be created |
|
$database: |
|
API Tags:
Redefined in descendants as:
string createDatabaseSql(
$database, string
$name
)
|
|
create a new database (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the database that should be created |
|
$database: |
|
API Tags:
Redefined in descendants as:
string createForeignKeySql(
string
$table,
$definition
)
|
|
createForeignKeySql
Parameters:
string |
$table: |
name of the table on which the foreign key is to be created |
array |
$definition: |
associative array that defines properties of the foreign key to be created. |
API Tags:
Redefined in descendants as:
void createIndex(
string
$table, string
$name,
$definition
)
|
|
Get the stucture of a field into an array
Parameters:
string |
$table: |
name of the table on which the index is to be created |
string |
$name: |
name of the index to be created |
array |
$definition: |
associative array that defines properties of the index to be created. Currently, only one property named FIELDS is supported. This property is also an associative with the names of the index fields as array indexes. Each entry of this array is set to another type of associative array that specifies properties of the index that are specific to each field. Currently, only the sorting property is supported. It should be used to define the sorting direction of the index. It may be set to either ascending or descending. Not all DBMS support index sorting direction configuration. The DBMS drivers of those that do not support it ignore this property. Use the function supports() to determine whether the DBMS driver can manage indexes. Example array( 'fields' => array( 'user_name' => array( 'sorting' => 'ascending' ), 'last_login' => array() ) ) |
API Tags:
string createIndexSql(
string
$table, string
$name,
$definition
)
|
|
Get the stucture of a field into an array
Parameters:
string |
$table: |
name of the table on which the index is to be created |
string |
$name: |
name of the index to be created |
array |
$definition: |
associative array that defines properties of the index to be created. |
API Tags:
Redefined in descendants as:
void createSequence(
string
$seqName, [string
$start = 1], [
$options = array()]
)
|
|
create sequence
Parameters:
string |
$seqName: |
name of the sequence to be created |
string |
$start: |
start value of the sequence; default is 1 |
array |
$options: |
An associative array of table options: array( 'comment' => 'Foo', 'charset' => 'utf8', 'collate' => 'utf8_unicode_ci', ); |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if something fails at database level |
Redefined in descendants as:
string createSequenceSql(
string
$seqName, [string
$start = 1], [
$options = array()]
)
|
|
return RDBMS specific create sequence statement (this method is implemented by the drivers)
Parameters:
string |
$seqName: |
name of the sequence to be created |
string |
$start: |
start value of the sequence; default is 1 |
array |
$options: |
An associative array of table options: array( 'comment' => 'Foo', 'charset' => 'utf8', 'collate' => 'utf8_unicode_ci', ); |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if something fails at database level |
Redefined in descendants as:
void createTable(
string
$name,
$fields, [
$options = array()]
)
|
|
create a new table
Parameters:
string |
$name: |
Name of the database that should be created |
array |
$fields: |
Associative array that contains the definition of each field of the new table |
array |
$options: |
An associative array of table options: |
API Tags:
Redefined in descendants as:
string createTableSql(
string
$name,
$fields, [
$options = array()]
)
|
|
create a new table
Parameters:
string |
$name: |
Name of the database that should be created |
array |
$fields: |
Associative array that contains the definition of each field of the new table The indexes of the array entries are the names of the fields of the table an the array entry values are associative arrays like those that are meant to be passed with the field definitions to get[Type]Declaration() functions. array( 'id' => array( 'type' => 'integer', 'unsigned' => 1 'notnull' => 1 'default' => 0 ), 'name' => array( 'type' => 'text', 'length' => 12 ), 'password' => array( 'type' => 'text', 'length' => 12 ) ); |
array |
$options: |
An associative array of table options: |
API Tags:
Redefined in descendants as:
void dropConstraint(
string
$table, string
$name, [string
$primary = false]
)
|
|
drop existing constraint
Parameters:
string |
$table: |
name of table that should be used in method |
string |
$name: |
name of the constraint to be dropped |
string |
$primary: |
hint if the constraint is primary |
API Tags:
void dropDatabase(
$database, string
$name
)
|
|
drop an existing database (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the database that should be dropped |
|
$database: |
|
API Tags:
Redefined in descendants as:
void dropDatabaseSql(
$database, string
$name
)
|
|
drop an existing database (this method is implemented by the drivers)
Parameters:
string |
$name: |
name of the database that should be dropped |
|
$database: |
|
API Tags:
Redefined in descendants as:
void dropIndex(
string
$table, string
$name
)
|
|
drop existing index
Parameters:
string |
$table: |
name of table that should be used in method |
string |
$name: |
name of the index to be dropped |
API Tags:
string dropIndexSql(
string
$table, string
$name
)
|
|
dropIndexSql
Parameters:
string |
$table: |
name of table that should be used in method |
string |
$name: |
name of the index to be dropped |
API Tags:
Return: | SQL that is used for dropping an index |
Access: | public |
Redefined in descendants as:
void dropSequence(
string
$sequenceName
)
|
|
dropSequenceSql drop existing sequence (this method is implemented by the drivers)
Parameters:
string |
$sequenceName: |
name of the sequence to be dropped |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if something fails at database level |
void dropSequenceSql(
string
$sequenceName
)
|
|
dropSequenceSql drop existing sequence
Parameters:
string |
$sequenceName: |
name of the sequence to be dropped |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if something fails at database level |
Redefined in descendants as:
void dropTable(
string
$table
)
|
|
dropTable drop an existing table
Parameters:
string |
$table: |
name of table that should be dropped from the database |
API Tags:
Redefined in descendants as:
string dropTableSql(
string
$table
)
|
|
dropTableSql drop an existing table
Parameters:
string |
$table: |
name of table that should be dropped from the database |
API Tags:
Redefined in descendants as:
void exportClasses(
$classes
)
|
|
exportClasses method for exporting Doctrine_Record classes to a schema
Parameters:
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation |
void exportClassesSql(
$classes
)
|
|
exportClassesSql method for exporting Doctrine_Record classes to a schema
Parameters:
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation |
void exportSchema(
[string
$directory = null]
)
|
|
exportSchema method for exporting Doctrine_Record classes to a schema
if the directory parameter is given this method first iterates recursively trhough the given directory in order to find any model classes
Then it iterates through all declared classes and creates tables for the ones that extend Doctrine_Record and are not abstract classes
Parameters:
string |
$directory: |
optional directory parameter |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation |
void exportSql(
[string
$directory = null]
)
|
|
exportSql returns the sql for exporting Doctrine_Record classes to a schema
if the directory parameter is given this method first iterates recursively trhough the given directory in order to find any model classes
Then it iterates through all declared classes and creates tables for the ones that extend Doctrine_Record and are not abstract classes
Parameters:
string |
$directory: |
optional directory parameter |
API Tags:
Information Tags:
Throws: | Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation |
exportTable exports given table into database based on column and option definitions
Parameters:
API Tags:
Return: | whether or not the export operation was successful false if table already existed in the database |
Access: | public |
Information Tags:
Throws: | Doctrine_Connection_Exception if some error other than Doctrine::ERR_ALREADY_EXISTS occurred during the create table operation |
string getAdvancedForeignKeyOptions(
$definition
)
|
|
getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
Parameters:
array |
$definition: |
foreign key definition |
API Tags:
Redefined in descendants as:
-
Doctrine_Export_Mysql::getAdvancedForeignKeyOptions()
: getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
-
Doctrine_Export_Oracle::getAdvancedForeignKeyOptions()
: getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
-
Doctrine_Export_Pgsql::getAdvancedForeignKeyOptions()
: getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
-
Doctrine_Export_Sqlite::getAdvancedForeignKeyOptions()
: getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
string getCharsetFieldDeclaration(
string
$charset
)
|
|
Obtain DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration to be used in statements like CREATE TABLE.
Parameters:
string |
$charset: |
name of the charset |
API Tags:
Return: | DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration. |
Access: | public |
string getCheckDeclaration(
$definition
)
|
|
Obtain DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE.
Parameters:
array |
$definition: |
check definition |
API Tags:
Return: | DBMS specific SQL code portion needed to set a CHECK constraint |
Access: | public |
string getCollationFieldDeclaration(
string
$collation
)
|
|
Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.
Parameters:
string |
$collation: |
name of the collation |
API Tags:
Return: | DBMS specific SQL code portion needed to set the COLLATION of a field declaration. |
Access: | public |
string getDeclaration(
string
$name,
$field
)
|
|
Obtain DBMS specific SQL code portion needed to declare a generic type field to be used in statements like CREATE TABLE.
Parameters:
string |
$name: |
name the field to be declared. |
array |
$field: |
associative array with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows: length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS. default Text value to be used as default for this field. notnull Boolean flag that indicates whether this field is constrained to not be set to null. charset Text value with the default CHARACTER SET for this field. collation Text value with the default COLLATION for this field. unique unique constraint check column check constraint |
API Tags:
Return: | DBMS specific SQL code portion that should be used to declare the specified field. |
Access: | public |
string getDefaultFieldDeclaration(
array
$field
)
|
|
getDefaultDeclaration Obtain DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.
Parameters:
array |
$field: |
field definition array |
API Tags:
Return: | DBMS specific SQL code portion needed to set a default value |
Access: | public |
Redefined in descendants as:
string getFieldDeclarationList(
$fields
)
|
|
Get declaration of a number of field in bulk
Parameters:
array |
$fields: |
a multidimensional associative array. The first dimension determines the field name, while the second dimension is keyed with the name of the properties of the field being declared as array indexes. Currently, the types of supported field properties are as follows: length Integer value that determines the maximum length of the text field. If this argument is missing the field should be declared to have the longest length allowed by the DBMS. default Text value to be used as default for this field. notnull Boolean flag that indicates whether this field is constrained to not be set to null. charset Text value with the default CHARACTER SET for this field. collation Text value with the default COLLATION for this field. unique unique constraint |
API Tags:
string getForeignKeyBaseDeclaration(
$definition
)
|
|
getForeignKeyBaseDeclaration Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.
Parameters:
API Tags:
string getForeignKeyDeclaration(
$definition
)
|
|
getForeignKeyDeclaration Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.
Parameters:
array |
$definition: |
an associative array with the following structure: name optional constraint name local the local field(s) foreign the foreign reference field(s) foreignTable the name of the foreign table onDelete referential delete action onUpdate referential update action deferred deferred constraint checking The onDelete and onUpdate keys accept the following values: CASCADE: Delete or update the row from the parent table and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. Between two tables, you should not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table. SET NULL: Delete or update the row from the parent table and set the foreign key column or columns in the child table to NULL. This is valid only if the foreign key columns do not have the NOT NULL qualifier specified. Both ON DELETE SET NULL and ON UPDATE SET NULL clauses are supported. NO ACTION: In standard SQL, NO ACTION means no action in the sense that an attempt to delete or update a primary key value is not allowed to proceed if there is a related foreign key value in the referenced table. RESTRICT: Rejects the delete or update operation for the parent table. NO ACTION and RESTRICT are the same as omitting the ON DELETE or ON UPDATE clause. SET DEFAULT |
API Tags:
Return: | DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration. |
Access: | public |
void getForeignKeyReferentialAction(
string
$action, string
1
)
|
|
getForeignKeyReferentialAction
returns given referential action in uppercase if valid, otherwise throws an exception
Parameters:
string |
$action: |
foreign key referential action |
string |
1: |
foreign key referential action in uppercase |
API Tags:
Information Tags:
Throws: | Doctrine_Exception_Exception if unknown referential action given |
string getIndexDeclaration(
string
$name,
$definition
)
|
|
Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
Parameters:
string |
$name: |
name of the index |
array |
$definition: |
index definition |
API Tags:
Return: | DBMS specific SQL code portion needed to set an index |
Access: | public |
Redefined in descendants as:
string getIndexFieldDeclarationList(
$fields
)
|
|
getIndexFieldDeclarationList Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
Parameters:
API Tags:
Redefined in descendants as:
string getTemporaryTableQuery(
)
|
|
A method to return the required SQL string that fits between CREATE ... TABLE to create the table as a temporary table.
Should be overridden in driver classes to return the correct string for the specific database type.
The default is to return the string "TEMPORARY" - this will result in a SQL error for any database that does not support temporary tables, or that requires a different SQL command from "CREATE TEMPORARY TABLE".
API Tags:
Return: | The string required to be placed between "CREATE" and "TABLE" to generate a temporary table, if possible. |
Access: | public |
Redefined in descendants as:
string getUniqueFieldDeclaration(
)
|
|
Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration to be used in statements like CREATE TABLE.
API Tags:
Return: | DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration. |
Access: | public |