Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
|
Public Member Functions | |
beginTransaction () | |
commit () | |
rollBack () | |
newTable ($tableName=null, $schemaName=null) | |
createTable (Table $table) | |
dropTable ($tableName, $schemaName=null) | |
createTemporaryTable (Table $table) | |
createTemporaryTableLike ($temporaryTableName, $originTableName, $ifNotExists=false) | |
dropTemporaryTable ($tableName, $schemaName=null) | |
renameTablesBatch (array $tablePairs) | |
truncateTable ($tableName, $schemaName=null) | |
isTableExists ($tableName, $schemaName=null) | |
showTableStatus ($tableName, $schemaName=null) | |
describeTable ($tableName, $schemaName=null) | |
createTableByDdl ($tableName, $newTableName) | |
modifyColumnByDdl ($tableName, $columnName, $definition, $flushData=false, $schemaName=null) | |
renameTable ($oldTableName, $newTableName, $schemaName=null) | |
addColumn ($tableName, $columnName, $definition, $schemaName=null) | |
changeColumn ( $tableName, $oldColumnName, $newColumnName, $definition, $flushData=false, $schemaName=null) | |
modifyColumn ($tableName, $columnName, $definition, $flushData=false, $schemaName=null) | |
dropColumn ($tableName, $columnName, $schemaName=null) | |
tableColumnExists ($tableName, $columnName, $schemaName=null) | |
addIndex ($tableName, $indexName, $fields, $indexType=self::INDEX_TYPE_INDEX, $schemaName=null) | |
dropIndex ($tableName, $keyName, $schemaName=null) | |
getIndexList ($tableName, $schemaName=null) | |
addForeignKey ( $fkName, $tableName, $columnName, $refTableName, $refColumnName, $onDelete=self::FK_ACTION_CASCADE, $purge=false, $schemaName=null, $refSchemaName=null) | |
dropForeignKey ($tableName, $fkName, $schemaName=null) | |
getForeignKeys ($tableName, $schemaName=null) | |
select () | |
insertOnDuplicate ($table, array $data, array $fields=[]) | |
insertMultiple ($table, array $data) | |
insertArray ($table, array $columns, array $data) | |
insert ($table, array $bind) | |
insertForce ($table, array $bind) | |
update ($table, array $bind, $where='') | |
delete ($table, $where='') | |
query ($sql, $bind=[]) | |
fetchAll ($sql, $bind=[], $fetchMode=null) | |
fetchRow ($sql, $bind=[], $fetchMode=null) | |
fetchAssoc ($sql, $bind=[]) | |
fetchCol ($sql, $bind=[]) | |
fetchPairs ($sql, $bind=[]) | |
fetchOne ($sql, $bind=[]) | |
quote ($value, $type=null) | |
quoteInto ($text, $value, $type=null, $count=null) | |
quoteIdentifier ($ident, $auto=false) | |
quoteColumnAs ($ident, $alias, $auto=false) | |
quoteTableAs ($ident, $alias=null, $auto=false) | |
formatDate ($date, $includeTime=true) | |
startSetup () | |
endSetup () | |
setCacheAdapter (\Magento\Framework\Cache\FrontendInterface $cacheAdapter) | |
allowDdlCache () | |
disallowDdlCache () | |
resetDdlCache ($tableName=null, $schemaName=null) | |
saveDdlCache ($tableCacheKey, $ddlType, $data) | |
loadDdlCache ($tableCacheKey, $ddlType) | |
prepareSqlCondition ($fieldName, $condition) | |
prepareColumnValue (array $column, $value) | |
getCheckSql ($condition, $true, $false) | |
getIfNullSql ($expression, $value=0) | |
getConcatSql (array $data, $separator=null) | |
getLengthSql ($string) | |
getLeastSql (array $data) | |
getGreatestSql (array $data) | |
getDateAddSql ($date, $interval, $unit) | |
getDateSubSql ($date, $interval, $unit) | |
getDateFormatSql ($date, $format) | |
getDatePartSql ($date) | |
getSubstringSql ($stringExpression, $pos, $len=null) | |
getStandardDeviationSql ($expressionField) | |
getDateExtractSql ($date, $unit) | |
getTableName ($tableName) | |
getTriggerName ($tableName, $time, $event) | |
getIndexName ($tableName, $fields, $indexType='') | |
getForeignKeyName ($priTableName, $priColumnName, $refTableName, $refColumnName) | |
disableTableKeys ($tableName, $schemaName=null) | |
enableTableKeys ($tableName, $schemaName=null) | |
insertFromSelect (\Magento\Framework\DB\Select $select, $table, array $fields=[], $mode=false) | |
selectsByRange ($rangeField, \Magento\Framework\DB\Select $select, $stepCount=100) | |
updateFromSelect (\Magento\Framework\DB\Select $select, $table) | |
deleteFromSelect (\Magento\Framework\DB\Select $select, $table) | |
getTablesChecksum ($tableNames, $schemaName=null) | |
supportStraightJoin () | |
orderRand (\Magento\Framework\DB\Select $select, $field=null) | |
forUpdate ($sql) | |
getPrimaryKeyName ($tableName, $schemaName=null) | |
decodeVarbinary ($value) | |
getTransactionLevel () | |
createTrigger (\Magento\Framework\DB\Ddl\Trigger $trigger) | |
dropTrigger ($triggerName, $schemaName=null) | |
getTables ($likeCondition=null) | |
getCaseSql ($valueName, $casesResults, $defaultValue=null) | |
getAutoIncrementField ($tableName, $schemaName=null) | |
Data Fields | |
const | INDEX_TYPE_PRIMARY = 'primary' |
const | INDEX_TYPE_UNIQUE = 'unique' |
const | INDEX_TYPE_INDEX = 'index' |
const | INDEX_TYPE_FULLTEXT = 'fulltext' |
const | FK_ACTION_CASCADE = 'CASCADE' |
const | FK_ACTION_SET_NULL = 'SET NULL' |
const | FK_ACTION_NO_ACTION = 'NO ACTION' |
const | FK_ACTION_RESTRICT = 'RESTRICT' |
const | FK_ACTION_SET_DEFAULT = 'SET DEFAULT' |
const | INSERT_ON_DUPLICATE = 1 |
const | INSERT_IGNORE = 2 |
const | REPLACE = 4 |
const | ISO_DATE_FORMAT = 'yyyy-MM-dd' |
const | ISO_DATETIME_FORMAT = 'yyyy-MM-dd HH-mm-ss' |
const | INTERVAL_SECOND = 'SECOND' |
const | INTERVAL_MINUTE = 'MINUTES' |
const | INTERVAL_HOUR = 'HOURS' |
const | INTERVAL_DAY = 'DAYS' |
const | INTERVAL_MONTH = 'MONTHS' |
const | INTERVAL_YEAR = 'YEARS' |
const | ERROR_DDL_MESSAGE = 'DDL statements are not allowed in transactions' |
const | ERROR_ROLLBACK_INCOMPLETE_MESSAGE = 'Rolled back transaction has not been completed correctly.' |
const | ERROR_ASYMMETRIC_ROLLBACK_MESSAGE = 'Asymmetric transaction rollback.' |
const | ERROR_ASYMMETRIC_COMMIT_MESSAGE = 'Asymmetric transaction commit.' |
Magento Database Adapter Interface
@api
Definition at line 16 of file AdapterInterface.php.
addColumn | ( | $tableName, | |
$columnName, | |||
$definition, | |||
$schemaName = null |
|||
) |
Adds new column to the table.
Generally $defintion must be array with column data to keep this call cross-DB compatible. Using string as $definition is allowed only for concrete DB adapter.
string | $tableName | |
string | $columnName | |
array | string | $definition | string specific or universal array DB Server definition |
string | $schemaName |
Implemented in Mysql.
addForeignKey | ( | $fkName, | |
$tableName, | |||
$columnName, | |||
$refTableName, | |||
$refColumnName, | |||
$onDelete = self::FK_ACTION_CASCADE , |
|||
$purge = false , |
|||
$schemaName = null , |
|||
$refSchemaName = null |
|||
) |
Add new Foreign Key to table If Foreign Key with same name is exist - it will be deleted
string | $fkName | |
string | $tableName | |
string | $columnName | |
string | $refTableName | |
string | $refColumnName | |
string | $onDelete | |
string | $onUpdate | |
boolean | $purge | trying remove invalid data |
string | $schemaName | |
string | $refSchemaName |
@SuppressWarnings(PHPMD.ExcessiveParameterList)
Implemented in Mysql.
addIndex | ( | $tableName, | |
$indexName, | |||
$fields, | |||
$indexType = self::INDEX_TYPE_INDEX , |
|||
$schemaName = null |
|||
) |
Add new index to table name
string | $tableName | |
string | $indexName | |
string | array | $fields | the table column name or array of ones |
string | $indexType | the index type |
string | $schemaName |
Implemented in Mysql.
allowDdlCache | ( | ) |
beginTransaction | ( | ) |
changeColumn | ( | $tableName, | |
$oldColumnName, | |||
$newColumnName, | |||
$definition, | |||
$flushData = false , |
|||
$schemaName = null |
|||
) |
Change the column name and definition
For change definition of column - use modifyColumn
string | $tableName | |
string | $oldColumnName | |
string | $newColumnName | |
array | string | $definition | |
boolean | $flushData | flush table statistic |
string | $schemaName |
Implemented in Mysql.
commit | ( | ) |
createTable | ( | Table | $table | ) |
createTableByDdl | ( | $tableName, | |
$newTableName | |||
) |
Create \Magento\Framework\DB\Ddl\Table object by data from describe table
string | $tableName | |
string | $newTableName |
Implemented in Mysql.
createTemporaryTable | ( | Table | $table | ) |
Create temporary table from DDL object
Table | $table |
createTemporaryTableLike | ( | $temporaryTableName, | |
$originTableName, | |||
$ifNotExists = false |
|||
) |
Create temporary table from other table
string | $temporaryTableName | |
string | $originTableName | |
bool | $ifNotExists |
Implemented in Mysql.
createTrigger | ( | \Magento\Framework\DB\Ddl\Trigger | $trigger | ) |
Create trigger
\Magento\Framework\DB\Ddl\Trigger | $trigger |
Implemented in Mysql.
decodeVarbinary | ( | $value | ) |
delete | ( | $table, | |
$where = '' |
|||
) |
Deletes table rows based on a WHERE clause.
mixed | $table | The table to update. |
mixed | $where | DELETE WHERE clause(s). |
deleteFromSelect | ( | \Magento\Framework\DB\Select | $select, |
$table | |||
) |
Get delete from select object query
\Magento\Framework\DB\Select | $select | |
string | $table | the table name or alias used in select |
describeTable | ( | $tableName, | |
$schemaName = null |
|||
) |
Returns the column descriptions for a table.
The return value is an associative array keyed by the column name, as returned by the RDBMS.
The value of each array element is an associative array with the following keys:
SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; COLUMN_NAME => string; column name COLUMN_POSITION => number; ordinal position of column in table DATA_TYPE => string; SQL datatype name of column DEFAULT => string; default expression of column, null if none NULLABLE => boolean; true if column can have nulls LENGTH => number; length of CHAR/VARCHAR SCALE => number; scale of NUMERIC/DECIMAL PRECISION => number; precision of NUMERIC/DECIMAL UNSIGNED => boolean; unsigned property of an integer type PRIMARY => boolean; true if column is part of the primary key PRIMARY_POSITION => integer; position of column in primary key IDENTITY => integer; true if column is auto-generated with unique values
string | $tableName | |
string | $schemaName | OPTIONAL |
Implemented in Mysql.
disableTableKeys | ( | $tableName, | |
$schemaName = null |
|||
) |
Stop updating indexes
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
disallowDdlCache | ( | ) |
dropColumn | ( | $tableName, | |
$columnName, | |||
$schemaName = null |
|||
) |
Drop the column from table
string | $tableName | |
string | $columnName | |
string | $schemaName |
Implemented in Mysql.
dropForeignKey | ( | $tableName, | |
$fkName, | |||
$schemaName = null |
|||
) |
Drop the Foreign Key from table
string | $tableName | |
string | $fkName | |
string | $schemaName |
Implemented in Mysql.
dropIndex | ( | $tableName, | |
$keyName, | |||
$schemaName = null |
|||
) |
Drop the index from table
string | $tableName | |
string | $keyName | |
string | $schemaName |
Implemented in Mysql.
dropTable | ( | $tableName, | |
$schemaName = null |
|||
) |
Drop table from database
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
dropTemporaryTable | ( | $tableName, | |
$schemaName = null |
|||
) |
Drop temporary table from database
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
dropTrigger | ( | $triggerName, | |
$schemaName = null |
|||
) |
Drop trigger from database
string | $triggerName | |
string | null | $schemaName |
Implemented in Mysql.
enableTableKeys | ( | $tableName, | |
$schemaName = null |
|||
) |
Re-create missing indexes
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
endSetup | ( | ) |
Run additional environment after setup
Implemented in Mysql.
fetchAll | ( | $sql, | |
$bind = [] , |
|||
$fetchMode = null |
|||
) |
Fetches all SQL result rows as a sequential array. Uses the current fetchMode for the adapter.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
mixed | $fetchMode | Override current fetch mode. |
fetchAssoc | ( | $sql, | |
$bind = [] |
|||
) |
Fetches all SQL result rows as an associative array.
The first column is the key, the entire row array is the value. You should construct the query to be sure that the first column contains unique values, or else rows with duplicate values in the first column will overwrite previous data.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
fetchCol | ( | $sql, | |
$bind = [] |
|||
) |
Fetches the first column of all SQL result rows as an array.
The first column in each row is used as the array key.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
fetchOne | ( | $sql, | |
$bind = [] |
|||
) |
Fetches the first column of the first row of the SQL result.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
fetchPairs | ( | $sql, | |
$bind = [] |
|||
) |
Fetches all SQL result rows as an array of key-value pairs.
The first column is the key, the second column is the value.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
fetchRow | ( | $sql, | |
$bind = [] , |
|||
$fetchMode = null |
|||
) |
Fetches the first row of the SQL result. Uses the current fetchMode for the adapter.
string | \Magento\Framework\DB\Select | $sql | An SQL SELECT statement. |
mixed | $bind | Data to bind into SELECT placeholders. |
mixed | $fetchMode | Override current fetch mode. |
formatDate | ( | $date, | |
$includeTime = true |
|||
) |
Format Date to internal database date format
int | string | \DateTimeInterface | $date | |
boolean | $includeTime |
Implemented in Mysql.
forUpdate | ( | $sql | ) |
getAutoIncrementField | ( | $tableName, | |
$schemaName = null |
|||
) |
Returns auto increment field if exists
string | $tableName | |
string | null | $schemaName |
Implemented in Mysql.
getCaseSql | ( | $valueName, | |
$casesResults, | |||
$defaultValue = null |
|||
) |
Generate fragment of SQL, that check value against multiple condition cases and return different result depends on them
string | $valueName | Name of value to check |
array | $casesResults | Cases and results |
string | $defaultValue | value to use if value doesn't confirm to any cases |
Implemented in Mysql.
getCheckSql | ( | $condition, | |
$true, | |||
$false | |||
) |
Generate fragment of SQL, that check condition and return true or false value
string | $condition | expression |
string | $true | true value |
string | $false | false value |
Implemented in Mysql.
getConcatSql | ( | array | $data, |
$separator = null |
|||
) |
Generate fragment of SQL, that combine together (concatenate) the results from data array All arguments in data must be quoted
array | $data | |
string | $separator | concatenate with separator |
Implemented in Mysql.
getDateAddSql | ( | $date, | |
$interval, | |||
$unit | |||
) |
Add time values (intervals) to a date value
\Zend_Db_Expr | string | $date | quoted field name or SQL statement |
int | $interval | |
string | $unit |
Implemented in Mysql.
getDateExtractSql | ( | $date, | |
$unit | |||
) |
Extract part of a date
\Zend_Db_Expr | string | $date | quoted field name or SQL statement |
string | $unit |
Implemented in Mysql.
getDateFormatSql | ( | $date, | |
$format | |||
) |
Format date as specified
Supported format Specifier
H Hour (00..23) i Minutes, numeric (00..59) s Seconds (00..59) d Day of the month, numeric (00..31) m Month, numeric (00..12) Y Year, numeric, four digits
\Zend_Db_Expr | string | $date | quoted field name or SQL statement |
string | $format |
Implemented in Mysql.
getDatePartSql | ( | $date | ) |
Extract the date part of a date or datetime expression
\Zend_Db_Expr | string | $date | quoted field name or SQL statement |
Implemented in Mysql.
getDateSubSql | ( | $date, | |
$interval, | |||
$unit | |||
) |
Subtract time values (intervals) to a date value
\Zend_Db_Expr | string | $date | quoted field name or SQL statement |
int | string | $interval | |
string | $unit |
Implemented in Mysql.
getForeignKeyName | ( | $priTableName, | |
$priColumnName, | |||
$refTableName, | |||
$refColumnName | |||
) |
Retrieve valid foreign key name Check foreign key name length and allowed symbols
string | $priTableName | |
string | $priColumnName | |
string | $refTableName | |
string | $refColumnName |
Implemented in Mysql.
getForeignKeys | ( | $tableName, | |
$schemaName = null |
|||
) |
Retrieve the foreign keys descriptions for a table.
The return value is an associative array keyed by the UPPERCASE foreign key, as returned by the RDBMS.
The value of each array element is an associative array with the following keys:
FK_NAME => string; original foreign key name SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; COLUMN_NAME => string; column name REF_SCHEMA_NAME => string; name of reference database or schema REF_TABLE_NAME => string; reference table name REF_COLUMN_NAME => string; reference column name ON_DELETE => string; action type on delete row ON_UPDATE => string; action type on update row
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
getGreatestSql | ( | array | $data | ) |
Generate fragment of SQL, that compare with two or more arguments, and returns the largest (maximum-valued) argument All arguments in data must be quoted
array | $data |
Implemented in Mysql.
getIfNullSql | ( | $expression, | |
$value = 0 |
|||
) |
Returns valid IFNULL expression
string | $expression | |
string | int | $value | OPTIONAL. Applies when $expression is NULL |
Implemented in Mysql.
getIndexList | ( | $tableName, | |
$schemaName = null |
|||
) |
Returns the table index information
The return value is an associative array keyed by the UPPERCASE index key (except for primary key, that is always stored under 'PRIMARY' key) as returned by the RDBMS.
The value of each array element is an associative array with the following keys:
SCHEMA_NAME => string; name of database or schema TABLE_NAME => string; name of the table KEY_NAME => string; the original index name COLUMNS_LIST => array; array of index column names INDEX_TYPE => string; lowercase, create index type INDEX_METHOD => string; index method using type => string; see INDEX_TYPE fields => array; see COLUMNS_LIST
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
getIndexName | ( | $tableName, | |
$fields, | |||
$indexType = '' |
|||
) |
Retrieve valid index name Check index name length and allowed symbols
string | $tableName | |
string | array | $fields | the columns list |
string | $indexType |
Implemented in Mysql.
getLeastSql | ( | array | $data | ) |
Generate fragment of SQL, that compare with two or more arguments, and returns the smallest (minimum-valued) argument All arguments in data must be quoted
array | $data |
Implemented in Mysql.
getLengthSql | ( | $string | ) |
Generate fragment of SQL that returns length of character string The string argument must be quoted
string | $string |
Implemented in Mysql.
getPrimaryKeyName | ( | $tableName, | |
$schemaName = null |
|||
) |
Try to find installed primary key name, if not - formate new one.
string | $tableName | Table name |
string | $schemaName | OPTIONAL |
Implemented in Mysql.
getStandardDeviationSql | ( | $expressionField | ) |
Prepare standard deviation sql function
\Zend_Db_Expr | string | $expressionField | quoted field name or SQL statement |
Implemented in Mysql.
getSubstringSql | ( | $stringExpression, | |
$pos, | |||
$len = null |
|||
) |
Prepare substring sql function
\Zend_Db_Expr | string | $stringExpression | quoted field name or SQL statement |
int | string | \Zend_Db_Expr | $pos | |
int | string | \Zend_Db_Expr | null | $len |
Implemented in Mysql.
getTableName | ( | $tableName | ) |
Retrieve valid table name Check table name length and allowed symbols
string | $tableName |
Implemented in Mysql.
getTables | ( | $likeCondition = null | ) |
getTablesChecksum | ( | $tableNames, | |
$schemaName = null |
|||
) |
Return array of table(s) checksum as table name - checksum pairs
array | string | $tableNames | |
string | $schemaName |
Implemented in Mysql.
getTransactionLevel | ( | ) |
Get adapter transaction level state. Return 0 if all transactions are complete
Implemented in Mysql.
getTriggerName | ( | $tableName, | |
$time, | |||
$event | |||
) |
insert | ( | $table, | |
array | $bind | ||
) |
Inserts a table row with specified data.
mixed | $table | The table to insert data into. |
array | $bind | Column-value pairs. |
insertArray | ( | $table, | |
array | $columns, | ||
array | $data | ||
) |
Insert array into a table based on columns definition
$data can be represented as:
string | $table | |
string[] | $columns the data array column map | |
array | $data |
insertForce | ( | $table, | |
array | $bind | ||
) |
Inserts a table row with specified data Special for Zero values to identity column
string | $table | |
array | $bind |
Implemented in Mysql.
insertFromSelect | ( | \Magento\Framework\DB\Select | $select, |
$table, | |||
array | $fields = [] , |
||
$mode = false |
|||
) |
Get insert from Select object query
\Magento\Framework\DB\Select | $select | |
string | $table | insert into table |
array | $fields | |
int | bool | $mode |
insertMultiple | ( | $table, | |
array | $data | ||
) |
Inserts a table multiply rows with specified data.
mixed | $table | The table to insert data into. |
array | $data | Column-value pairs or array of Column-value pairs. |
Implemented in Mysql.
insertOnDuplicate | ( | $table, | |
array | $data, | ||
array | $fields = [] |
||
) |
Inserts a table row with specified data.
mixed | $table | The table to insert data into. |
array | $data | Column-value pairs or array of column-value pairs. |
array | $fields | update fields pairs or values |
Implemented in Mysql.
isTableExists | ( | $tableName, | |
$schemaName = null |
|||
) |
Checks if table exists
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
loadDdlCache | ( | $tableCacheKey, | |
$ddlType | |||
) |
Load DDL data from cache Return false if cache does not exists
string | $tableCacheKey | the table cache key |
int | $ddlType | the DDL constant |
Implemented in Mysql.
modifyColumn | ( | $tableName, | |
$columnName, | |||
$definition, | |||
$flushData = false , |
|||
$schemaName = null |
|||
) |
Modify the column definition
string | $tableName | |
string | $columnName | |
array | string | $definition | |
boolean | $flushData | |
string | $schemaName |
Implemented in Mysql.
modifyColumnByDdl | ( | $tableName, | |
$columnName, | |||
$definition, | |||
$flushData = false , |
|||
$schemaName = null |
|||
) |
Modify the column definition by data from describe table
string | $tableName | |
string | $columnName | |
array | string | $definition | |
boolean | $flushData | |
string | $schemaName |
Implemented in Mysql.
newTable | ( | $tableName = null , |
|
$schemaName = null |
|||
) |
Retrieve DDL object for new table
string | $tableName | the table name |
string | $schemaName | the database or schema name |
Implemented in Mysql.
orderRand | ( | \Magento\Framework\DB\Select | $select, |
$field = null |
|||
) |
Adds order by random to select object Possible using integer field for optimization
\Magento\Framework\DB\Select | $select | |
string | $field |
prepareColumnValue | ( | array | $column, |
$value | |||
) |
Prepare value for save in column Return converted to column data type value
array | $column | the column describe array |
mixed | $value |
Implemented in Mysql.
prepareSqlCondition | ( | $fieldName, | |
$condition | |||
) |
Build SQL statement for condition
If $condition integer or string - exact value will be filtered ('eq' condition)
If $condition is array - one of the following structures is expected:
If non matched - sequential array is expected and OR conditions will be built using above mentioned structure
string | $fieldName | |
integer | string | array | $condition |
Implemented in Mysql.
query | ( | $sql, | |
$bind = [] |
|||
) |
Prepares and executes an SQL statement with bound data.
mixed | $sql | The SQL statement with placeholders. May be a string or \Magento\Framework\DB\Select. |
mixed | $bind | An array of data or data itself to bind to the placeholders. |
Implemented in Mysql.
quote | ( | $value, | |
$type = null |
|||
) |
Safely quotes a value for an SQL statement.
If an array is passed as the value, the array values are quoted and then returned as a comma-separated string.
mixed | $value | The value to quote. |
mixed | $type | OPTIONAL the SQL datatype name, or constant, or null. |
quoteColumnAs | ( | $ident, | |
$alias, | |||
$auto = false |
|||
) |
Quote a column identifier and alias.
string | array | \Zend_Db_Expr | $ident | The identifier or expression. |
string | $alias | An alias for the column. |
boolean | $auto | If true, heed the AUTO_QUOTE_IDENTIFIERS config option. |
quoteIdentifier | ( | $ident, | |
$auto = false |
|||
) |
Quotes an identifier.
Accepts a string representing a qualified indentifier. For Example: $adapter->quoteIdentifier('myschema.mytable')
Returns: "myschema"."mytable"
Or, an array of one or more identifiers that may form a qualified identifier: $adapter->quoteIdentifier(array('myschema','my.table'))
Returns: "myschema"."my.table"
The actual quote character surrounding the identifiers may vary depending on the adapter.
string | array | \Zend_Db_Expr | $ident | The identifier. |
boolean | $auto | If true, heed the AUTO_QUOTE_IDENTIFIERS config option. |
quoteInto | ( | $text, | |
$value, | |||
$type = null , |
|||
$count = null |
|||
) |
Quotes a value and places into a piece of text at a placeholder.
The placeholder is a question-mark; all placeholders will be replaced with the quoted value. For example:
$text = "WHERE date < ?"; $date = "2005-01-02"; $safe = $sql->quoteInto($text, $date); // $safe = "WHERE date < '2005-01-02'"
string | $text | The text with a placeholder. |
mixed | $value | The value to quote. |
string | $type | OPTIONAL SQL datatype |
integer | $count | OPTIONAL count of placeholders to replace |
Implemented in Mysql.
quoteTableAs | ( | $ident, | |
$alias = null , |
|||
$auto = false |
|||
) |
Quote a table identifier and alias.
string | array | \Zend_Db_Expr | $ident | The identifier or expression. |
string | $alias | An alias for the table. |
boolean | $auto | If true, heed the AUTO_QUOTE_IDENTIFIERS config option. |
renameTable | ( | $oldTableName, | |
$newTableName, | |||
$schemaName = null |
|||
) |
Rename table
string | $oldTableName | |
string | $newTableName | |
string | $schemaName |
Implemented in Mysql.
renameTablesBatch | ( | array | $tablePairs | ) |
Rename several tables
array | $tablePairs | array('oldName' => 'Name1', 'newName' => 'Name2') |
Implemented in Mysql.
resetDdlCache | ( | $tableName = null , |
|
$schemaName = null |
|||
) |
Reset cached DDL data from cache if table name is null - reset all cached DDL data
string | $tableName | |
string | $schemaName | OPTIONAL |
Implemented in Mysql.
rollBack | ( | ) |
saveDdlCache | ( | $tableCacheKey, | |
$ddlType, | |||
$data | |||
) |
Save DDL data into cache
string | $tableCacheKey | |
int | $ddlType | |
mixed | $data |
Implemented in Mysql.
select | ( | ) |
Creates and returns a new \Magento\Framework\DB\Select object for this adapter.
Implemented in Mysql.
selectsByRange | ( | $rangeField, | |
\Magento\Framework\DB\Select | $select, | ||
$stepCount = 100 |
|||
) |
Get insert queries in array for insert by range with step parameter
string | $rangeField | |
\Magento\Framework\DB\Select | $select | |
int | $stepCount |
Implemented in Mysql.
setCacheAdapter | ( | \Magento\Framework\Cache\FrontendInterface | $cacheAdapter | ) |
Set cache adapter
\Magento\Framework\Cache\FrontendInterface | $cacheAdapter |
showTableStatus | ( | $tableName, | |
$schemaName = null |
|||
) |
Returns short table status array
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
startSetup | ( | ) |
Run additional environment before setup
Implemented in Mysql.
supportStraightJoin | ( | ) |
tableColumnExists | ( | $tableName, | |
$columnName, | |||
$schemaName = null |
|||
) |
Check is table column exists
string | $tableName | |
string | $columnName | |
string | $schemaName |
Implemented in Mysql.
truncateTable | ( | $tableName, | |
$schemaName = null |
|||
) |
Truncate a table
string | $tableName | |
string | $schemaName |
Implemented in Mysql.
update | ( | $table, | |
array | $bind, | ||
$where = '' |
|||
) |
Updates table rows with specified data based on a WHERE clause.
The $where parameter in this instance can be a single WHERE clause or an array containing a multiple. In all instances, a WHERE clause can be a string or an instance of {
If the $where parameter is an array of multiple clauses, they will be joined by AND, with each clause wrapped in parenthesis. If you wish to use an OR, you must give a single clause that is an instance of {
mixed | $table | The table to update. |
array | $bind | Column-value pairs. |
mixed | $where | UPDATE WHERE clause(s). |
updateFromSelect | ( | \Magento\Framework\DB\Select | $select, |
$table | |||
) |
Get update table query using select object for join and update
\Magento\Framework\DB\Select | $select | |
string | array | $table |
const ERROR_ASYMMETRIC_COMMIT_MESSAGE = 'Asymmetric transaction commit.' |
Error message for asymmetric transaction commit
Definition at line 77 of file AdapterInterface.php.
const ERROR_ASYMMETRIC_ROLLBACK_MESSAGE = 'Asymmetric transaction rollback.' |
Error message for asymmetric transaction rollback
Definition at line 72 of file AdapterInterface.php.
const ERROR_DDL_MESSAGE = 'DDL statements are not allowed in transactions' |
Error message for DDL query in transactions
Definition at line 62 of file AdapterInterface.php.
const ERROR_ROLLBACK_INCOMPLETE_MESSAGE = 'Rolled back transaction has not been completed correctly.' |
Error message for unfinished rollBack transaction
Definition at line 67 of file AdapterInterface.php.
const FK_ACTION_CASCADE = 'CASCADE' |
Definition at line 26 of file AdapterInterface.php.
const FK_ACTION_NO_ACTION = 'NO ACTION' |
Definition at line 30 of file AdapterInterface.php.
const FK_ACTION_RESTRICT = 'RESTRICT' |
Definition at line 32 of file AdapterInterface.php.
const FK_ACTION_SET_DEFAULT = 'SET DEFAULT' |
Definition at line 34 of file AdapterInterface.php.
const FK_ACTION_SET_NULL = 'SET NULL' |
Definition at line 28 of file AdapterInterface.php.
const INDEX_TYPE_FULLTEXT = 'fulltext' |
Definition at line 24 of file AdapterInterface.php.
const INDEX_TYPE_INDEX = 'index' |
Definition at line 22 of file AdapterInterface.php.
const INDEX_TYPE_PRIMARY = 'primary' |
Definition at line 18 of file AdapterInterface.php.
const INDEX_TYPE_UNIQUE = 'unique' |
Definition at line 20 of file AdapterInterface.php.
const INSERT_IGNORE = 2 |
Definition at line 38 of file AdapterInterface.php.
const INSERT_ON_DUPLICATE = 1 |
Definition at line 36 of file AdapterInterface.php.
const INTERVAL_DAY = 'DAYS' |
Definition at line 53 of file AdapterInterface.php.
const INTERVAL_HOUR = 'HOURS' |
Definition at line 51 of file AdapterInterface.php.
const INTERVAL_MINUTE = 'MINUTES' |
Definition at line 49 of file AdapterInterface.php.
const INTERVAL_MONTH = 'MONTHS' |
Definition at line 55 of file AdapterInterface.php.
const INTERVAL_SECOND = 'SECOND' |
Definition at line 47 of file AdapterInterface.php.
const INTERVAL_YEAR = 'YEARS' |
Definition at line 57 of file AdapterInterface.php.
const ISO_DATE_FORMAT = 'yyyy-MM-dd' |
Definition at line 43 of file AdapterInterface.php.
const ISO_DATETIME_FORMAT = 'yyyy-MM-dd HH-mm-ss' |
Definition at line 45 of file AdapterInterface.php.
const REPLACE = 4 |
Strategy for updating data in table. See https://dev.mysql.com/doc/refman/5.7/en/replace.html
Definition at line 41 of file AdapterInterface.php.