Path

ez components / documentation / api reference / 2007.1 / databaseschema


eZ Components 2007.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, $schemaDiff )
Returns an array with SQL DDL statements that creates the database definition in $dbSchema
public void saveToDb( $db, $schema )
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, ezcDbSchemaDiff $schemaDiff )
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
$schemaDiff ezcDbSchemaDiff  
$dbSchema ezcDbSchema  

saveToDb

void saveToDb( $db, ezcDbSchema $schema )
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  
$schema ezcDbSchema  

Last updated: Thu, 01 Nov 2007