Methods summary
public
|
#
__construct( )
Creates a new MySqlPlatform instance.
Creates a new MySqlPlatform instance.
Overrides
|
public
string
|
#
getIdentifierQuoteCharacter( )
Gets the character used for identifier quoting.
Gets the character used for identifier quoting.
Returns
string
Override
Overrides
|
public
string
|
#
getRegexpExpression( )
Returns the regular expression operator.
Returns the regular expression operator.
Returns
string
Override
Overrides
|
public
string
|
#
getRandomExpression( )
return string to call a function to get random value inside an SQL statement
return string to call a function to get random value inside an SQL statement
Returns
string to generate float between 0 and 1
|
public
string
|
#
getMatchPatternExpression( array $pattern, string $operator = null, string $field = null )
Builds a pattern matching string.
Builds a pattern matching string.
EXPERIMENTAL
WARNING: this function is experimental and may change signature at
any time until labelled as non-experimental.
Parameters
- $pattern
- even keys are strings, odd are patterns (% and _)
- $operator
- optional pattern operator (LIKE, ILIKE and maybe others in the future)
- $field
optional field name that is being matched against
(might be required when emulating ILIKE)
Returns
string SQL pattern
Override
Overrides
|
public
string
|
#
getGuidExpression( )
Returns global unique identifier
Returns global unique identifier
Returns
string to get global unique identifier
Override
|
public
string
|
#
getConcatExpression( )
Returns a series of strings concatinated
Returns a series of strings concatinated
concat() accepts an arbitrary number of parameters. Each parameter
must contain an expression or an array with expressions.
Returns
string
Override
Overrides
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getVarcharTypeDeclarationSql( array $field )
Gets the SQL snippet used to declare a VARCHAR column on the MySql platform.
Gets the SQL snippet used to declare a VARCHAR column on the MySql platform.
Parameters
Params
array $field
|
public
|
|
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.
Obtain DBMS specific SQL code portion needed to set the CHARACTER SET
of a field declaration to be used in statements like CREATE TABLE.
Parameters
- $charset
- name of the charset
Returns
string DBMS specific SQL code portion needed to set the CHARACTER SET
of a field declaration.
Overrides
|
public
string
|
|
public
string
|
|
public
string
|
|
public
string
|
#
getCollationFieldDeclaration( 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.
Obtain DBMS specific SQL code portion needed to set the COLLATION
of a field declaration to be used in statements like CREATE TABLE.
Parameters
- $collation
- name of the collation
Returns
string DBMS specific SQL code portion needed to set the COLLATION
of a field declaration.
|
public
boolean
|
#
prefersIdentityColumns( )
Whether the platform prefers identity columns for ID generation.
MySql prefers "autoincrement" identity columns since sequences can only
be emulated with a table.
Whether the platform prefers identity columns for ID generation.
MySql prefers "autoincrement" identity columns since sequences can only
be emulated with a table.
Returns
boolean
Override
Overrides
|
public
boolean
|
#
supportsIdentityColumns( )
Whether the platform supports identity columns.
MySql supports this through AUTO_INCREMENT columns.
Whether the platform supports identity columns.
MySql supports this through AUTO_INCREMENT columns.
Returns
boolean
Override
Overrides
|
public
boolean
|
#
supportsSavepoints( )
Whether the platform supports savepoints. MySql does not.
Whether the platform supports savepoints. MySql does not.
Returns
boolean
Override
Overrides
|
public
unknown
|
#
getShowDatabasesSql( )
Get sql query to show a list of database
Get sql query to show a list of database
Returns
unknown
Overrides
|
public
|
|
public
|
|
public
string
|
#
getCreateDatabaseSql( string $name )
create a new database
Parameters
- $name
- name of the database that should be created
Returns
string
Override
Overrides
|
public
string
|
#
getDropDatabaseSql( string $name )
drop an existing database
drop an existing database
Parameters
- $name
- name of the database that should be dropped
Returns
string
Override
Overrides
|
public
|
#
getCreateTableSql( string $name, array $fields, array $options = array() )
create a new table
Parameters
- $name
- Name of the database that should be created
- $fields
Associative array that contains the definition of each field of the new table
The indexes of the array entries are the names of the fields of the table an
the array entry values are associative arrays like those that are meant to be
passed with the field definitions to get[Type]Declaration() functions.
array(
'id' => array(
'type' => 'integer',
'unsigned' => 1
'notnull' => 1
'default' => 0
),
'name' => array(
'type' => 'text',
'length' => 12
),
'password' => array(
'type' => 'text',
'length' => 12
)
);
- $options
An associative array of table options:
array(
'comment' => 'Foo',
'charset' => 'utf8',
'collate' => 'utf8_unicode_ci',
'type' => 'innodb',
);
Override
Overrides
|
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.
Obtain DBMS specific SQL code portion needed to declare a generic type
field to be used in statements like CREATE TABLE.
Parameters
- $name
- name the field to be declared.
- $field
associative array with the name of the properties
of the field being declared as array indexes. Currently, the types
of supported field properties are as follows:
length
Integer value that determines the maximum length of the text
field. If this argument is missing the field should be
declared to have the longest length allowed by the DBMS.
default
Text value to be used as default for this field.
notnull
Boolean flag that indicates whether this field is constrained
to not be set to null.
charset
Text value with the default CHARACTER SET for this field.
collation
Text value with the default COLLATION for this field.
unique
unique constraint
check
column check constraint
Returns
string DBMS specific SQL code portion that should be used to declare the column.
Overrides
|
public
boolean
|
#
getAlterTableSql( string $name, array $changes, boolean $check = false )
Gets the SQL to alter an existing table.
Gets the SQL to alter an existing table.
Parameters
- $name
- The name of the table that is intended to be changed.
- $changes
Associative array that contains the details of each type
of change that is intended to be performed. The types of
changes that are currently supported are defined as follows:
name
New name for the table.
add
Associative array with the names of fields to be added as
indexes of the array. The value of each entry of the array
should be set to another associative array with the properties
of the fields to be added. The properties of the fields should
be the same as defined by the Metabase parser.
remove
Associative array with the names of fields to be removed as indexes
of the array. Currently the values assigned to each entry are ignored.
An empty array should be used for future compatibility.
rename
Associative array with the names of fields to be renamed as indexes
of the array. The value of each entry of the array should be set to
another associative array with the entry named name with the new
field name and the entry named Declaration that is expected to contain
the portion of the field declaration already in DBMS specific SQL code
as it is used in the CREATE TABLE statement.
change
Associative array with the names of the fields to be changed as indexes
of the array. Keep in mind that if it is intended to change either the
name of a field and any other properties, the change array entries
should have the new names of the fields as array indexes.
The value of each entry of the array should be set to another associative
array with the properties of the fields to that are meant to be changed as
array entries. These entries should be assigned to the new values of the
respective properties. The properties of the fields should be the same
as defined by the Metabase parser.
Example
array(
'name' => 'userlist',
'add' => array(
'quota' => array(
'type' => 'integer',
'unsigned' => 1
)
),
'remove' => array(
'file_limit' => array(),
'time_limit' => array()
),
'change' => array(
'name' => array(
'length' => '20',
'definition' => array(
'type' => 'text',
'length' => 20,
),
)
),
'rename' => array(
'sex' => array(
'name' => 'gender',
'definition' => array(
'type' => 'text',
'length' => 1,
'default' => 'M',
),
)
)
)
- $check
indicates whether the function should just check if the DBMS driver
can perform the requested table alterations if the value is true or
actually perform them otherwise.
Returns
boolean
Override
Overrides
|
public
string
|
#
getIntegerTypeDeclarationSql( array $field, string $field,… )
Obtain DBMS specific SQL code portion needed to declare an integer type
field to be used in statements like CREATE TABLE.
Obtain DBMS specific SQL code portion needed to declare an integer type
field to be used in statements like CREATE TABLE.
Parameters
- $field
- $name name the field to be declared.
- $field,…
associative array with the name of the properties
of the field being declared as array indexes.
Currently, the types of supported field
properties are as follows:
unsigned
Boolean flag that indicates whether the field
should be declared as unsigned integer if
possible.
default
Integer value to be used as default for this
field.
notnull
Boolean flag that indicates whether this field is
constrained to not be set to null.
Returns
string DBMS specific SQL code portion that should be used to
declare the specified field.
Override
|
public
string
|
|
public
string
|
|
protected
string
|
|
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.
Obtain DBMS specific SQL code portion needed to set an index
declaration to be used in statements like CREATE TABLE.
Parameters
- $name
- $charset name of the index
- $definition
- index definition
Returns
string DBMS specific SQL code portion needed to set an index
Override
Pacthed
by PHPBoost
Overrides
|
public
string
|
#
getIndexFieldDeclarationListSql( array $fields )
Obtain DBMS specific SQL code portion needed to set an index
declaration to be used in statements like CREATE TABLE.
Obtain DBMS specific SQL code portion needed to set an index
declaration to be used in statements like CREATE TABLE.
Returns
string
Override
Overrides
|
public
string
|
#
getAdvancedForeignKeyOptionsSql( array $definition )
Return the FOREIGN KEY query section dealing with non-standard options
as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
Return the FOREIGN KEY query section dealing with non-standard options
as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
Parameters
Returns
string
Override
Overrides
|
public
|
#
getDropIndexSql( string $table, string $name )
Gets the SQL to drop an index of a table.
Gets the SQL to drop an index of a table.
Parameters
- $table
- name of table that should be used in method
- $name
- name of the index to be dropped
Override
Overrides
|
public
|
#
getDropTableSql( string $table )
Gets the SQL to drop a table.
Gets the SQL to drop a table.
Parameters
- $table
- The name of table to drop.
Override
Overrides
|
public
|
#
getSetTransactionIsolationSql( integer $level )
Get sql to set the transaction isolation level
Get sql to set the transaction isolation level
Parameters
Overrides
|
public
string
|
#
getName( )
Get the platform name for this instance.
Get the platform name for this instance.
Returns
string
|