Path

ez components / documentation / api reference / 2009.2.1 / databaseschema


eZ Components 2009.2.1

DatabaseSchema: ezcDbSchemaDbWriter

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Interface: ezcDbSchemaDbWriter

This class provides the interface for database schema writers [source]

Parents

ezcDbSchemaWriter
   |
   --ezcDbSchemaDbWriter

Method Summary

public array(string) convertToDDL( $dbSchema )
Returns an array with SQL DDL statements that creates the database definition in $dbSchema
public boolean isQueryAllowed( $db, $query )
Checks if the query is allowed.
public void saveToDb( $db, $dbSchema )
Creates the tables contained in $schema in the database that is related to $db

Inherited Methods

From ezcDbSchemaWriter :
public int ezcDbSchemaWriter::getWriterType()
Returns what type of schema writer this class implements.

Methods

convertToDDL

array(string) convertToDDL( ezcDbSchema $dbSchema )
Returns an array with SQL DDL statements that creates the database definition in $dbSchema
Converts the schema definition contained in $dbSchema to DDL SQL. This SQL can be used to create tables in an existing database according to the definition. The SQL queries are returned as an array.

Parameters

Name Type Description
$dbSchema ezcDbSchema  

isQueryAllowed

boolean isQueryAllowed( $db, string $query )
Checks if the query is allowed.
Perform testing if table exist for DROP TABLE query to avoid stoping execution while try to drop not existent table.

Parameters

Name Type Description
$db ezcDbHandler  
$query string  

saveToDb

void saveToDb( $db, ezcDbSchema $dbSchema )
Creates the tables contained in $schema in the database that is related to $db
This method takes the table definitions from $schema and will create the tables according to this definition in the database that is references by the $db handler. If tables with the same name as contained in the definitions already exist they will be removed and recreated with the new definition.

Parameters

Name Type Description
$db ezcDbHandler  
$dbSchema ezcDbSchema  

Last updated: Tue, 23 Mar 2010