Flourish PHP Unframework

fSQLSchemaTranslation

class, v1.0.0b3

Adds cross-database CREATE TABLE, ALTER TABLE and COMMENT ON COLUMN statements to fSQLTranslation

Changes:
1.0.0b3Fixed associating a sequence with a column in PostgreSQL when setting auto-increment, fixed detection of some Oracle CHECK(IN) constraints, fixed default values for SQLite ON DELETE and ON UPDATE clauses 1/12/12
1.0.0b2Fixed detection of explicitly named SQLite foreign key constraints 8/23/11
1.0.0bThe initial implementation 5/9/11

Static Methods

::compose() protected

Composes text using fText if loaded

Signature

string compose( string $message, mixed $component [, ... ] )

Parameters

string $message The message to compose
mixed $component [, ... ] A string or number to insert into the message

Returns

The composed and possible translated message

Methods

->__construct() public

Sets up the class

Signature

fSQLSchemaTranslation __construct( fDatabase $database )

Parameters

fDatabase $database The database being translated for

->__get() internal public

Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code

All requests that hit this method should be requests for callbacks

Signature

callback __get( string $method )

Parameters

string $method The method to create a callback for

Returns

The callback for the method requested

->translate() internal public

Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code

Translates a Flourish SQL DDL statement into the dialect for the current database

Signature

array translate( string $sql, array &$rollback_statements=NULL )

Parameters

string $sql The SQL statement to translate
array &$rollback_statements SQL statements to rollback the returned SQL statements if something goes wrong - only applicable for MySQL ALTER TABLE statements

Returns

An array containing the translated $sql statement and an array of extra statements