TYPO3  7.6
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
AbstractSpecifics Class Reference
Inheritance diagram for AbstractSpecifics:
NullSpecifics Oci8Specifics PostgresSpecifics

Public Member Functions

 __construct ()
 
 specificExists ($specific)
 
 getSpecific ($specific)
 
 splitMaxExpressions ($expressionList, $preserveArrayKeys=false)
 
 truncateIdentifier ($identifier, $specific)
 
 transformQueryParts (&$select_fields, &$from_table, &$where_clause, &$groupBy= '', &$orderBy= '', &$limit= '')
 
 transformFieldRowToMySQL ($fieldRow, $metaType)
 
 getNativeFieldType ($metaType)
 
 getMetaFieldType ($nativeType)
 
 getNativeFieldLength ($mysqlType, $maxLength)
 

Public Attributes

const TABLE_MAXLENGTH = 'table_maxlength'
 
const FIELD_MAXLENGTH = 'field_maxlength'
 
const LIST_MAXEXPRESSIONS = 'list_maxexpressions'
 
const PARTIAL_STRING_INDEX = 'partial_string_index'
 
const CAST_FIND_IN_SET = 'cast_find_in_set'
 

Protected Member Functions

 getNativeNotNull ($notNull)
 
 getNativeDefaultValue ($fieldDefinition)
 
 getNativeKeyForField ($fieldRow)
 
 getNativeExtraFieldAttributes ($fieldRow)
 

Protected Attributes

 $specificProperties = array()
 
 $nativeToMetaFieldTypeMap
 
 $nativeToMetaFieldTypeOverrides = array()
 
 $metaToNativeFieldTypeMap
 
 $metaToNativeFieldTypeOverrides = array()
 

Detailed Description

This class handles the specifics of the active DBMS. Inheriting classes are intended to define their own specifics.

Definition at line 21 of file AbstractSpecifics.php.

Constructor & Destructor Documentation

__construct ( )

Constructor

Definition at line 114 of file AbstractSpecifics.php.

Member Function Documentation

getMetaFieldType (   $nativeType)

Return MetaType for native MySQL field type

Parameters
string$nativeTypenative type as reported as in mysqldump files
Returns
string Meta type (currently ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)

Definition at line 237 of file AbstractSpecifics.php.

getNativeDefaultValue (   $fieldDefinition)
protected

Return the default value of a field formatted to match the native MySQL SQL dialect

Parameters
array$fieldDefinition
Returns
mixed

Definition at line 280 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getNativeExtraFieldAttributes (   $fieldRow)
protected

Return the MySQL native extra field information - https://dev.mysql.com/doc/refman/5.5/en/show-columns.html auto_increment for columns that have the AUTO_INCREMENT attribute on update CURRENT_TIMESTAMP for TIMESTAMP columns that have the ON UPDATE CURRENT_TIMESTAMP attribute.

Parameters
array$fieldRow
Returns
string

Definition at line 309 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getNativeFieldLength (   $mysqlType,
  $maxLength 
)

Determine the native field length information for a table field.

Parameters
string$mysqlType
int$maxLength
Returns
string

Definition at line 250 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getNativeFieldType (   $metaType)

Return actual MySQL type for meta field type

Parameters
string$metaTypeMeta type (currenly ADOdb syntax only, http://phplens.com/lens/adodb/docs-adodb.htm#metatype)
Returns
string Native type as reported as in mysqldump files, uppercase

Definition at line 225 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getNativeKeyForField (   $fieldRow)
protected

Return the MySQL native key type indicator - https://dev.mysql.com/doc/refman/5.5/en/show-columns.html PRI - the column is a PRIMARY KEY or is one of the columns in a multiple-column PRIMARY KEY UNI - the column is the first column of a UNIQUE index MUL - the column is the first column of a nonunique index If more than one of the values applies return the one with the highest priority, in the order PRI, UNI, MUL If none applies return empty value.

Parameters
array$fieldRow
Returns
string

Definition at line 296 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getNativeNotNull (   $notNull)
protected

Return the MySQL native representation of the NOT NULL setting

Parameters
mixed$notNull
Returns
string

Definition at line 269 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\transformFieldRowToMySQL().

getSpecific (   $specific)

Gets the specific value.

Parameters
string$specific
Returns
mixed

Definition at line 137 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\splitMaxExpressions(), and AbstractSpecifics\truncateIdentifier().

specificExists (   $specific)

Checks if a specific is defined for the used DBMS.

Parameters
string$specific
Returns
bool

Definition at line 126 of file AbstractSpecifics.php.

Referenced by AbstractSpecifics\splitMaxExpressions(), and AbstractSpecifics\truncateIdentifier().

splitMaxExpressions (   $expressionList,
  $preserveArrayKeys = false 
)

Splits $expressionList into multiple chunks.

Parameters
array$expressionList
bool$preserveArrayKeysIf TRUE, array keys are preserved in array_chunk()
Returns
array

Definition at line 149 of file AbstractSpecifics.php.

References AbstractSpecifics\getSpecific(), and AbstractSpecifics\specificExists().

transformFieldRowToMySQL (   $fieldRow,
  $metaType 
)

Transforms a database specific representation of field information and translates it as close as possible to the MySQL standard.

Parameters
array$fieldRow
string$metaType
Returns
array

Definition at line 204 of file AbstractSpecifics.php.

References AbstractSpecifics\getNativeDefaultValue(), AbstractSpecifics\getNativeExtraFieldAttributes(), AbstractSpecifics\getNativeFieldLength(), AbstractSpecifics\getNativeFieldType(), AbstractSpecifics\getNativeKeyForField(), and AbstractSpecifics\getNativeNotNull().

transformQueryParts ( $select_fields,
$from_table,
$where_clause,
$groupBy = '',
$orderBy = '',
$limit = '' 
)

Adjust query parts for DBMS

Parameters
string$select_fields
string$from_table
string$where_clause
string$groupBy
string$orderBy
string$limit
Returns
void

Definition at line 192 of file AbstractSpecifics.php.

truncateIdentifier (   $identifier,
  $specific 
)

Truncates the name of the identifier. Based on TYPO3.FLOWs' FlowAnnotationDriver::truncateIdentifier()

Parameters
string$identifier
string$specific
Returns
string

Definition at line 166 of file AbstractSpecifics.php.

References AbstractSpecifics\getSpecific(), and AbstractSpecifics\specificExists().

Member Data Documentation

$metaToNativeFieldTypeMap
protected
Initial value:
= array(
'C' => 'VARCHAR',
'C2' => 'VARCHAR',
'X' => 'LONGTEXT',
'XL' => 'LONGTEXT',
'X2' => 'LONGTEXT',
'B' => 'LONGBLOB',
'D' => 'DATE',
'T' => 'DATETIME',
'L' => 'TINYINT',
'I' => 'BIGINT',
'I1' => 'BIGINT',
'I2' => 'BIGINT',
'I4' => 'BIGINT',
'I8' => 'BIGINT',
'F' => 'DOUBLE',
'N' => 'NUMERIC'
)

Definition at line 85 of file AbstractSpecifics.php.

$metaToNativeFieldTypeOverrides = array()
protected

Definition at line 109 of file AbstractSpecifics.php.

$nativeToMetaFieldTypeMap
protected
Initial value:
= array(
'STRING' => 'C',
'CHAR' => 'C',
'VARCHAR' => 'C',
'TINYBLOB' => 'C',
'TINYTEXT' => 'C',
'ENUM' => 'C',
'SET' => 'C',
'TEXT' => 'XL',
'LONGTEXT' => 'XL',
'MEDIUMTEXT' => 'XL',
'IMAGE' => 'B',
'LONGBLOB' => 'B',
'BLOB' => 'B',
'MEDIUMBLOB' => 'B',
'YEAR' => 'D',
'DATE' => 'D',
'TIME' => 'T',
'DATETIME' => 'T',
'TIMESTAMP' => 'T',
'FLOAT' => 'F',
'DOUBLE' => 'F',
'INT' => 'I8',
'INTEGER' => 'I8',
'TINYINT' => 'I8',
'SMALLINT' => 'I8',
'MEDIUMINT' => 'I8',
'BIGINT' => 'I8',
)

Definition at line 45 of file AbstractSpecifics.php.

$nativeToMetaFieldTypeOverrides = array()
protected

Contains the DBMS specific mapping overrides for native MySQL to ADOdb meta field types

Definition at line 78 of file AbstractSpecifics.php.

$specificProperties = array()
protected

Definition at line 38 of file AbstractSpecifics.php.

const CAST_FIND_IN_SET = 'cast_find_in_set'

Definition at line 30 of file AbstractSpecifics.php.

const FIELD_MAXLENGTH = 'field_maxlength'

Definition at line 27 of file AbstractSpecifics.php.

const LIST_MAXEXPRESSIONS = 'list_maxexpressions'

Definition at line 28 of file AbstractSpecifics.php.

const PARTIAL_STRING_INDEX = 'partial_string_index'

Definition at line 29 of file AbstractSpecifics.php.

Referenced by Adodb\compileCREATEINDEX().

const TABLE_MAXLENGTH = 'table_maxlength'

Constants used as identifiers in $specificProperties.

Definition at line 26 of file AbstractSpecifics.php.