Class

AbstractPlatform

Abstract Package: io License: LGPL Author: Guilherme Blanco <guilhermeblanco@hotmail.com> Author: Jonathan Wage <jonwage@gmail.com> Author: Roman Borschel <roman@code-factory.org> Author: Lukas Smith <smith@pooteeweet.org> (PEAR MDB2 library) Version: $Revision: 3938 $ Since: 2.0 Link: www.doctrine-project.org Located at io/db/dbms/Doctrine/DBAL/Platform/AbstractPlatform.php

Base class for all DatabasePlatforms. The DatabasePlatforms are the central point of abstraction of platform-specific behaviors, features and SQL dialects. They are a passive source of information.

Direct known subclasses

MySqlPlatform, PostgreSqlPlatform, SqlitePlatform
Methods summary
public
# __construct( )

Constructor.

public string
# getIdentifierQuoteCharacter( )

Gets the character used for identifier quoting.

public string
# getSqlCommentStartString( )

Gets the string portion that starts an SQL comment.

public string
# getSqlCommentEndString( )

Gets the string portion that ends an SQL comment.

public integer
# getVarcharMaxLength( )

Gets the maximum length of a varchar field.

public array
# getWildcards( )

Gets all SQL wildcard characters of the platform.

public string
# getRegexpExpression( )

Returns the regular expression operator.

public string
# getAvgExpression( string $column )

Returns the average value of a column

public string
# getCountExpression( string|integer $column )

Returns the number of rows (without a NULL value) of a column

public string
# getMaxExpression( string $column )

Returns the highest value of a column

public string
# getMinExpression( string $column )

Returns the lowest value of a column

public string
# getSumExpression( string $column )

Returns the total sum of a column

public string
# getMd5Expression( mixed $column )

Returns the md5 sum of a field.

public string
# getLengthExpression( string $column )

Returns the length of a text field.

public string
# getRoundExpression( string $column, string $decimals = 0 )

Rounds a numeric field to the number of decimals specified.

public string
# getModExpression( string $expression1, string $expression2 )

Returns the remainder of the division operation $expression1 / $expression2.

public string
# getTrimExpression( string $str )

trim returns the string $str with leading and proceeding space characters removed

public string
# getRtrimExpression( string $str )

rtrim returns the string $str with proceeding space characters removed

public string
# getLtrimExpression( string $str )

ltrim returns the string $str with leading space characters removed

public string
# getUpperExpression( string $str )

upper Returns the string $str with all characters changed to uppercase according to the current character set mapping.

public string
# getLowerExpression( string $str )

lower Returns the string $str with all characters changed to lowercase according to the current character set mapping.

public integer
# getLocateExpression( string $str, string $substr )

locate returns the position of the first occurrence of substring $substr in string $str

public string
# getNowExpression( )

Returns the current system date.

public string
# getSubstringExpression( string $value, integer $from, integer $len = null )

return string to call a function to get a substring inside an SQL statement

public string
# getConcatExpression( )

Returns a series of strings concatinated

public string
# getNotExpression( mixed $expression )

Returns the SQL for a logical not.

public string
# getInExpression( string $column, string|array(string) $values )

Returns the SQL to check if a value is one in a set of given values.

public string
# getIsNullExpression( string $expression )

Returns SQL that checks if a expression is null.

public string
# getIsNotNullExpression( string $expression )

Returns SQL that checks if a expression is not null.

public string
# getBetweenExpression( string $expression, string $value1, string $value2 )

Returns SQL that checks if an expression evaluates to a value between two values.

public
# getAcosExpression( mixed $value )
public
# getSinExpression( mixed $value )
public
public
# getCosExpression( mixed $value )
public
public
# getDropDatabaseSql( mixed $database )
public
# getDropTableSql( mixed $table )
public
# getDropIndexSql( mixed $table, mixed $name )
public
# getDropConstraintSql( mixed $table, mixed $name, mixed $primary = false )
public
# getDropForeignKeySql( mixed $table, mixed $name )
public array
# getCreateTableSql( string $table, array $columns, array $options = array() )

Gets the SQL statement(s) to create a table with the specified name, columns and constraints on this platform.

public
public string
# getCreateSequenceSql( string $sequenceName, integer $start = 1, integer $allocationSize = 1 )

Gets the SQL to create a sequence on this platform.

public string
# getCreateConstraintSql( string $table, string $name, array $definition )

Gets the SQL to create a constraint on a table on this platform.

public string
# getCreateIndexSql( string $table, string $name, array $definition )

Gets the SQL to create an index on a table on this platform.

public string
# quoteIdentifier( string $str )

Quotes a string so that it can be safely used as a table or column name, even if it is a reserved word of the platform.

public string
# getCreateForeignKeySql( string $table, array $definition )

createForeignKeySql

public string
# getAlterTableSql( string $name, array $changes, boolean $check = false )

Gets the sql for altering an existing table. (this method is implemented by the drivers)

public string
# getColumnDeclarationListSql( array $fields )

Get declaration of a number of fields in bulk

public string
# getColumnDeclarationSql( string $name, array $field )

Obtain DBMS specific SQL code portion needed to declare a generic type field to be used in statements like CREATE TABLE.

public string
# getDecimalTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares a floating point column of arbitrary precision.

public
# getFloatTypeDeclarationSql( array $fieldDeclaration )
abstract public string
# getBooleanTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares a boolean column.

abstract public string
# getIntegerTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares a 4 byte integer column.

abstract public string
# getBigIntTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares an 8 byte integer column.

abstract public string
# getSmallIntTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares a 2 byte integer column.

abstract protected string
# _getCommonIntegerTypeDeclarationSql( array $columnDef )

Gets the SQL snippet that declares common properties of an integer column.

public string
# getDefaultValueDeclarationSql( array $field )

Obtain DBMS specific SQL code portion needed to set a default value declaration to be used in statements like CREATE TABLE.

public string
# getCheckDeclarationSql( array $definition )

Obtain DBMS specific SQL code portion needed to set a CHECK constraint declaration to be used in statements like CREATE TABLE.

public string
# getIndexDeclarationSql( string $name, array $definition )

Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.

public string
# getIndexFieldDeclarationListSql( array $fields )

getIndexFieldDeclarationList Obtain DBMS specific SQL code portion needed to set an index declaration to be used in statements like CREATE TABLE.

public string
# getTemporaryTableSql( )

A method to return the required SQL string that fits between CREATE ... TABLE to create the table as a temporary table.

public unknown
# getShowDatabasesSql( )

Get sql query to show a list of database

public string
# getForeignKeyDeclarationSql( array $definition )

getForeignKeyDeclaration Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.

public string
# getAdvancedForeignKeyOptionsSql( array $definition )

Return the FOREIGN KEY query section dealing with non-standard options as MATCH, INITIALLY DEFERRED, ON UPDATE, ...

public
# getForeignKeyReferentialActionSql( string $action )

returns given referential action in uppercase if valid, otherwise throws an exception

public string
# getForeignKeyBaseDeclarationSql( array $definition )

Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint of a field declaration to be used in statements like CREATE TABLE.

public string
# getUniqueFieldDeclarationSql( )

Obtain DBMS specific SQL code portion needed to set the UNIQUE constraint of a field declaration to be used in statements like CREATE TABLE.

public string
# getColumnCharsetDeclarationSql( string $charset )

Obtain DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration to be used in statements like CREATE TABLE.

public string
# getColumnCollationDeclarationSql( string $collation )

Obtain DBMS specific SQL code portion needed to set the COLLATION of a field declaration to be used in statements like CREATE TABLE.

public string
# getMatchPatternExpression( array $pattern, string $operator = null, string $field = null )

build a pattern matching string

public boolean
# prefersSequences( )

Whether the platform prefers sequences for ID generation. Subclasses should override this method to return TRUE if they prefer sequences.

public boolean
# prefersIdentityColumns( )

Whether the platform prefers identity columns (eg. autoincrement) for ID generation. Subclasses should override this method to return TRUE if they prefer identity columns.

public
# writeLimitClause( string $query, mixed $limit = false, mixed $offset = false )

Adds a LIMIT/OFFSET clause to the query. This default implementation writes the syntax "LIMIT x OFFSET y" to the query which is supported by MySql, PostgreSql and Sqlite. Any database platforms that do not support this syntax should override this implementation and provide their own.

public
# convertBooleans( array $item )

Some platforms need the boolean values to be converted. Default conversion defined here converts to integers.

public string
# getSetCharsetSql( string $charset )

Gets the SQL statement specific for the platform to set the charset.

public string
# getCurrentDateSql( )

Gets the SQL specific for the platform to get the current date.

public string
# getCurrentTimeSql( )

Gets the SQL specific for the platform to get the current time.

public string
# getCurrentTimestampSql( )

Gets the SQL specific for the platform to get the current timestamp

protected
# _getTransactionIsolationLevelSql( integer $level )

Get sql for transaction isolation level Connection constant

public
public
public
# getListTriggersSql( mixed $table = null )
public
# getListSequencesSql( mixed $database )
public
# getListTableConstraintsSql( mixed $table )
public
# getListTableColumnsSql( mixed $table )
public
public
public
public
# getListTableIndexesSql( mixed $table )
public
# getListTableForeignKeysSql( mixed $table )
public
# getCreateViewSql( mixed $name, mixed $sql )
public
# getDropViewSql( mixed $name )
public
# getDropSequenceSql( mixed $sequenceName )
public
# getSequenceNextValSql( mixed $sequenceName )
public
# getCreateDatabaseSql( mixed $database )
public
# getSetTransactionIsolationSql( integer $level )

Get sql to set the transaction isolation level

public string
# getCharsetFieldDeclaration( string $charset )

Obtain DBMS specific SQL code portion needed to set the CHARACTER SET of a field declaration to be used in statements like CREATE TABLE.

public string
# getDateTimeTypeDeclarationSql( array $fieldDeclaration )

Obtain DBMS specific SQL to be used to create datetime fields in statements like CREATE TABLE

public string
# getDateTypeDeclarationSql( array $fieldDeclaration )

Obtain DBMS specific SQL to be used to create date fields in statements like CREATE TABLE.

public integer
# getDefaultTransactionIsolationLevel( )

Gets the default transaction isolation level of the platform.

public boolean
# supportsSequences( )

Whether the platform supports sequences.

public boolean
# supportsIdentityColumns( )

Whether the platform supports identity columns. Identity columns are columns that recieve an auto-generated value from the database on insert of a row.

public boolean
# supportsIndexes( )

Whether the platform supports indexes.

public boolean
# supportsTransactions( )

Whether the platform supports transactions.

public boolean
# supportsSavepoints( )

Whether the platform supports savepoints.

public boolean
# supportsPrimaryConstraints( )

Whether the platform supports primary key constraints.

public boolean
# supportsForeignKeyConstraints( )

Whether the platform supports foreign key constraints.

public boolean
# supportsSchemas( )

Whether the platform supports database schemas.

public boolean
# supportsGettingAffectedRows( )

Whether the platform supports getting the affected rows of a recent update/delete type query.

public
public string
# getDateTimeFormatString( )

Gets the format string, as accepted by the date() function, that describes the format of a stored datetime value of this platform.

public string
# getDateFormatString( )

Gets the format string, as accepted by the date() function, that describes the format of a stored date value of this platform.

public string
# getTimeFormatString( )

Gets the format string, as accepted by the date() function, that describes the format of a stored time value of this platform.

public
# modifyLimitQuery( mixed $query, mixed $limit, mixed $offset = null )
abstract public
# getVarcharTypeDeclarationSql( array $field )

Gets the SQL snippet used to declare a VARCHAR column type.

abstract public
# getClobTypeDeclarationSql( array $field )

Gets the SQL snippet used to declare a CLOB column type.

abstract public string
# getName( )

Gets the name of the platform.

public string
# getSqlResultCasing( string $column )

Gets the character casing of a column in an SQL result set of this platform.

public string
# fixSchemaElementName( string $schemaElementName )

Makes any fixes to a name of a schema element (table, sequence, ...) that are required by restrictions of the platform, like a maximum length.

public string
# getEmptyIdentityInsertSql( string $tableName, string $identifierColumnName )

Get the insert sql for an empty insert statement