|
Doctrine 1.2.4
|
Inherits Doctrine_Export.
Public Member Functions | |
| alterTable ($name, array $changes, $check=false) | |
| createConstraint ($table, $name, $definition) | |
| createConstraintSql ($table, $name, $definition) | |
| createDatabase ($databaseFile) | |
| createDatabaseSql ($database) | |
| createForeignKey ($table, array $definition) | |
| createForeignKeySql ($table, array $definition) | |
| createIndex ($table, $name, array $definition) | |
| createIndexSql ($table, $name, array $definition) | |
| createSequence ($seqName, $start=1, array $options=array()) | |
| createSequenceSql ($seqName, $start=1, array $options=array()) | |
| createTable ($name, array $fields, array $options=array()) | |
| createTableSql ($name, array $fields, array $options=array()) | |
| dropConstraint ($table, $name, $primary=false) | |
| dropDatabase ($databaseFile) | |
| dropDatabaseSql ($database) | |
| dropForeignKey ($table, $name) | |
| dropIndex ($table, $name) | |
| dropIndexSql ($table, $name) | |
| dropSequence ($sequenceName) | |
| dropSequenceSql ($sequenceName) | |
| dropTable ($table) | |
| dropTableSql ($table) | |
| exportClasses (array $classes) | |
| exportClassesSql (array $classes) | |
| exportGeneratorsSql (Doctrine_Table $table) | |
| exportSchema ($directory=null) | |
| exportSql ($directory=null) | |
| exportTable (Doctrine_Table $table) | |
| getAdvancedForeignKeyOptions (array $definition) | |
| getAllGenerators (Doctrine_Table $table) | |
| getCharsetFieldDeclaration ($charset) | |
| getCheckDeclaration (array $definition) | |
| getCollationFieldDeclaration ($collation) | |
| getConnection () | |
| getDeclaration ($name, array $field) | |
| getDefaultFieldDeclaration ($field) | |
| getFieldDeclarationList (array $fields) | |
| getForeignKeyBaseDeclaration (array $definition) | |
| getForeignKeyDeclaration (array $definition) | |
| getForeignKeyReferentialAction ($action) | |
| getIndexDeclaration ($name, array $definition) | |
| getIndexFieldDeclarationList (array $fields) | |
| getModuleName () | |
| getNotNullFieldDeclaration (array $definition) | |
| getTemporaryTableQuery () | |
| getUniqueFieldDeclaration () | |
Definition at line 34 of file Sqlite.php.
|
inherited |
alter an existing table (this method is implemented by the drivers)
| 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. |
Definition at line 616 of file Export.php.
|
inherited |
create a constraint on a table
| 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() ) )
Definition at line 376 of file Export.php.
|
inherited |
create a constraint on a table
| 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() ) )
Definition at line 404 of file Export.php.
| Doctrine_Export_Sqlite::createDatabase | ( | $databaseFile | ) |
createDatabase
Create sqlite database file
| string | $databaseFile | Path of the database that should be dropped |
Definition at line 67 of file Sqlite.php.
|
inherited |
create a new database (this method is implemented by the drivers)
| string | $name | name of the database that should be created |
Definition at line 200 of file Export.php.
| Doctrine_Export_Sqlite::createForeignKey | ( | $table, | |
| array | $definition | ||
| ) |
createForeignKey
Sqlite does not support foreign keys so we are not even going to do anything if this function is called to avoid any sql errors if a user tries to use this on sqlite
| 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. |
Definition at line 417 of file Sqlite.php.
|
inherited |
createForeignKeySql
| 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. |
Definition at line 505 of file Export.php.
|
inherited |
Get the stucture of a field into an array
| 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() ) )
Definition at line 456 of file Export.php.
| Doctrine_Export_Sqlite::createIndexSql | ( | $table, | |
| $name, | |||
| array | $definition | ||
| ) |
Get the stucture of a field into an array
| 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 support() to determine whether the DBMS driver can manage indexes. Example array( 'fields' => array( 'user_name' => array( 'sorting' => 'ascending' ), 'last_login' => array() ) )
| PDOException |
Definition at line 103 of file Sqlite.php.
| Doctrine_Export_Sqlite::createSequence | ( | $seqName, | |
$start = 1, |
|||
| array | $options = array() |
||
| ) |
create sequence
| 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', ); |
Definition at line 286 of file Sqlite.php.
|
inherited |
return RDBMS specific create sequence statement (this method is implemented by the drivers)
| Doctrine_Connection_Exception | if something fails at database level |
| 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', ); |
Definition at line 350 of file Export.php.
|
inherited |
create a new table
| 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: |
Definition at line 294 of file Export.php.
| Doctrine_Export_Sqlite::createTableSql | ( | $name, | |
| array | $fields, | ||
| array | $options = array() |
||
| ) |
create a new table
| 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: |
Definition at line 189 of file Sqlite.php.
|
inherited |
drop existing constraint
| 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 |
Definition at line 134 of file Export.php.
| Doctrine_Export_Sqlite::dropDatabase | ( | $databaseFile | ) |
dropDatabase
drop an existing database
| string | $databaseFile | Path of the database that should be dropped |
| Doctrine_Export_Exception | if the database file does not exist |
| Doctrine_Export_Exception | if something failed during the removal of the database file |
Definition at line 46 of file Sqlite.php.
|
inherited |
drop an existing database (this method is implemented by the drivers)
| string | $name | name of the database that should be dropped |
Definition at line 71 of file Export.php.
|
inherited |
drop existing foreign key
| string | $table | name of table that should be used in method |
| string | $name | name of the foreign key to be dropped |
Definition at line 149 of file Export.php.
|
inherited |
drop existing index
| string | $table | name of table that should be used in method |
| string | $name | name of the index to be dropped |
Definition at line 107 of file Export.php.
|
inherited |
dropIndexSql
| string | $table | name of table that should be used in method |
| string | $name | name of the index to be dropped |
Definition at line 119 of file Export.php.
|
inherited |
dropSequenceSql drop existing sequence (this method is implemented by the drivers)
| Doctrine_Connection_Exception | if something fails at database level |
| string | $sequenceName | name of the sequence to be dropped |
Definition at line 163 of file Export.php.
| Doctrine_Export_Sqlite::dropSequenceSql | ( | $sequenceName | ) |
drop existing sequence
| string | $sequenceName | name of the sequence to be dropped |
Definition at line 319 of file Sqlite.php.
|
inherited |
dropTable drop an existing table
| string | $table | name of table that should be dropped from the database |
Definition at line 95 of file Export.php.
|
inherited |
dropTableSql drop an existing table
| string | $table | name of table that should be dropped from the database |
Definition at line 83 of file Export.php.
|
inherited |
exportClasses method for exporting Doctrine_Record classes to a schema
FIXME: This function has ugly hacks in it to make sure sql is inserted in the correct order.
| Doctrine_Connection_Exception | if some error other than Doctrine_Core::ERR_ALREADY_EXISTS occurred during the create table operation |
| array | $classes |
Definition at line 1203 of file Export.php.
|
inherited |
exportClassesSql method for exporting Doctrine_Record classes to a schema
| Doctrine_Connection_Exception | if some error other than Doctrine_Core::ERR_ALREADY_EXISTS occurred during the create table operation |
| array | $classes |
Definition at line 1237 of file Export.php.
|
inherited |
exportGeneratorsSql exports plugin tables for given table
| Doctrine_Table | $table | the table in which the generators belong to |
Definition at line 1321 of file Export.php.
|
inherited |
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
| Doctrine_Connection_Exception | if some error other than Doctrine_Core::ERR_ALREADY_EXISTS occurred during the create table operation |
| string | $directory | optional directory parameter |
Definition at line 1092 of file Export.php.
|
inherited |
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
| Doctrine_Connection_Exception | if some error other than Doctrine_Core::ERR_ALREADY_EXISTS occurred during the create table operation |
| string | $directory | optional directory parameter |
Definition at line 1356 of file Export.php.
|
inherited |
exportTable exports given table into database based on column and option definitions
| Doctrine_Connection_Exception | if some error other than Doctrine_Core::ERR_ALREADY_EXISTS occurred during the create table operation |
Definition at line 1376 of file Export.php.
| Doctrine_Export_Sqlite::getAdvancedForeignKeyOptions | ( | array | $definition | ) |
getAdvancedForeignKeyOptions Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
| array | $definition | foreign key definition |
Definition at line 248 of file Sqlite.php.
|
inherited |
fetches all generators recursively for given table
| Doctrine_Table | $table | table object to retrieve the generators from |
Definition at line 1293 of file Export.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration to be used in statements like CREATE TABLE.
| string | $charset | name of the charset |
Definition at line 1059 of file Export.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE.
| array | $definition | check definition |
Definition at line 809 of file Export.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.
| string | $collation | name of the collation |
Definition at line 1072 of file Export.php.
|
inherited |
getConnection returns the connection object this module uses
Definition at line 68 of file Module.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to declare a generic type field to be used in statements like CREATE TABLE.
| 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
Definition at line 717 of file Export.php.
|
inherited |
getDefaultDeclaration Obtain DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.
| array | $field | field definition array |
Definition at line 761 of file Export.php.
|
inherited |
Get declaration of a number of field in bulk
| 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
Definition at line 671 of file Export.php.
|
inherited |
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.
| array | $definition |
Definition at line 1006 of file Export.php.
|
inherited |
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.
| 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
Definition at line 944 of file Export.php.
|
inherited |
getForeignKeyReferentialAction
returns given referential action in uppercase if valid, otherwise throws an exception
| Doctrine_Exception_Exception | if unknown referential action given |
| string | $action | foreign key referential action |
| string | foreign key referential action in uppercase |
Definition at line 982 of file Export.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
| string | $name | name of the index |
| array | $definition | index definition |
Definition at line 837 of file Export.php.
| Doctrine_Export_Sqlite::getIndexFieldDeclarationList | ( | array | $fields | ) |
getIndexFieldDeclarationList Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.
Definition at line 134 of file Sqlite.php.
|
inherited |
getModuleName returns the name of this module
Definition at line 79 of file Module.php.
|
inherited |
getNotNullFieldDeclaration Obtain DBMS specific SQL code portion needed to set a NOT NULL declaration to be used in statements like CREATE TABLE.
| array | $field | field definition array |
Definition at line 796 of file Export.php.
|
inherited |
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".
Definition at line 897 of file Export.php.
|
inherited |
Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration to be used in statements like CREATE TABLE.
Definition at line 1046 of file Export.php.