## Apache Zeta Components Manual :: Docs For Class ezcDbSchemaDbWriter

### DatabaseSchema::ezcDbSchemaDbWriter

### Interface ezcDbSchemaDbWriter

This class provides the interface for database schema writers

Source for this file: /DatabaseSchema/src/interfaces/db_writer.php

    ezcDbSchemaWriter
       |
       --ezcDbSchemaDbWriter

Version: | //autogen//

### 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 |

Documentation generated by phpDocumentor 1.4.3