PHP Class Spot\Adapter\Mysql

Inheritance: extends Spot\Adapter\PDO\BaseAbstract, implements Spot\Adapter\AdapterInterface
显示文件 Open project: vlucas/spot

Protected Properties

Property Type Description
$_charset
$_collate
$_engine Driver-Specific settings
$_fieldTypeMap @todo Have to improve this to allow custom types, callbacks, and validation
$_format_date Format for date columns, formatted for PHP's date() function
$_format_datetime
$_format_time

Public Methods

Method Description
characterSet ( $charset, $collate = 'utf8_unicode_ci' ) Set character set and MySQL collate string
engine ( $engine = null ) Set database engine (InnoDB, MyISAM, etc)
escapeField ( $field ) Escape/quote direct user input
formatMigrateOptions ( array $options ) Ensure migration options are full and have all keys required
migrateSyntaxFieldCreate ( string $fieldName, array $fieldInfo ) : string Syntax for each column in CREATE TABLE command
migrateSyntaxFieldUpdate ( string $fieldName, array $fieldInfo, $add = false ) : string Syntax for each column in CREATE TABLE command
migrateSyntaxTableCreate ( string $table, array $formattedFields, array $columnsSyntax, array $options ) : string Syntax for CREATE TABLE with given fields and column syntax
migrateSyntaxTableUpdate ( string $table, array $formattedFields, array $columnsSyntax, array $options ) : string Syntax for ALTER TABLE with given fields and column syntax

Protected Methods

Method Description
getColumnsForTable ( String $table, $source ) : Array Get columns for current table

Method Details

characterSet() public method

Set character set and MySQL collate string
public characterSet ( $charset, $collate = 'utf8_unicode_ci' )

engine() public method

Set database engine (InnoDB, MyISAM, etc)
public engine ( $engine = null )

escapeField() public method

Escape/quote direct user input
public escapeField ( $field )

formatMigrateOptions() public method

Ensure migration options are full and have all keys required
public formatMigrateOptions ( array $options )
$options array

getColumnsForTable() protected method

Get columns for current table
protected getColumnsForTable ( String $table, $source ) : Array
$table String Table name
return Array

migrateSyntaxFieldCreate() public method

Syntax for each column in CREATE TABLE command
public migrateSyntaxFieldCreate ( string $fieldName, array $fieldInfo ) : string
$fieldName string Field name
$fieldInfo array Array of field settings
return string SQL syntax

migrateSyntaxFieldUpdate() public method

Syntax for each column in CREATE TABLE command
public migrateSyntaxFieldUpdate ( string $fieldName, array $fieldInfo, $add = false ) : string
$fieldName string Field name
$fieldInfo array Array of field settings
return string SQL syntax

migrateSyntaxTableCreate() public method

Syntax for CREATE TABLE with given fields and column syntax
public migrateSyntaxTableCreate ( string $table, array $formattedFields, array $columnsSyntax, array $options ) : string
$table string Table name
$formattedFields array Array of fields with all settings
$columnsSyntax array Array of SQL syntax of columns produced by 'migrateSyntaxFieldCreate' function
$options array Options that may affect migrations or how tables are setup
return string SQL syntax

migrateSyntaxTableUpdate() public method

Syntax for ALTER TABLE with given fields and column syntax
public migrateSyntaxTableUpdate ( string $table, array $formattedFields, array $columnsSyntax, array $options ) : string
$table string Table name
$formattedFields array Array of fields with all settings
$columnsSyntax array Array of SQL syntax of columns produced by 'migrateSyntaxFieldUpdate' function
$options array
return string SQL syntax

Property Details

$_charset protected_oe property

protected $_charset

$_collate protected_oe property

protected $_collate

$_engine protected_oe property

Driver-Specific settings
protected $_engine

$_fieldTypeMap protected_oe property

@todo Have to improve this to allow custom types, callbacks, and validation
protected $_fieldTypeMap

$_format_date protected_oe property

Format for date columns, formatted for PHP's date() function
protected $_format_date

$_format_datetime protected_oe property

protected $_format_datetime

$_format_time protected_oe property

protected $_format_time