Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.10.x' into 2.11.x
Browse files Browse the repository at this point in the history
  • Loading branch information
greg0ire committed Aug 24, 2020
2 parents 1234664 + 51cb7a8 commit 994e701
Show file tree
Hide file tree
Showing 22 changed files with 185 additions and 191 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"phpunit/phpunit": "^9.3",
"psalm/plugin-phpunit": "^0.10.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "^3.11.4"
"vimeo/psalm": "^3.14.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
Expand Down
160 changes: 71 additions & 89 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -908,11 +908,11 @@ public function quoteIdentifier($str)
/**
* {@inheritDoc}
*/
public function quote($input, $type = ParameterType::STRING)
public function quote($value, $type = ParameterType::STRING)
{
$connection = $this->getWrappedConnection();

[$value, $bindingType] = $this->getBindingInfo($input, $type);
[$value, $bindingType] = $this->getBindingInfo($value, $type);

return $connection->quote($value, $bindingType);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ public function query();
/**
* Quotes a string for use in a query.
*
* @param mixed $input
* @param mixed $value
* @param int $type
*
* @return mixed
*/
public function quote($input, $type = ParameterType::STRING);
public function quote($value, $type = ParameterType::STRING);

/**
* Executes an SQL statement and return the number of affected rows.
Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,15 @@ public function query()
/**
* {@inheritdoc}
*/
public function quote($input, $type = ParameterType::STRING)
public function quote($value, $type = ParameterType::STRING)
{
$input = db2_escape_string($input);
$value = db2_escape_string($value);

if ($type === ParameterType::INTEGER) {
return $input;
return $value;
}

return "'" . $input . "'";
return "'" . $value . "'";
}

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/DBAL/Driver/Mysqli/MysqliConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public function query()
/**
* {@inheritdoc}
*/
public function quote($input, $type = ParameterType::STRING)
public function quote($value, $type = ParameterType::STRING)
{
return "'" . $this->conn->escape_string($input) . "'";
return "'" . $this->conn->escape_string($value) . "'";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,13 @@ public function query()
/**
* {@inheritdoc}
*/
public function quote($input, $type = ParameterType::STRING)
public function quote($value, $type = ParameterType::STRING)
{
if (is_int($input) || is_float($input)) {
return $input;
if (is_int($value) || is_float($value)) {
return $value;
}

return "'" . sasql_escape_string($this->connection, $input) . "'";
return "'" . sasql_escape_string($this->connection, $value) . "'";
}

/**
Expand Down
30 changes: 15 additions & 15 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,19 +909,19 @@ public function getNowExpression()
*
* SQLite only supports the 2 parameter variant of this function.
*
* @param string $value An sql string literal or column name/alias.
* @param int $from Where to start the substring portion.
* @param string $string An sql string literal or column name/alias.
* @param int $start Where to start the substring portion.
* @param int|null $length The substring portion length.
*
* @return string
*/
public function getSubstringExpression($value, $from, $length = null)
public function getSubstringExpression($string, $start, $length = null)
{
if ($length === null) {
return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
return 'SUBSTRING(' . $string . ' FROM ' . $start . ')';
}

return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')';
}

/**
Expand Down Expand Up @@ -1696,19 +1696,19 @@ public function getInlineColumnCommentSQL($comment)
/**
* Returns the SQL used to create a table.
*
* @param string $tableName
* @param string $name
* @param mixed[][] $columns
* @param mixed[] $options
*
* @return string[]
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$columnListSql = $this->getColumnDeclarationListSQL($columns);

if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
foreach ($options['uniqueConstraints'] as $name => $definition) {
$columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
foreach ($options['uniqueConstraints'] as $index => $definition) {
$columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition);
}
}

Expand All @@ -1722,7 +1722,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
}
}

$query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;
$query = 'CREATE TABLE ' . $name . ' (' . $columnListSql;

$check = $this->getCheckDeclarationSQL($columns);
if (! empty($check)) {
Expand All @@ -1735,7 +1735,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options

if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
}
}

Expand Down Expand Up @@ -3518,14 +3518,14 @@ public function getMaxIdentifierLength()
/**
* Returns the insert SQL for an empty insert statement.
*
* @param string $tableName
* @param string $identifierColumnName
* @param string $quotedTableName
* @param string $quotedIdentifierColumnName
*
* @return string
*/
public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName)
{
return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (null)';
return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (null)';
}

/**
Expand Down
16 changes: 8 additions & 8 deletions lib/Doctrine/DBAL/Platforms/DB2Platform.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ public function getIndexDeclarationSQL($name, Index $index)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$indexes = [];
if (isset($options['indexes'])) {
Expand All @@ -496,10 +496,10 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options

$options['indexes'] = [];

$sqls = parent::_getCreateTableSQL($tableName, $columns, $options);
$sqls = parent::_getCreateTableSQL($name, $columns, $options);

foreach ($indexes as $definition) {
$sqls[] = $this->getCreateIndexSQL($definition, $tableName);
$sqls[] = $this->getCreateIndexSQL($definition, $name);
}

return $sqls;
Expand Down Expand Up @@ -772,9 +772,9 @@ public function getDefaultValueDeclarationSQL($column)
/**
* {@inheritDoc}
*/
public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName)
{
return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)';
}

/**
Expand Down Expand Up @@ -835,13 +835,13 @@ public function getLocateExpression($str, $substr, $startPos = false)
/**
* {@inheritDoc}
*/
public function getSubstringExpression($value, $from, $length = null)
public function getSubstringExpression($string, $start, $length = null)
{
if ($length === null) {
return 'SUBSTR(' . $value . ', ' . $from . ')';
return 'SUBSTR(' . $string . ', ' . $start . ')';
}

return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')';
return 'SUBSTR(' . $string . ', ' . $start . ', ' . $length . ')';
}

/**
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public function getDropDatabaseSQL($name)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$queryFields = $this->getColumnDeclarationListSQL($columns);

Expand Down Expand Up @@ -218,15 +218,15 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$query .= 'TEMPORARY ';
}

$query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') ';
$query .= 'TABLE ' . $name . ' (' . $queryFields . ') ';
$query .= $this->buildTableOptions($options);
$query .= $this->buildPartitionOptions($options);

$sql = [$query];

if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public function getDropDatabaseSQL($name)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$queryFields = $this->getColumnDeclarationListSQL($columns);

Expand Down Expand Up @@ -445,7 +445,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$query .= 'TEMPORARY ';
}

$query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') ';
$query .= 'TABLE ' . $name . ' (' . $queryFields . ') ';
$query .= $this->buildTableOptions($options);
$query .= $this->buildPartitionOptions($options);

Expand All @@ -459,7 +459,7 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
// Propagate foreign key constraints only for InnoDB.
if (isset($options['foreignKeys']) && $engine === 'INNODB') {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
}
}

Expand Down
16 changes: 8 additions & 8 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ public static function assertValidIdentifier($identifier)
/**
* {@inheritDoc}
*/
public function getSubstringExpression($value, $position, $length = null)
public function getSubstringExpression($string, $start, $length = null)
{
if ($length !== null) {
return sprintf('SUBSTR(%s, %d, %d)', $value, $position, $length);
return sprintf('SUBSTR(%s, %d, %d)', $string, $start, $length);
}

return sprintf('SUBSTR(%s, %d)', $value, $position);
return sprintf('SUBSTR(%s, %d)', $string, $start);
}

/**
Expand Down Expand Up @@ -384,13 +384,13 @@ public function getListSequencesSQL($database)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($table, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$indexes = $options['indexes'] ?? [];
$options['indexes'] = [];
$sql = parent::_getCreateTableSQL($table, $columns, $options);
$sql = parent::_getCreateTableSQL($name, $columns, $options);

foreach ($columns as $name => $column) {
foreach ($columns as $columnName => $column) {
if (isset($column['sequence'])) {
$sql[] = $this->getCreateSequenceSQL($column['sequence']);
}
Expand All @@ -402,12 +402,12 @@ protected function _getCreateTableSQL($table, array $columns, array $options = [
continue;
}

$sql = array_merge($sql, $this->getCreateAutoincrementSql($name, $table));
$sql = array_merge($sql, $this->getCreateAutoincrementSql($columnName, $name));
}

if (isset($indexes) && ! empty($indexes)) {
foreach ($indexes as $index) {
$sql[] = $this->getCreateIndexSQL($index, $table);
$sql[] = $this->getCreateIndexSQL($index, $name);
}
}

Expand Down
14 changes: 7 additions & 7 deletions lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ public function setUseBooleanTrueFalseStrings($flag)
/**
* {@inheritDoc}
*/
public function getSubstringExpression($value, $from, $length = null)
public function getSubstringExpression($string, $start, $length = null)
{
if ($length === null) {
return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
return 'SUBSTRING(' . $string . ' FROM ' . $start . ')';
}

return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
return 'SUBSTRING(' . $string . ' FROM ' . $start . ' FOR ' . $length . ')';
}

/**
Expand Down Expand Up @@ -791,7 +791,7 @@ public function getDropForeignKeySQL($foreignKey, $table)
/**
* {@inheritDoc}
*/
protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
protected function _getCreateTableSQL($name, array $columns, array $options = [])
{
$queryFields = $this->getColumnDeclarationListSQL($columns);

Expand All @@ -800,19 +800,19 @@ protected function _getCreateTableSQL($tableName, array $columns, array $options
$queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
}

$query = 'CREATE TABLE ' . $tableName . ' (' . $queryFields . ')';
$query = 'CREATE TABLE ' . $name . ' (' . $queryFields . ')';

$sql = [$query];

if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] as $index) {
$sql[] = $this->getCreateIndexSQL($index, $tableName);
$sql[] = $this->getCreateIndexSQL($index, $name);
}
}

if (isset($options['foreignKeys'])) {
foreach ((array) $options['foreignKeys'] as $definition) {
$sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
$sql[] = $this->getCreateForeignKeySQL($definition, $name);
}
}

Expand Down
Loading

0 comments on commit 994e701

Please sign in to comment.