Class

PgsqlPlatform

class PgsqlPlatform extends DefaultPlatform

Postgresql PropelPlatformInterface implementation.

Methods

__construct(PDO $con = null)

Default constructor.

from DefaultPlatform
setConnection(PDO $con = null)

Set the database connection to use for this Platform class.

from DefaultPlatform
PDO getConnection()

Returns the database connection to use for this Platform class.

from DefaultPlatform
setGeneratorConfig(GeneratorConfigInterface $config)

Sets the GeneratorConfig to use in the parsing.

from DefaultPlatform
string getDatabaseType()

Returns the short name of the database type that this platform represents.

from DefaultPlatform
int getMaxColumnNameLength()

Returns the max column length supported by the db.

string getNativeIdMethod()

Returns the native IdMethod (sequence|identity)

isNativeIdMethodAutoIncrement()

from DefaultPlatform
Domain getDomainForType(string $propelType)

Returns the db specific domain for a propelType.

from DefaultPlatform
string getNullString($notNull)

from DefaultPlatform
The getAutoIncrement()

string getSequenceName(Table $table)

Override to provide sequence names that conform to postgres' standard when no id-method-parameter specified.

string getAddTablesDDL(Database $database)

Builds the DDL SQL to add the tables of a database together with index and foreign keys

string getBeginDDL()

Gets the requests to execute at the beginning of a DDL file

from DefaultPlatform
string getEndDDL()

Gets the requests to execute at the end of a DDL file

from DefaultPlatform
string getDropTableDDL(Table $table)

Builds the DDL SQL to drop a table

string getAddTableDDL(Table $table)

Builds the DDL SQL to add a table without index and foreign keys

string getColumnDDL(Column $col)

Builds the DDL SQL for a Column object.

string getColumnDefaultValueDDL(Column $col)

Returns the SQL for the default value of a Column object

from DefaultPlatform
string getColumnListDDL($columns, $delimiter = ',')

Creates a delimiter-delimited string list of column names, quoted using quoteIdentifier().

from DefaultPlatform
string getPrimaryKeyName(Table $table)

Returns the name of a table primary key

string getPrimaryKeyDDL(Table $table)

Returns the SQL for the primary key of a Table object

from DefaultPlatform
string getDropPrimaryKeyDDL(Table $table)

Builds the DDL SQL to drop the primary key of a table.

from DefaultPlatform
string getAddPrimaryKeyDDL(Table $table)

Builds the DDL SQL to add the primary key of a table.

from DefaultPlatform
string getAddIndicesDDL(Table $table)

Builds the DDL SQL to add the indices of a table.

from DefaultPlatform
string getAddIndexDDL(Index $index)

Builds the DDL SQL to add an Index.

from DefaultPlatform
string getDropIndexDDL(Index $index)

Overrides the implementation from DefaultPlatform

string getIndexDDL(Index $index)

Builds the DDL SQL for an Index object.

from DefaultPlatform
string getUniqueDDL(Unique $unique)

Builds the DDL SQL for a Unique constraint object.

string getAddForeignKeysDDL(Table $table)

Builds the DDL SQL to add the foreign keys of a table.

from DefaultPlatform
string getAddForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to add a foreign key.

from DefaultPlatform
string getDropForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to drop a foreign key.

from DefaultPlatform
string getForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL for a ForeignKey object.

from DefaultPlatform
getCommentLineDDL($comment)

from DefaultPlatform
getCommentBlockDDL($comment)

from DefaultPlatform
string getModifyDatabaseDDL(PropelDatabaseDiff $databaseDiff)

Builds the DDL SQL to modify a database based on a PropelDatabaseDiff instance

from DefaultPlatform
string getRenameTableDDL($fromTableName, $toTableName)

Builds the DDL SQL to rename a table

from DefaultPlatform
string getModifyTableDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

from DefaultPlatform
string getModifyTableColumnsDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

from DefaultPlatform
string getModifyTablePrimaryKeyDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's primary key based on a PropelTableDiff instance

from DefaultPlatform
string getModifyTableIndicesDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's indices based on a PropelTableDiff instance

from DefaultPlatform
string getModifyTableForeignKeysDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's foreign keys based on a PropelTableDiff instance

from DefaultPlatform
string getRemoveColumnDDL(Column $column)

Builds the DDL SQL to remove a column

from DefaultPlatform
string getRenameColumnDDL($fromColumn, $toColumn)

Builds the DDL SQL to rename a column

from DefaultPlatform
string getModifyColumnDDL(PropelColumnDiff $columnDiff)

Overrides the implementation from DefaultPlatform

string getModifyColumnsDDL($columnDiffs)

Overrides the implementation from DefaultPlatform

string getAddColumnDDL(Column $column)

Builds the DDL SQL to remove a column

from DefaultPlatform
string getAddColumnsDDL($columns)

Overrides the implementation from DefaultPlatform

boolean hasSize(string $sqlType)

Returns if the RDBMS-specific SQL type has a size attribute.

boolean hasScale(string $sqlType)

Returns if the RDBMS-specific SQL type has a scale attribute.

from DefaultPlatform
string quote(string $text)

Quote and escape needed characters in the string for underlying RDBMS.

from DefaultPlatform
string quoteIdentifier(string $text)

Quotes identifiers used in database SQL.

from DefaultPlatform
setIdentifierQuoting($enabled = true)

from DefaultPlatform
getIdentifierQuoting()

from DefaultPlatform
boolean supportsNativeDeleteTrigger()

Whether RDBMS supports native ON DELETE triggers (e.g.

boolean supportsInsertNullPk()

Whether RDBMS supports INSERT null values in autoincremented primary keys

from DefaultPlatform
boolean hasStreamBlobImpl()

Whether the underlying PDO driver for this platform returns BLOB columns as streams (instead of strings).

boolean supportsSchemas()

boolean supportsMigrations()

from DefaultPlatform
boolean supportsVarcharWithoutSize()

Wether RDBMS supports VARCHAR without explicit size

mixed getBooleanString($b)

Returns the boolean value for the RDBMS.

getPhpArrayString($stringValue)

from DefaultPlatform
string getTimestampFormatter()

Gets the preferred timestamp formatter for setting date/time values.

from DefaultPlatform
string getTimeFormatter()

Gets the preferred time formatter for setting date/time values.

from DefaultPlatform
string getDateFormatter()

Gets the preferred date formatter for setting date/time values.

from DefaultPlatform
getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = ' ')

Get the PHP snippet for binding a value to a column.

from DefaultPlatform
getIdentifierPhp($columnValueMutator, $connectionVariableName = '$con', $sequenceName = '', $tab = ' ')

Get the PHP snippet for getting a Pk from the database.

getDefaultFKOnDeleteBehavior()

from DefaultPlatform
getDefaultFKOnUpdateBehavior()

from DefaultPlatform
string disconnectedEscapeText(string $text)

Escape the string for RDBMS.

getAddSchemasDDL(Database $database)

getAddSchemaDDL(Table $table)

getUseSchemaDDL(Table $table)

getResetSchemaDDL(Table $table)

Details

in DefaultPlatform at line 49
public __construct(PDO $con = null)

Default constructor.

Parameters

PDO $con Optional database connection to use in this platform.

in DefaultPlatform at line 62
public setConnection(PDO $con = null)

Set the database connection to use for this Platform class.

Parameters

PDO $con Database connection to use in this platform.

in DefaultPlatform at line 72
public PDO getConnection()

Returns the database connection to use for this Platform class.

Return Value

PDO The database connection or NULL if none has been set.

in DefaultPlatform at line 82
public setGeneratorConfig(GeneratorConfigInterface $config)

Sets the GeneratorConfig to use in the parsing.

Parameters

GeneratorConfigInterface $config

in DefaultPlatform at line 136
public string getDatabaseType()

Returns the short name of the database type that this platform represents.

For example MysqlPlatform->getDatabaseType() returns 'mysql'.

Return Value

string

at line 59
public int getMaxColumnNameLength()

Returns the max column length supported by the db.

Return Value

int The max column length

at line 49
public string getNativeIdMethod()

Returns the native IdMethod (sequence|identity)

Return Value

string The native IdMethod (PropelPlatformInterface:IDENTITY, PropelPlatformInterface::SEQUENCE).

in DefaultPlatform at line 164
public isNativeIdMethodAutoIncrement()

in DefaultPlatform at line 177
public Domain getDomainForType(string $propelType)

Returns the db specific domain for a propelType.

Parameters

string $propelType the Propel type name.

Return Value

Domain The db specific domain.

Exceptions

EngineException

in DefaultPlatform at line 190
public string getNullString($notNull)

Parameters

$notNull

Return Value

string The RDBMS-specific SQL fragment for NULL or NOT NULL.

at line 54
public The getAutoIncrement()

Return Value

The RDBMS-specific SQL fragment for autoincrement.

at line 102
public string getSequenceName(Table $table)

Override to provide sequence names that conform to postgres' standard when no id-method-parameter specified.

Parameters

Table $table

Return Value

string Sequence name for this table.

at line 201
public string getAddTablesDDL(Database $database)

Builds the DDL SQL to add the tables of a database together with index and foreign keys

Parameters

Database $database

Return Value

string

in DefaultPlatform at line 263
public string getBeginDDL()

Gets the requests to execute at the beginning of a DDL file

Return Value

string

in DefaultPlatform at line 272
public string getEndDDL()

Gets the requests to execute at the end of a DDL file

Return Value

string

at line 292
public string getDropTableDDL(Table $table)

Builds the DDL SQL to drop a table

Parameters

Table $table

Return Value

string

at line 219
public string getAddTableDDL(Table $table)

Builds the DDL SQL to add a table without index and foreign keys

Parameters

Table $table

Return Value

string

at line 313
public string getColumnDDL(Column $col)

Builds the DDL SQL for a Column object.

Parameters

Column $col

Return Value

string

in DefaultPlatform at line 362
public string getColumnDefaultValueDDL(Column $col)

Returns the SQL for the default value of a Column object

Parameters

Column $col

Return Value

string

in DefaultPlatform at line 408
public string getColumnListDDL($columns, $delimiter = ',')

Creates a delimiter-delimited string list of column names, quoted using quoteIdentifier().

Parameters

$columns
$delimiter

Return Value

string

at line 306
public string getPrimaryKeyName(Table $table)

Returns the name of a table primary key

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 438
public string getPrimaryKeyDDL(Table $table)

Returns the SQL for the primary key of a Table object

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 452
public string getDropPrimaryKeyDDL(Table $table)

Builds the DDL SQL to drop the primary key of a table.

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 471
public string getAddPrimaryKeyDDL(Table $table)

Builds the DDL SQL to add the primary key of a table.

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 490
public string getAddIndicesDDL(Table $table)

Builds the DDL SQL to add the indices of a table.

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 507
public string getAddIndexDDL(Index $index)

Builds the DDL SQL to add an Index.

Parameters

Index $index

Return Value

string

at line 470
public string getDropIndexDDL(Index $index)

Overrides the implementation from DefaultPlatform

Parameters

Index $index

Return Value

string

See also

DefaultPlatform::getDropIndexDDL

in DefaultPlatform at line 544
public string getIndexDDL(Index $index)

Builds the DDL SQL for an Index object.

Parameters

Index $index

Return Value

string

at line 341
public string getUniqueDDL(Unique $unique)

Builds the DDL SQL for a Unique constraint object.

Parameters

Unique $unique

Return Value

string

in DefaultPlatform at line 568
public string getAddForeignKeysDDL(Table $table)

Builds the DDL SQL to add the foreign keys of a table.

Parameters

Table $table

Return Value

string

in DefaultPlatform at line 585
public string getAddForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to add a foreign key.

Parameters

ForeignKey $fk

Return Value

string

in DefaultPlatform at line 607
public string getDropForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL to drop a foreign key.

Parameters

ForeignKey $fk

Return Value

string

in DefaultPlatform at line 627
public string getForeignKeyDDL(ForeignKey $fk)

Builds the DDL SQL for a ForeignKey object.

Parameters

ForeignKey $fk

Return Value

string

in DefaultPlatform at line 653
public getCommentLineDDL($comment)

Parameters

$comment

in DefaultPlatform at line 661
public getCommentBlockDDL($comment)

Parameters

$comment

in DefaultPlatform at line 678
public string getModifyDatabaseDDL(PropelDatabaseDiff $databaseDiff)

Builds the DDL SQL to modify a database based on a PropelDatabaseDiff instance

Parameters

PropelDatabaseDiff $databaseDiff

Return Value

string

in DefaultPlatform at line 713
public string getRenameTableDDL($fromTableName, $toTableName)

Builds the DDL SQL to rename a table

Parameters

$fromTableName
$toTableName

Return Value

string

in DefaultPlatform at line 731
public string getModifyTableDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

in DefaultPlatform at line 796
public string getModifyTableColumnsDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

in DefaultPlatform at line 825
public string getModifyTablePrimaryKeyDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's primary key based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

in DefaultPlatform at line 843
public string getModifyTableIndicesDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's indices based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

in DefaultPlatform at line 870
public string getModifyTableForeignKeysDDL(PropelTableDiff $tableDiff)

Builds the DDL SQL to alter a table's foreign keys based on a PropelTableDiff instance

Parameters

PropelTableDiff $tableDiff

Return Value

string

in DefaultPlatform at line 896
public string getRemoveColumnDDL(Column $column)

Builds the DDL SQL to remove a column

Parameters

Column $column

Return Value

string

in DefaultPlatform at line 913
public string getRenameColumnDDL($fromColumn, $toColumn)

Builds the DDL SQL to rename a column

Parameters

$fromColumn
$toColumn

Return Value

string

at line 379
public string getModifyColumnDDL(PropelColumnDiff $columnDiff)

Overrides the implementation from DefaultPlatform

Parameters

PropelColumnDiff $columnDiff

Return Value

string

See also

DefaultPlatform::getModifyColumnDDL

at line 436
public string getModifyColumnsDDL($columnDiffs)

Overrides the implementation from DefaultPlatform

Parameters

$columnDiffs

Return Value

string

See also

DefaultPlatform::getModifyColumnsDDL

in DefaultPlatform at line 982
public string getAddColumnDDL(Column $column)

Builds the DDL SQL to remove a column

Parameters

Column $column

Return Value

string

at line 453
public string getAddColumnsDDL($columns)

Overrides the implementation from DefaultPlatform

Parameters

$columns

Return Value

string

See also

DefaultPlatform::getAddColumnsDLL

at line 357
public boolean hasSize(string $sqlType)

Returns if the RDBMS-specific SQL type has a size attribute.

Parameters

string $sqlType the SQL type

Return Value

boolean True if the type has a size attribute

in DefaultPlatform at line 1042
public boolean hasScale(string $sqlType)

Returns if the RDBMS-specific SQL type has a scale attribute.

Parameters

string $sqlType the SQL type

Return Value

boolean True if the type has a scale attribute

in DefaultPlatform at line 1054
public string quote(string $text)

Quote and escape needed characters in the string for underlying RDBMS.

Parameters

string $text

Return Value

string

in DefaultPlatform at line 1085
public string quoteIdentifier(string $text)

Quotes identifiers used in database SQL.

Parameters

string $text

Return Value

string Quoted identifier.

in DefaultPlatform at line 1090
public setIdentifierQuoting($enabled = true)

Parameters

$enabled

in DefaultPlatform at line 1095
public getIdentifierQuoting()

at line 89
public boolean supportsNativeDeleteTrigger()

Whether RDBMS supports native ON DELETE triggers (e.g.

ON DELETE CASCADE).

Return Value

boolean

in DefaultPlatform at line 1115
public boolean supportsInsertNullPk()

Whether RDBMS supports INSERT null values in autoincremented primary keys

Return Value

boolean

at line 362
public boolean hasStreamBlobImpl()

Whether the underlying PDO driver for this platform returns BLOB columns as streams (instead of strings).

Return Value

boolean

at line 352
public boolean supportsSchemas()

Return Value

boolean

See also

Platform::supportsSchemas()

in DefaultPlatform at line 1141
public boolean supportsMigrations()

Return Value

boolean

See also

Platform::supportsMigrations()

at line 367
public boolean supportsVarcharWithoutSize()

Wether RDBMS supports VARCHAR without explicit size

Return Value

boolean

at line 80
public mixed getBooleanString($b)

Returns the boolean value for the RDBMS.

This value should match the boolean value that is set when using Propel's PreparedStatement::setBoolean().

This function is used to set default column values when building SQL.

Parameters

$b

Return Value

mixed

in DefaultPlatform at line 1172
public getPhpArrayString($stringValue)

Parameters

$stringValue

in DefaultPlatform at line 1198
public string getTimestampFormatter()

Gets the preferred timestamp formatter for setting date/time values.

Return Value

string

in DefaultPlatform at line 1208
public string getTimeFormatter()

Gets the preferred time formatter for setting date/time values.

Return Value

string

in DefaultPlatform at line 1218
public string getDateFormatter()

Gets the preferred date formatter for setting date/time values.

Return Value

string

in DefaultPlatform at line 1228
public getColumnBindingPHP($column, $identifier, $columnValueAccessor, $tab = ' ')

Get the PHP snippet for binding a value to a column.

Warning: duplicates logic from DBAdapter::bindValue(). Any code modification here must be ported there.

Parameters

$column
$identifier
$columnValueAccessor
$tab

at line 491
public getIdentifierPhp($columnValueMutator, $connectionVariableName = '$con', $sequenceName = '', $tab = ' ')

Get the PHP snippet for getting a Pk from the database.

Warning: duplicates logic from DBPostgres::getId(). Any code modification here must be ported there.

Parameters

$columnValueMutator
$connectionVariableName
$sequenceName
$tab

in DefaultPlatform at line 1276
public getDefaultFKOnDeleteBehavior()

in DefaultPlatform at line 1281
public getDefaultFKOnUpdateBehavior()

at line 71
public string disconnectedEscapeText(string $text)

Escape the string for RDBMS.

Parameters

string $text

Return Value

string

at line 152
public getAddSchemasDDL(Database $database)

Parameters

Database $database

at line 167
public getAddSchemaDDL(Table $table)

Parameters

Table $table

at line 179
public getUseSchemaDDL(Table $table)

Parameters

Table $table

at line 191
public getResetSchemaDDL(Table $table)

Parameters

Table $table