Automated coding style fixes using phpcbf

parent a84752c4
...@@ -44,25 +44,16 @@ final class ArrayStatement implements IteratorAggregate, ResultStatement ...@@ -44,25 +44,16 @@ final class ArrayStatement implements IteratorAggregate, ResultStatement
$this->columnCount = count($data[0]); $this->columnCount = count($data[0]);
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->data = []; $this->data = [];
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return $this->columnCount; return $this->columnCount;
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
return count($this->data); return count($this->data);
......
...@@ -69,9 +69,6 @@ final class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -69,9 +69,6 @@ final class ResultCacheStatement implements IteratorAggregate, ResultStatement
$this->lifetime = $lifetime; $this->lifetime = $lifetime;
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->statement->closeCursor(); $this->statement->closeCursor();
...@@ -84,15 +81,13 @@ final class ResultCacheStatement implements IteratorAggregate, ResultStatement ...@@ -84,15 +81,13 @@ final class ResultCacheStatement implements IteratorAggregate, ResultStatement
if (! $data) { if (! $data) {
$data = []; $data = [];
} }
$data[$this->realKey] = $this->data; $data[$this->realKey] = $this->data;
$this->resultCache->save($this->cacheKey, $data, $this->lifetime); $this->resultCache->save($this->cacheKey, $data, $this->lifetime);
unset($this->data); unset($this->data);
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return $this->statement->columnCount(); return $this->statement->columnCount();
......
...@@ -731,9 +731,6 @@ class Connection implements DriverConnection ...@@ -731,9 +731,6 @@ class Connection implements DriverConnection
return $this->getDatabasePlatform()->quoteIdentifier($identifier); return $this->getDatabasePlatform()->quoteIdentifier($identifier);
} }
/**
* {@inheritDoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return $this->getWrappedConnection()->quote($input); return $this->getWrappedConnection()->quote($input);
...@@ -872,9 +869,6 @@ class Connection implements DriverConnection ...@@ -872,9 +869,6 @@ class Connection implements DriverConnection
return $stmt; return $stmt;
} }
/**
* {@inheritDoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$connection = $this->getWrappedConnection(); $connection = $this->getWrappedConnection();
...@@ -926,6 +920,7 @@ class Connection implements DriverConnection ...@@ -926,6 +920,7 @@ class Connection implements DriverConnection
} else { } else {
$stmt->execute($params); $stmt->execute($params);
} }
$result = $stmt->rowCount(); $result = $stmt->rowCount();
} else { } else {
$result = $connection->exec($query); $result = $connection->exec($query);
...@@ -939,9 +934,6 @@ class Connection implements DriverConnection ...@@ -939,9 +934,6 @@ class Connection implements DriverConnection
return $result; return $result;
} }
/**
* {@inheritDoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
$connection = $this->getWrappedConnection(); $connection = $this->getWrappedConnection();
...@@ -1011,6 +1003,7 @@ class Connection implements DriverConnection ...@@ -1011,6 +1003,7 @@ class Connection implements DriverConnection
return $res; return $res;
} catch (Throwable $e) { } catch (Throwable $e) {
$this->rollBack(); $this->rollBack();
throw $e; throw $e;
} }
} }
...@@ -1052,9 +1045,6 @@ class Connection implements DriverConnection ...@@ -1052,9 +1045,6 @@ class Connection implements DriverConnection
return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel; return 'DOCTRINE2_SAVEPOINT_' . $this->transactionNestingLevel;
} }
/**
* {@inheritDoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
$connection = $this->getWrappedConnection(); $connection = $this->getWrappedConnection();
...@@ -1089,6 +1079,7 @@ class Connection implements DriverConnection ...@@ -1089,6 +1079,7 @@ class Connection implements DriverConnection
if ($this->transactionNestingLevel === 0) { if ($this->transactionNestingLevel === 0) {
throw NoActiveTransaction::new(); throw NoActiveTransaction::new();
} }
if ($this->isRollbackOnly) { if ($this->isRollbackOnly) {
throw CommitFailedRollbackOnly::new(); throw CommitFailedRollbackOnly::new();
} }
...@@ -1271,6 +1262,7 @@ class Connection implements DriverConnection ...@@ -1271,6 +1262,7 @@ class Connection implements DriverConnection
if ($this->transactionNestingLevel === 0) { if ($this->transactionNestingLevel === 0) {
throw NoActiveTransaction::new(); throw NoActiveTransaction::new();
} }
$this->isRollbackOnly = true; $this->isRollbackOnly = true;
} }
...@@ -1343,6 +1335,7 @@ class Connection implements DriverConnection ...@@ -1343,6 +1335,7 @@ class Connection implements DriverConnection
} else { } else {
$stmt->bindValue($bindIndex, $value); $stmt->bindValue($bindIndex, $value);
} }
++$bindIndex; ++$bindIndex;
} }
} else { } else {
...@@ -1372,6 +1365,7 @@ class Connection implements DriverConnection ...@@ -1372,6 +1365,7 @@ class Connection implements DriverConnection
if (is_string($type)) { if (is_string($type)) {
$type = Type::getType($type); $type = Type::getType($type);
} }
if ($type instanceof Type) { if ($type instanceof Type) {
$value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform()); $value = $type->convertToDatabaseValue($value, $this->getDatabasePlatform());
$bindingType = $type->getBindingType(); $bindingType = $type->getBindingType();
...@@ -1411,6 +1405,7 @@ class Connection implements DriverConnection ...@@ -1411,6 +1405,7 @@ class Connection implements DriverConnection
} else { } else {
$resolvedParams[$bindIndex] = $value; $resolvedParams[$bindIndex] = $value;
} }
++$bindIndex; ++$bindIndex;
} }
} else { } else {
......
...@@ -103,6 +103,7 @@ class MasterSlaveConnection extends Connection ...@@ -103,6 +103,7 @@ class MasterSlaveConnection extends Connection
if (! isset($params['slaves'], $params['master'])) { if (! isset($params['slaves'], $params['master'])) {
throw new InvalidArgumentException('master or slaves configuration missing'); throw new InvalidArgumentException('master or slaves configuration missing');
} }
if (count($params['slaves']) === 0) { if (count($params['slaves']) === 0) {
throw new InvalidArgumentException('You have to configure at least one slaves.'); throw new InvalidArgumentException('You have to configure at least one slaves.');
} }
...@@ -227,9 +228,6 @@ class MasterSlaveConnection extends Connection ...@@ -227,9 +228,6 @@ class MasterSlaveConnection extends Connection
return parent::executeUpdate($query, $params, $types); return parent::executeUpdate($query, $params, $types);
} }
/**
* {@inheritDoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -237,9 +235,6 @@ class MasterSlaveConnection extends Connection ...@@ -237,9 +235,6 @@ class MasterSlaveConnection extends Connection
parent::beginTransaction(); parent::beginTransaction();
} }
/**
* {@inheritDoc}
*/
public function commit() : void public function commit() : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -247,9 +242,6 @@ class MasterSlaveConnection extends Connection ...@@ -247,9 +242,6 @@ class MasterSlaveConnection extends Connection
parent::commit(); parent::commit();
} }
/**
* {@inheritDoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -267,9 +259,6 @@ class MasterSlaveConnection extends Connection ...@@ -267,9 +259,6 @@ class MasterSlaveConnection extends Connection
return parent::delete($table, $identifier, $types); return parent::delete($table, $identifier, $types);
} }
/**
* {@inheritDoc}
*/
public function close() : void public function close() : void
{ {
unset($this->connections['master'], $this->connections['slave']); unset($this->connections['master'], $this->connections['slave']);
...@@ -300,9 +289,6 @@ class MasterSlaveConnection extends Connection ...@@ -300,9 +289,6 @@ class MasterSlaveConnection extends Connection
return parent::insert($table, $data, $types); return parent::insert($table, $data, $types);
} }
/**
* {@inheritDoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
$this->connect('master'); $this->connect('master');
...@@ -310,9 +296,6 @@ class MasterSlaveConnection extends Connection ...@@ -310,9 +296,6 @@ class MasterSlaveConnection extends Connection
return parent::exec($statement); return parent::exec($statement);
} }
/**
* {@inheritDoc}
*/
public function createSavepoint(string $savepoint) : void public function createSavepoint(string $savepoint) : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -320,9 +303,6 @@ class MasterSlaveConnection extends Connection ...@@ -320,9 +303,6 @@ class MasterSlaveConnection extends Connection
parent::createSavepoint($savepoint); parent::createSavepoint($savepoint);
} }
/**
* {@inheritDoc}
*/
public function releaseSavepoint(string $savepoint) : void public function releaseSavepoint(string $savepoint) : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -330,9 +310,6 @@ class MasterSlaveConnection extends Connection ...@@ -330,9 +310,6 @@ class MasterSlaveConnection extends Connection
parent::releaseSavepoint($savepoint); parent::releaseSavepoint($savepoint);
} }
/**
* {@inheritDoc}
*/
public function rollbackSavepoint(string $savepoint) : void public function rollbackSavepoint(string $savepoint) : void
{ {
$this->connect('master'); $this->connect('master');
...@@ -340,9 +317,6 @@ class MasterSlaveConnection extends Connection ...@@ -340,9 +317,6 @@ class MasterSlaveConnection extends Connection
parent::rollbackSavepoint($savepoint); parent::rollbackSavepoint($savepoint);
} }
/**
* {@inheritDoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$this->connect('master'); $this->connect('master');
...@@ -360,9 +334,6 @@ class MasterSlaveConnection extends Connection ...@@ -360,9 +334,6 @@ class MasterSlaveConnection extends Connection
return $statement; return $statement;
} }
/**
* {@inheritDoc}
*/
public function prepare(string $sql) : Statement public function prepare(string $sql) : Statement
{ {
$this->connect('master'); $this->connect('master');
......
...@@ -51,6 +51,7 @@ MESSAGE; ...@@ -51,6 +51,7 @@ MESSAGE;
if ($driverEx instanceof DriverException) { if ($driverEx instanceof DriverException) {
return $driverEx; return $driverEx;
} }
if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DriverExceptionInterface) { if ($driver instanceof ExceptionConverterDriver && $driverEx instanceof DriverExceptionInterface) {
return $driver->convertException($msg, $driverEx); return $driver->convertException($msg, $driverEx);
} }
......
...@@ -16,17 +16,11 @@ use Doctrine\DBAL\Schema\DB2SchemaManager; ...@@ -16,17 +16,11 @@ use Doctrine\DBAL\Schema\DB2SchemaManager;
*/ */
abstract class AbstractDB2Driver implements Driver abstract class AbstractDB2Driver implements Driver
{ {
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new DB2Platform(); return new DB2Platform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new DB2SchemaManager($conn); return new DB2SchemaManager($conn);
......
...@@ -32,9 +32,6 @@ abstract class AbstractDriverException extends Exception implements DriverExcept ...@@ -32,9 +32,6 @@ abstract class AbstractDriverException extends Exception implements DriverExcept
$this->sqlState = $sqlState; $this->sqlState = $sqlState;
} }
/**
* {@inheritdoc}
*/
public function getSQLState() : ?string public function getSQLState() : ?string
{ {
return $this->sqlState; return $this->sqlState;
......
...@@ -93,9 +93,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -93,9 +93,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
private const CR_UNKNOWN_HOST = 2005; private const CR_UNKNOWN_HOST = 2005;
/**#@-*/ /**#@-*/
/**
* {@inheritdoc}
*/
public function convertException(string $message, DriverExceptionInterface $exception) : DriverException public function convertException(string $message, DriverExceptionInterface $exception) : DriverException
{ {
switch ($exception->getCode()) { switch ($exception->getCode()) {
...@@ -105,34 +102,28 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -105,34 +102,28 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
return new Exception\LockWaitTimeoutException($message, $exception); return new Exception\LockWaitTimeoutException($message, $exception);
case self::ER_TABLE_EXISTS_ERROR: case self::ER_TABLE_EXISTS_ERROR:
return new Exception\TableExistsException($message, $exception); return new Exception\TableExistsException($message, $exception);
case self::ER_BAD_TABLE_ERROR: case self::ER_BAD_TABLE_ERROR:
case self::ER_NO_SUCH_TABLE: case self::ER_NO_SUCH_TABLE:
return new Exception\TableNotFoundException($message, $exception); return new Exception\TableNotFoundException($message, $exception);
case self::ER_NO_REFERENCED_ROW: case self::ER_NO_REFERENCED_ROW:
case self::ER_ROW_IS_REFERENCED: case self::ER_ROW_IS_REFERENCED:
case self::ER_ROW_IS_REFERENCED_2: case self::ER_ROW_IS_REFERENCED_2:
case self::ER_NO_REFERENCED_ROW_2: case self::ER_NO_REFERENCED_ROW_2:
case self::ER_TRUNCATE_ILLEGAL_FK: case self::ER_TRUNCATE_ILLEGAL_FK:
return new Exception\ForeignKeyConstraintViolationException($message, $exception); return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case self::ER_DUP_ENTRY: case self::ER_DUP_ENTRY:
case self::ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED: case self::ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED:
case self::ER_DUP_ENTRY_AUTOINCREMENT_CASE: case self::ER_DUP_ENTRY_AUTOINCREMENT_CASE:
case self::ER_DUP_ENTRY_WITH_KEY_NAME: case self::ER_DUP_ENTRY_WITH_KEY_NAME:
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
case self::ER_BAD_FIELD_ERROR: case self::ER_BAD_FIELD_ERROR:
case self::ER_WRONG_COLUMN_NAME: case self::ER_WRONG_COLUMN_NAME:
case self::ER_LOAD_DATA_INVALID_COLUMN: case self::ER_LOAD_DATA_INVALID_COLUMN:
return new Exception\InvalidFieldNameException($message, $exception); return new Exception\InvalidFieldNameException($message, $exception);
case self::ER_NON_UNIQ_ERROR: case self::ER_NON_UNIQ_ERROR:
case self::ER_DUP_FIELDNAME: case self::ER_DUP_FIELDNAME:
case self::ER_FIELD_SPECIFIED_TWICE: case self::ER_FIELD_SPECIFIED_TWICE:
return new Exception\NonUniqueFieldNameException($message, $exception); return new Exception\NonUniqueFieldNameException($message, $exception);
case self::ER_PARSE_ERROR: case self::ER_PARSE_ERROR:
case self::ER_SYNTAX_ERROR: case self::ER_SYNTAX_ERROR:
case self::ER_WARN_DEPRECATED_SYNTAX: case self::ER_WARN_DEPRECATED_SYNTAX:
...@@ -146,7 +137,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -146,7 +137,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
case self::ER_WARN_DEPRECATED_SYNTAX_WITH_VER: case self::ER_WARN_DEPRECATED_SYNTAX_WITH_VER:
case self::ER_CONFLICT_FN_PARSE_ERROR: case self::ER_CONFLICT_FN_PARSE_ERROR:
return new Exception\SyntaxErrorException($message, $exception); return new Exception\SyntaxErrorException($message, $exception);
case self::ER_DBACCESS_DENIED_ERROR: case self::ER_DBACCESS_DENIED_ERROR:
case self::ER_ACCESS_DENIED_ERROR: case self::ER_ACCESS_DENIED_ERROR:
case self::ER_NO_DB_ERROR: case self::ER_NO_DB_ERROR:
...@@ -160,7 +150,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -160,7 +150,6 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
case self::CR_CONNECTION_ERROR: case self::CR_CONNECTION_ERROR:
case self::CR_UNKNOWN_HOST: case self::CR_UNKNOWN_HOST:
return new Exception\ConnectionException($message, $exception); return new Exception\ConnectionException($message, $exception);
case self::ER_BAD_NULL_ERROR: case self::ER_BAD_NULL_ERROR:
case self::ER_NULL_COLUMN_IN_INDEX: case self::ER_NULL_COLUMN_IN_INDEX:
case self::ER_INVALID_USE_OF_NULL: case self::ER_INVALID_USE_OF_NULL:
...@@ -192,6 +181,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -192,6 +181,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
if (version_compare($oracleMysqlVersion, '8', '>=')) { if (version_compare($oracleMysqlVersion, '8', '>=')) {
return new MySQL80Platform(); return new MySQL80Platform();
} }
if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) { if (version_compare($oracleMysqlVersion, '5.7.9', '>=')) {
return new MySQL57Platform(); return new MySQL57Platform();
} }
...@@ -220,6 +210,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -220,6 +210,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
'<major_version>.<minor_version>.<patch_version>' '<major_version>.<minor_version>.<patch_version>'
); );
} }
$majorVersion = $versionParts['major']; $majorVersion = $versionParts['major'];
$minorVersion = $versionParts['minor'] ?? 0; $minorVersion = $versionParts['minor'] ?? 0;
$patchVersion = $versionParts['patch'] ?? null; $patchVersion = $versionParts['patch'] ?? null;
......
...@@ -20,9 +20,6 @@ use Doctrine\DBAL\Schema\OracleSchemaManager; ...@@ -20,9 +20,6 @@ use Doctrine\DBAL\Schema\OracleSchemaManager;
*/ */
abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
{ {
/**
* {@inheritdoc}
*/
public function convertException(string $message, DriverExceptionInterface $exception) : DriverException public function convertException(string $message, DriverExceptionInterface $exception) : DriverException
{ {
switch ($exception->getCode()) { switch ($exception->getCode()) {
...@@ -30,30 +27,22 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver ...@@ -30,30 +27,22 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
case 2299: case 2299:
case 38911: case 38911:
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
case 904: case 904:
return new Exception\InvalidFieldNameException($message, $exception); return new Exception\InvalidFieldNameException($message, $exception);
case 918: case 918:
case 960: case 960:
return new Exception\NonUniqueFieldNameException($message, $exception); return new Exception\NonUniqueFieldNameException($message, $exception);
case 923: case 923:
return new Exception\SyntaxErrorException($message, $exception); return new Exception\SyntaxErrorException($message, $exception);
case 942: case 942:
return new Exception\TableNotFoundException($message, $exception); return new Exception\TableNotFoundException($message, $exception);
case 955: case 955:
return new Exception\TableExistsException($message, $exception); return new Exception\TableExistsException($message, $exception);
case 1017: case 1017:
case 12545: case 12545:
return new Exception\ConnectionException($message, $exception); return new Exception\ConnectionException($message, $exception);
case 1400: case 1400:
return new Exception\NotNullConstraintViolationException($message, $exception); return new Exception\NotNullConstraintViolationException($message, $exception);
case 2266: case 2266:
case 2291: case 2291:
case 2292: case 2292:
...@@ -63,17 +52,11 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver ...@@ -63,17 +52,11 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
return new DriverException($message, $exception); return new DriverException($message, $exception);
} }
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new OraclePlatform(); return new OraclePlatform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new OracleSchemaManager($conn); return new OracleSchemaManager($conn);
......
...@@ -45,25 +45,18 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver ...@@ -45,25 +45,18 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
break; break;
case '23502': case '23502':
return new Exception\NotNullConstraintViolationException($message, $exception); return new Exception\NotNullConstraintViolationException($message, $exception);
case '23503': case '23503':
return new Exception\ForeignKeyConstraintViolationException($message, $exception); return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case '23505': case '23505':
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
case '42601': case '42601':
return new Exception\SyntaxErrorException($message, $exception); return new Exception\SyntaxErrorException($message, $exception);
case '42702': case '42702':
return new Exception\NonUniqueFieldNameException($message, $exception); return new Exception\NonUniqueFieldNameException($message, $exception);
case '42703': case '42703':
return new Exception\InvalidFieldNameException($message, $exception); return new Exception\InvalidFieldNameException($message, $exception);
case '42P01': case '42P01':
return new Exception\TableNotFoundException($message, $exception); return new Exception\TableNotFoundException($message, $exception);
case '42P07': case '42P07':
return new Exception\TableExistsException($message, $exception); return new Exception\TableExistsException($message, $exception);
} }
...@@ -78,9 +71,6 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver ...@@ -78,9 +71,6 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
return new DriverException($message, $exception); return new DriverException($message, $exception);
} }
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion(string $version) : AbstractPlatform public function createDatabasePlatformForVersion(string $version) : AbstractPlatform
{ {
if (! preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) { if (! preg_match('/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+))?)?/', $version, $versionParts)) {
...@@ -102,17 +92,11 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver ...@@ -102,17 +92,11 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
return new PostgreSqlPlatform(); return new PostgreSqlPlatform();
} }
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new PostgreSqlPlatform(); return new PostgreSqlPlatform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new PostgreSqlSchemaManager($conn); return new PostgreSqlSchemaManager($conn);
......
...@@ -66,9 +66,6 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve ...@@ -66,9 +66,6 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
return new DriverException($message, $exception); return new DriverException($message, $exception);
} }
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion(string $version) : AbstractPlatform public function createDatabasePlatformForVersion(string $version) : AbstractPlatform
{ {
if (! preg_match( if (! preg_match(
...@@ -88,17 +85,11 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve ...@@ -88,17 +85,11 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
} }
} }
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new SQLAnywherePlatform(); return new SQLAnywherePlatform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new SQLAnywhereSchemaManager($conn); return new SQLAnywhereSchemaManager($conn);
......
...@@ -16,17 +16,11 @@ use Doctrine\DBAL\Schema\SQLServerSchemaManager; ...@@ -16,17 +16,11 @@ use Doctrine\DBAL\Schema\SQLServerSchemaManager;
*/ */
abstract class AbstractSQLServerDriver implements Driver abstract class AbstractSQLServerDriver implements Driver
{ {
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new SQLServerPlatform(); return new SQLServerPlatform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new SQLServerSchemaManager($conn); return new SQLServerSchemaManager($conn);
......
...@@ -80,17 +80,11 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver ...@@ -80,17 +80,11 @@ abstract class AbstractSQLiteDriver implements Driver, ExceptionConverterDriver
return new DriverException($message, $exception); return new DriverException($message, $exception);
} }
/**
* {@inheritdoc}
*/
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
return new SqlitePlatform(); return new SqlitePlatform();
} }
/**
* {@inheritdoc}
*/
public function getSchemaManager(Connection $conn) : AbstractSchemaManager public function getSchemaManager(Connection $conn) : AbstractSchemaManager
{ {
return new SqliteSchemaManager($conn); return new SqliteSchemaManager($conn);
......
...@@ -8,8 +8,7 @@ use Doctrine\DBAL\Driver\ResultStatement; ...@@ -8,8 +8,7 @@ use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
use stdClass; use stdClass;
use const DB2_AUTOCOMMIT_OFF; use function assert;
use const DB2_AUTOCOMMIT_ON;
use function db2_autocommit; use function db2_autocommit;
use function db2_commit; use function db2_commit;
use function db2_connect; use function db2_connect;
...@@ -21,6 +20,8 @@ use function db2_pconnect; ...@@ -21,6 +20,8 @@ use function db2_pconnect;
use function db2_prepare; use function db2_prepare;
use function db2_rollback; use function db2_rollback;
use function db2_server_info; use function db2_server_info;
use const DB2_AUTOCOMMIT_OFF;
use const DB2_AUTOCOMMIT_ON;
final class DB2Connection implements ServerInfoAwareConnection final class DB2Connection implements ServerInfoAwareConnection
{ {
...@@ -48,20 +49,14 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -48,20 +49,14 @@ final class DB2Connection implements ServerInfoAwareConnection
$this->conn = $conn; $this->conn = $conn;
} }
/**
* {@inheritdoc}
*/
public function getServerVersion() : string public function getServerVersion() : string
{ {
/** @var stdClass $serverInfo */
$serverInfo = db2_server_info($this->conn); $serverInfo = db2_server_info($this->conn);
assert($serverInfo instanceof stdClass);
return $serverInfo->DBMS_VER; return $serverInfo->DBMS_VER;
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
$stmt = @db2_prepare($this->conn, $sql); $stmt = @db2_prepare($this->conn, $sql);
...@@ -72,9 +67,6 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -72,9 +67,6 @@ final class DB2Connection implements ServerInfoAwareConnection
return new DB2Statement($stmt); return new DB2Statement($stmt);
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$stmt = $this->prepare($sql); $stmt = $this->prepare($sql);
...@@ -83,17 +75,11 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -83,17 +75,11 @@ final class DB2Connection implements ServerInfoAwareConnection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return "'" . db2_escape_string($input) . "'"; return "'" . db2_escape_string($input) . "'";
} }
/**
* {@inheritdoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
$stmt = @db2_exec($this->conn, $statement); $stmt = @db2_exec($this->conn, $statement);
...@@ -105,17 +91,11 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -105,17 +91,11 @@ final class DB2Connection implements ServerInfoAwareConnection
return db2_num_rows($stmt); return db2_num_rows($stmt);
} }
/**
* {@inheritdoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
return db2_last_insert_id($this->conn); return db2_last_insert_id($this->conn);
} }
/**
* {@inheritdoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
if (! db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF)) { if (! db2_autocommit($this->conn, DB2_AUTOCOMMIT_OFF)) {
...@@ -123,9 +103,6 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -123,9 +103,6 @@ final class DB2Connection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function commit() : void public function commit() : void
{ {
if (! db2_commit($this->conn)) { if (! db2_commit($this->conn)) {
...@@ -137,9 +114,6 @@ final class DB2Connection implements ServerInfoAwareConnection ...@@ -137,9 +114,6 @@ final class DB2Connection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
if (! db2_rollback($this->conn)) { if (! db2_rollback($this->conn)) {
......
...@@ -14,12 +14,6 @@ use ReflectionClass; ...@@ -14,12 +14,6 @@ use ReflectionClass;
use ReflectionObject; use ReflectionObject;
use ReflectionProperty; use ReflectionProperty;
use stdClass; use stdClass;
use const CASE_LOWER;
use const DB2_BINARY;
use const DB2_CHAR;
use const DB2_LONG;
use const DB2_PARAM_FILE;
use const DB2_PARAM_IN;
use function array_change_key_case; use function array_change_key_case;
use function array_key_exists; use function array_key_exists;
use function assert; use function assert;
...@@ -47,6 +41,12 @@ use function stream_copy_to_stream; ...@@ -47,6 +41,12 @@ use function stream_copy_to_stream;
use function stream_get_meta_data; use function stream_get_meta_data;
use function strtolower; use function strtolower;
use function tmpfile; use function tmpfile;
use const CASE_LOWER;
use const DB2_BINARY;
use const DB2_CHAR;
use const DB2_LONG;
use const DB2_PARAM_FILE;
use const DB2_PARAM_IN;
final class DB2Statement implements IteratorAggregate, Statement final class DB2Statement implements IteratorAggregate, Statement
{ {
...@@ -128,9 +128,6 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -128,9 +128,6 @@ final class DB2Statement implements IteratorAggregate, Statement
} }
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->bindParam = []; $this->bindParam = [];
...@@ -144,9 +141,6 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -144,9 +141,6 @@ final class DB2Statement implements IteratorAggregate, Statement
$this->result = false; $this->result = false;
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return db2_num_fields($this->stmt) ?: 0; return db2_num_fields($this->stmt) ?: 0;
...@@ -233,13 +227,10 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -233,13 +227,10 @@ final class DB2Statement implements IteratorAggregate, Statement
switch ($fetchMode) { switch ($fetchMode) {
case FetchMode::COLUMN: case FetchMode::COLUMN:
return $this->fetchColumn(); return $this->fetchColumn();
case FetchMode::MIXED: case FetchMode::MIXED:
return db2_fetch_both($this->stmt); return db2_fetch_both($this->stmt);
case FetchMode::ASSOCIATIVE: case FetchMode::ASSOCIATIVE:
return db2_fetch_assoc($this->stmt); return db2_fetch_assoc($this->stmt);
case FetchMode::CUSTOM_OBJECT: case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass; $className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs; $ctorArgs = $this->defaultFetchClassCtorArgs;
...@@ -256,13 +247,10 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -256,13 +247,10 @@ final class DB2Statement implements IteratorAggregate, Statement
} }
return $result; return $result;
case FetchMode::NUMERIC: case FetchMode::NUMERIC:
return db2_fetch_array($this->stmt); return db2_fetch_array($this->stmt);
case FetchMode::STANDARD_OBJECT: case FetchMode::STANDARD_OBJECT:
return db2_fetch_object($this->stmt); return db2_fetch_object($this->stmt);
default: default:
throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.'); throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.');
} }
...@@ -280,11 +268,13 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -280,11 +268,13 @@ final class DB2Statement implements IteratorAggregate, Statement
while (($row = $this->fetch($fetchMode, ...$args)) !== false) { while (($row = $this->fetch($fetchMode, ...$args)) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
case FetchMode::COLUMN: case FetchMode::COLUMN:
while (($row = $this->fetchColumn()) !== false) { while (($row = $this->fetchColumn()) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
default: default:
while (($row = $this->fetch($fetchMode)) !== false) { while (($row = $this->fetch($fetchMode)) !== false) {
...@@ -313,9 +303,6 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -313,9 +303,6 @@ final class DB2Statement implements IteratorAggregate, Statement
return $row[$columnIndex]; return $row[$columnIndex];
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
return @db2_num_rows($this->stmt) ? : 0; return @db2_num_rows($this->stmt) ? : 0;
......
...@@ -10,12 +10,6 @@ use Doctrine\DBAL\Driver\ResultStatement; ...@@ -10,12 +10,6 @@ use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
use mysqli; use mysqli;
use const MYSQLI_INIT_COMMAND;
use const MYSQLI_OPT_CONNECT_TIMEOUT;
use const MYSQLI_OPT_LOCAL_INFILE;
use const MYSQLI_READ_DEFAULT_FILE;
use const MYSQLI_READ_DEFAULT_GROUP;
use const MYSQLI_SERVER_PUBLIC_KEY;
use function defined; use function defined;
use function floor; use function floor;
use function in_array; use function in_array;
...@@ -26,6 +20,12 @@ use function restore_error_handler; ...@@ -26,6 +20,12 @@ use function restore_error_handler;
use function set_error_handler; use function set_error_handler;
use function sprintf; use function sprintf;
use function stripos; use function stripos;
use const MYSQLI_INIT_COMMAND;
use const MYSQLI_OPT_CONNECT_TIMEOUT;
use const MYSQLI_OPT_LOCAL_INFILE;
use const MYSQLI_READ_DEFAULT_FILE;
use const MYSQLI_READ_DEFAULT_GROUP;
use const MYSQLI_SERVER_PUBLIC_KEY;
class MysqliConnection implements PingableConnection, ServerInfoAwareConnection class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
{ {
...@@ -117,17 +117,11 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection ...@@ -117,17 +117,11 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
return $majorVersion . '.' . $minorVersion . '.' . $patchVersion; return $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
return new MysqliStatement($this->conn, $sql); return new MysqliStatement($this->conn, $sql);
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$stmt = $this->prepare($sql); $stmt = $this->prepare($sql);
...@@ -136,17 +130,11 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection ...@@ -136,17 +130,11 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return "'" . $this->conn->escape_string($input) . "'"; return "'" . $this->conn->escape_string($input) . "'";
} }
/**
* {@inheritdoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
if ($this->conn->query($statement) === false) { if ($this->conn->query($statement) === false) {
...@@ -156,25 +144,16 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection ...@@ -156,25 +144,16 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
return $this->conn->affected_rows; return $this->conn->affected_rows;
} }
/**
* {@inheritdoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
return (string) $this->conn->insert_id; return (string) $this->conn->insert_id;
} }
/**
* {@inheritdoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
$this->conn->query('START TRANSACTION'); $this->conn->query('START TRANSACTION');
} }
/**
* {@inheritdoc}
*/
public function commit() : void public function commit() : void
{ {
if (! $this->conn->commit()) { if (! $this->conn->commit()) {
...@@ -182,9 +161,6 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection ...@@ -182,9 +161,6 @@ class MysqliConnection implements PingableConnection, ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
if (! $this->conn->rollback()) { if (! $this->conn->rollback()) {
......
...@@ -245,6 +245,7 @@ final class MysqliStatement implements IteratorAggregate, Statement ...@@ -245,6 +245,7 @@ final class MysqliStatement implements IteratorAggregate, Statement
if (get_resource_type($value) !== 'stream') { if (get_resource_type($value) !== 'stream') {
throw new InvalidArgumentException('Resources passed with the LARGE_OBJECT parameter type must be stream resources.'); throw new InvalidArgumentException('Resources passed with the LARGE_OBJECT parameter type must be stream resources.');
} }
$streams[$parameter] = $value; $streams[$parameter] = $value;
$values[$parameter] = null; $values[$parameter] = null;
continue; continue;
...@@ -360,13 +361,10 @@ final class MysqliStatement implements IteratorAggregate, Statement ...@@ -360,13 +361,10 @@ final class MysqliStatement implements IteratorAggregate, Statement
switch ($fetchMode) { switch ($fetchMode) {
case FetchMode::ASSOCIATIVE: case FetchMode::ASSOCIATIVE:
return $assoc; return $assoc;
case FetchMode::MIXED: case FetchMode::MIXED:
return $assoc + $values; return $assoc + $values;
case FetchMode::STANDARD_OBJECT: case FetchMode::STANDARD_OBJECT:
return (object) $assoc; return (object) $assoc;
default: default:
throw UnknownFetchMode::new($fetchMode); throw UnknownFetchMode::new($fetchMode);
} }
...@@ -412,18 +410,12 @@ final class MysqliStatement implements IteratorAggregate, Statement ...@@ -412,18 +410,12 @@ final class MysqliStatement implements IteratorAggregate, Statement
return $row[$columnIndex]; return $row[$columnIndex];
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->stmt->free_result(); $this->stmt->free_result();
$this->result = false; $this->result = false;
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
if ($this->hasColumns) { if ($this->hasColumns) {
...@@ -433,9 +425,6 @@ final class MysqliStatement implements IteratorAggregate, Statement ...@@ -433,9 +425,6 @@ final class MysqliStatement implements IteratorAggregate, Statement
return $this->stmt->affected_rows; return $this->stmt->affected_rows;
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return $this->stmt->field_count; return $this->stmt->field_count;
......
...@@ -4,12 +4,12 @@ declare(strict_types=1); ...@@ -4,12 +4,12 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Driver\OCI8; namespace Doctrine\DBAL\Driver\OCI8;
use const PREG_OFFSET_CAPTURE;
use function count; use function count;
use function implode; use function implode;
use function preg_match; use function preg_match;
use function preg_quote; use function preg_quote;
use function substr; use function substr;
use const PREG_OFFSET_CAPTURE;
/** /**
* Converts positional (?) into named placeholders (:param<num>). * Converts positional (?) into named placeholders (:param<num>).
......
...@@ -9,7 +9,6 @@ use Doctrine\DBAL\Driver\ResultStatement; ...@@ -9,7 +9,6 @@ use Doctrine\DBAL\Driver\ResultStatement;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection; use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\Driver\Statement as DriverStatement; use Doctrine\DBAL\Driver\Statement as DriverStatement;
use UnexpectedValueException; use UnexpectedValueException;
use const OCI_DEFAULT;
use function addcslashes; use function addcslashes;
use function oci_commit; use function oci_commit;
use function oci_connect; use function oci_connect;
...@@ -20,6 +19,7 @@ use function oci_server_version; ...@@ -20,6 +19,7 @@ use function oci_server_version;
use function preg_match; use function preg_match;
use function sprintf; use function sprintf;
use function str_replace; use function str_replace;
use const OCI_DEFAULT;
/** /**
* OCI8 implementation of the Connection interface. * OCI8 implementation of the Connection interface.
...@@ -84,17 +84,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -84,17 +84,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
return $matches[1]; return $matches[1];
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
return new OCI8Statement($this->dbh, $sql, $this->executionMode); return new OCI8Statement($this->dbh, $sql, $this->executionMode);
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$stmt = $this->prepare($sql); $stmt = $this->prepare($sql);
...@@ -103,17 +97,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -103,17 +97,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return "'" . addcslashes(str_replace("'", "''", $input), "\000\n\r\\\032") . "'"; return "'" . addcslashes(str_replace("'", "''", $input), "\000\n\r\\\032") . "'";
} }
/**
* {@inheritdoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
$stmt = $this->prepare($statement); $stmt = $this->prepare($statement);
...@@ -122,9 +110,6 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -122,9 +110,6 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
return $stmt->rowCount(); return $stmt->rowCount();
} }
/**
* {@inheritdoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
if ($name === null) { if ($name === null) {
...@@ -142,17 +127,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -142,17 +127,11 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
return $result; return $result;
} }
/**
* {@inheritdoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
$this->executionMode->disableAutoCommit(); $this->executionMode->disableAutoCommit();
} }
/**
* {@inheritdoc}
*/
public function commit() : void public function commit() : void
{ {
if (! oci_commit($this->dbh)) { if (! oci_commit($this->dbh)) {
...@@ -162,9 +141,6 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection ...@@ -162,9 +141,6 @@ final class OCI8Connection implements Connection, ServerInfoAwareConnection
$this->executionMode->enableAutoCommit(); $this->executionMode->enableAutoCommit();
} }
/**
* {@inheritdoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
if (! oci_rollback($this->dbh)) { if (! oci_rollback($this->dbh)) {
......
...@@ -11,20 +11,6 @@ use Doctrine\DBAL\FetchMode; ...@@ -11,20 +11,6 @@ use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use InvalidArgumentException; use InvalidArgumentException;
use IteratorAggregate; use IteratorAggregate;
use const OCI_ASSOC;
use const OCI_B_BIN;
use const OCI_B_BLOB;
use const OCI_BOTH;
use const OCI_COMMIT_ON_SUCCESS;
use const OCI_D_LOB;
use const OCI_FETCHSTATEMENT_BY_COLUMN;
use const OCI_FETCHSTATEMENT_BY_ROW;
use const OCI_NO_AUTO_COMMIT;
use const OCI_NUM;
use const OCI_RETURN_LOBS;
use const OCI_RETURN_NULLS;
use const OCI_TEMP_BLOB;
use const SQLT_CHR;
use function array_key_exists; use function array_key_exists;
use function assert; use function assert;
use function count; use function count;
...@@ -42,6 +28,20 @@ use function oci_num_fields; ...@@ -42,6 +28,20 @@ use function oci_num_fields;
use function oci_num_rows; use function oci_num_rows;
use function oci_parse; use function oci_parse;
use function sprintf; use function sprintf;
use const OCI_ASSOC;
use const OCI_B_BIN;
use const OCI_B_BLOB;
use const OCI_BOTH;
use const OCI_COMMIT_ON_SUCCESS;
use const OCI_D_LOB;
use const OCI_FETCHSTATEMENT_BY_COLUMN;
use const OCI_FETCHSTATEMENT_BY_ROW;
use const OCI_NO_AUTO_COMMIT;
use const OCI_NUM;
use const OCI_RETURN_LOBS;
use const OCI_RETURN_NULLS;
use const OCI_TEMP_BLOB;
use const SQLT_CHR;
/** /**
* The OCI8 implementation of the Statement interface. * The OCI8 implementation of the Statement interface.
...@@ -161,18 +161,13 @@ final class OCI8Statement implements IteratorAggregate, Statement ...@@ -161,18 +161,13 @@ final class OCI8Statement implements IteratorAggregate, Statement
switch ($type) { switch ($type) {
case ParameterType::BINARY: case ParameterType::BINARY:
return OCI_B_BIN; return OCI_B_BIN;
case ParameterType::LARGE_OBJECT: case ParameterType::LARGE_OBJECT:
return OCI_B_BLOB; return OCI_B_BLOB;
default: default:
return SQLT_CHR; return SQLT_CHR;
} }
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
// not having the result means there's nothing to close // not having the result means there's nothing to close
...@@ -185,9 +180,6 @@ final class OCI8Statement implements IteratorAggregate, Statement ...@@ -185,9 +180,6 @@ final class OCI8Statement implements IteratorAggregate, Statement
$this->result = false; $this->result = false;
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return oci_num_fields($this->_sth) ?: 0; return oci_num_fields($this->_sth) ?: 0;
...@@ -349,9 +341,6 @@ final class OCI8Statement implements IteratorAggregate, Statement ...@@ -349,9 +341,6 @@ final class OCI8Statement implements IteratorAggregate, Statement
return $row[$columnIndex]; return $row[$columnIndex];
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
return oci_num_rows($this->_sth) ?: 0; return oci_num_rows($this->_sth) ?: 0;
......
...@@ -32,9 +32,6 @@ class PDOConnection implements ServerInfoAwareConnection ...@@ -32,9 +32,6 @@ class PDOConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
try { try {
...@@ -44,17 +41,11 @@ class PDOConnection implements ServerInfoAwareConnection ...@@ -44,17 +41,11 @@ class PDOConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function getServerVersion() : string public function getServerVersion() : string
{ {
return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION); return $this->connection->getAttribute(PDO::ATTR_SERVER_VERSION);
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : Statement public function prepare(string $sql) : Statement
{ {
try { try {
...@@ -66,9 +57,6 @@ class PDOConnection implements ServerInfoAwareConnection ...@@ -66,9 +57,6 @@ class PDOConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
try { try {
...@@ -81,17 +69,11 @@ class PDOConnection implements ServerInfoAwareConnection ...@@ -81,17 +69,11 @@ class PDOConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritdoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return $this->connection->quote($input); return $this->connection->quote($input);
} }
/**
* {@inheritdoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
try { try {
...@@ -113,25 +95,16 @@ class PDOConnection implements ServerInfoAwareConnection ...@@ -113,25 +95,16 @@ class PDOConnection implements ServerInfoAwareConnection
return new PDOStatement($stmt); return new PDOStatement($stmt);
} }
/**
* {@inheritDoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
$this->connection->beginTransaction(); $this->connection->beginTransaction();
} }
/**
* {@inheritDoc}
*/
public function commit() : void public function commit() : void
{ {
$this->connection->commit(); $this->connection->commit();
} }
/**
* {@inheritDoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
$this->connection->rollBack(); $this->connection->rollBack();
......
...@@ -56,15 +56,19 @@ final class Driver extends AbstractMySQLDriver ...@@ -56,15 +56,19 @@ final class Driver extends AbstractMySQLDriver
if (isset($params['host']) && $params['host'] !== '') { if (isset($params['host']) && $params['host'] !== '') {
$dsn .= 'host=' . $params['host'] . ';'; $dsn .= 'host=' . $params['host'] . ';';
} }
if (isset($params['port'])) { if (isset($params['port'])) {
$dsn .= 'port=' . $params['port'] . ';'; $dsn .= 'port=' . $params['port'] . ';';
} }
if (isset($params['dbname'])) { if (isset($params['dbname'])) {
$dsn .= 'dbname=' . $params['dbname'] . ';'; $dsn .= 'dbname=' . $params['dbname'] . ';';
} }
if (isset($params['unix_socket'])) { if (isset($params['unix_socket'])) {
$dsn .= 'unix_socket=' . $params['unix_socket'] . ';'; $dsn .= 'unix_socket=' . $params['unix_socket'] . ';';
} }
if (isset($params['charset'])) { if (isset($params['charset'])) {
$dsn .= 'charset=' . $params['charset'] . ';'; $dsn .= 'charset=' . $params['charset'] . ';';
} }
......
...@@ -14,9 +14,6 @@ use function substr; ...@@ -14,9 +14,6 @@ use function substr;
*/ */
class Connection extends PDOConnection class Connection extends PDOConnection
{ {
/**
* {@inheritDoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
if ($name === null) { if ($name === null) {
...@@ -29,9 +26,6 @@ class Connection extends PDOConnection ...@@ -29,9 +26,6 @@ class Connection extends PDOConnection
return $stmt->fetchColumn(); return $stmt->fetchColumn();
} }
/**
* {@inheritDoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
$val = parent::quote($input); $val = parent::quote($input);
...@@ -44,9 +38,6 @@ class Connection extends PDOConnection ...@@ -44,9 +38,6 @@ class Connection extends PDOConnection
return $val; return $val;
} }
/**
* {@inheritDoc}
*/
protected function createStatement(\PDOStatement $stmt) : PDOStatement protected function createStatement(\PDOStatement $stmt) : PDOStatement
{ {
return new Statement($stmt); return new Statement($stmt);
......
...@@ -96,17 +96,11 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -96,17 +96,11 @@ class PDOStatement implements IteratorAggregate, Statement
} }
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->stmt->closeCursor(); $this->stmt->closeCursor();
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return $this->stmt->columnCount(); return $this->stmt->columnCount();
...@@ -124,9 +118,6 @@ class PDOStatement implements IteratorAggregate, Statement ...@@ -124,9 +118,6 @@ class PDOStatement implements IteratorAggregate, Statement
} }
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
return $this->stmt->rowCount(); return $this->stmt->rowCount();
......
...@@ -81,9 +81,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection ...@@ -81,9 +81,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection
$this->endTransaction(); $this->endTransaction();
} }
/**
* {@inheritdoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
if (sasql_real_query($this->connection, $statement) === false) { if (sasql_real_query($this->connection, $statement) === false) {
...@@ -93,9 +90,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection ...@@ -93,9 +90,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection
return sasql_affected_rows($this->connection); return sasql_affected_rows($this->connection);
} }
/**
* {@inheritdoc}
*/
public function getServerVersion() : string public function getServerVersion() : string
{ {
$version = $this->query("SELECT PROPERTY('ProductVersion')")->fetchColumn(); $version = $this->query("SELECT PROPERTY('ProductVersion')")->fetchColumn();
...@@ -105,9 +99,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection ...@@ -105,9 +99,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection
return $version; return $version;
} }
/**
* {@inheritdoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
if ($name === null) { if ($name === null) {
...@@ -117,17 +108,11 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection ...@@ -117,17 +108,11 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection
return $this->query('SELECT ' . $name . '.CURRVAL')->fetchColumn(); return $this->query('SELECT ' . $name . '.CURRVAL')->fetchColumn();
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
return new SQLAnywhereStatement($this->connection, $sql); return new SQLAnywhereStatement($this->connection, $sql);
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$stmt = $this->prepare($sql); $stmt = $this->prepare($sql);
...@@ -136,9 +121,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection ...@@ -136,9 +121,6 @@ final class SQLAnywhereConnection implements ServerInfoAwareConnection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return "'" . sasql_escape_string($this->connection, $input) . "'"; return "'" . sasql_escape_string($this->connection, $input) . "'";
......
...@@ -14,7 +14,6 @@ use IteratorAggregate; ...@@ -14,7 +14,6 @@ use IteratorAggregate;
use ReflectionClass; use ReflectionClass;
use ReflectionObject; use ReflectionObject;
use stdClass; use stdClass;
use const SASQL_BOTH;
use function array_key_exists; use function array_key_exists;
use function assert; use function assert;
use function count; use function count;
...@@ -36,6 +35,7 @@ use function sasql_stmt_field_count; ...@@ -36,6 +35,7 @@ use function sasql_stmt_field_count;
use function sasql_stmt_reset; use function sasql_stmt_reset;
use function sasql_stmt_result_metadata; use function sasql_stmt_result_metadata;
use function sprintf; use function sprintf;
use const SASQL_BOTH;
/** /**
* SAP SQL Anywhere implementation of the Statement interface. * SAP SQL Anywhere implementation of the Statement interface.
...@@ -132,17 +132,11 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -132,17 +132,11 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement
$this->bindParam($param, $value, $type); $this->bindParam($param, $value, $type);
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
sasql_stmt_reset($this->stmt); sasql_stmt_reset($this->stmt);
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return sasql_stmt_field_count($this->stmt); return sasql_stmt_field_count($this->stmt);
...@@ -190,13 +184,10 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -190,13 +184,10 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement
switch ($fetchMode) { switch ($fetchMode) {
case FetchMode::COLUMN: case FetchMode::COLUMN:
return $this->fetchColumn(); return $this->fetchColumn();
case FetchMode::ASSOCIATIVE: case FetchMode::ASSOCIATIVE:
return sasql_fetch_assoc($this->result); return sasql_fetch_assoc($this->result);
case FetchMode::MIXED: case FetchMode::MIXED:
return sasql_fetch_array($this->result, SASQL_BOTH); return sasql_fetch_array($this->result, SASQL_BOTH);
case FetchMode::CUSTOM_OBJECT: case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass; $className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs; $ctorArgs = $this->defaultFetchClassCtorArgs;
...@@ -213,13 +204,10 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -213,13 +204,10 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement
} }
return $result; return $result;
case FetchMode::NUMERIC: case FetchMode::NUMERIC:
return sasql_fetch_row($this->result); return sasql_fetch_row($this->result);
case FetchMode::STANDARD_OBJECT: case FetchMode::STANDARD_OBJECT:
return sasql_fetch_object($this->result); return sasql_fetch_object($this->result);
default: default:
throw new SQLAnywhereException(sprintf('Fetch mode is not supported %d.', $fetchMode)); throw new SQLAnywhereException(sprintf('Fetch mode is not supported %d.', $fetchMode));
} }
...@@ -237,12 +225,14 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -237,12 +225,14 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement
while (($row = $this->fetch(...func_get_args())) !== false) { while (($row = $this->fetch(...func_get_args())) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
case FetchMode::COLUMN: case FetchMode::COLUMN:
while (($row = $this->fetchColumn()) !== false) { while (($row = $this->fetchColumn()) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
default: default:
...@@ -280,9 +270,6 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -280,9 +270,6 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement
return new StatementIterator($this); return new StatementIterator($this);
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
return sasql_stmt_affected_rows($this->stmt); return sasql_stmt_affected_rows($this->stmt);
......
...@@ -49,9 +49,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -49,9 +49,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
$this->lastInsertId = new LastInsertId(); $this->lastInsertId = new LastInsertId();
} }
/**
* {@inheritdoc}
*/
public function getServerVersion() : string public function getServerVersion() : string
{ {
$serverInfo = sqlsrv_server_info($this->conn); $serverInfo = sqlsrv_server_info($this->conn);
...@@ -59,17 +56,11 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -59,17 +56,11 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
return $serverInfo['SQLServerVersion']; return $serverInfo['SQLServerVersion'];
} }
/**
* {@inheritDoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
return new SQLSrvStatement($this->conn, $sql, $this->lastInsertId); return new SQLSrvStatement($this->conn, $sql, $this->lastInsertId);
} }
/**
* {@inheritDoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$stmt = $this->prepare($sql); $stmt = $this->prepare($sql);
...@@ -78,17 +69,11 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -78,17 +69,11 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
return $stmt; return $stmt;
} }
/**
* {@inheritDoc}
*/
public function quote(string $input) : string public function quote(string $input) : string
{ {
return "'" . str_replace("'", "''", $input) . "'"; return "'" . str_replace("'", "''", $input) . "'";
} }
/**
* {@inheritDoc}
*/
public function exec(string $statement) : int public function exec(string $statement) : int
{ {
$stmt = sqlsrv_query($this->conn, $statement); $stmt = sqlsrv_query($this->conn, $statement);
...@@ -106,9 +91,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -106,9 +91,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
return $rowsAffected; return $rowsAffected;
} }
/**
* {@inheritDoc}
*/
public function lastInsertId(?string $name = null) : string public function lastInsertId(?string $name = null) : string
{ {
if ($name !== null) { if ($name !== null) {
...@@ -121,9 +103,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -121,9 +103,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
return $stmt->fetchColumn(); return $stmt->fetchColumn();
} }
/**
* {@inheritDoc}
*/
public function beginTransaction() : void public function beginTransaction() : void
{ {
if (! sqlsrv_begin_transaction($this->conn)) { if (! sqlsrv_begin_transaction($this->conn)) {
...@@ -131,9 +110,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -131,9 +110,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritDoc}
*/
public function commit() : void public function commit() : void
{ {
if (! sqlsrv_commit($this->conn)) { if (! sqlsrv_commit($this->conn)) {
...@@ -141,9 +117,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection ...@@ -141,9 +117,6 @@ final class SQLSrvConnection implements ServerInfoAwareConnection
} }
} }
/**
* {@inheritDoc}
*/
public function rollBack() : void public function rollBack() : void
{ {
if (! sqlsrv_rollback($this->conn)) { if (! sqlsrv_rollback($this->conn)) {
......
...@@ -5,9 +5,9 @@ declare(strict_types=1); ...@@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Driver\SQLSrv; namespace Doctrine\DBAL\Driver\SQLSrv;
use Doctrine\DBAL\Driver\AbstractDriverException; use Doctrine\DBAL\Driver\AbstractDriverException;
use const SQLSRV_ERR_ERRORS;
use function rtrim; use function rtrim;
use function sqlsrv_errors; use function sqlsrv_errors;
use const SQLSRV_ERR_ERRORS;
class SQLSrvException extends AbstractDriverException class SQLSrvException extends AbstractDriverException
{ {
......
...@@ -10,11 +10,6 @@ use Doctrine\DBAL\Exception\InvalidColumnIndex; ...@@ -10,11 +10,6 @@ use Doctrine\DBAL\Exception\InvalidColumnIndex;
use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType; use Doctrine\DBAL\ParameterType;
use IteratorAggregate; use IteratorAggregate;
use const SQLSRV_ENC_BINARY;
use const SQLSRV_FETCH_ASSOC;
use const SQLSRV_FETCH_BOTH;
use const SQLSRV_FETCH_NUMERIC;
use const SQLSRV_PARAM_IN;
use function array_key_exists; use function array_key_exists;
use function assert; use function assert;
use function count; use function count;
...@@ -33,6 +28,11 @@ use function sqlsrv_prepare; ...@@ -33,6 +28,11 @@ use function sqlsrv_prepare;
use function sqlsrv_rows_affected; use function sqlsrv_rows_affected;
use function SQLSRV_SQLTYPE_VARBINARY; use function SQLSRV_SQLTYPE_VARBINARY;
use function stripos; use function stripos;
use const SQLSRV_ENC_BINARY;
use const SQLSRV_FETCH_ASSOC;
use const SQLSRV_FETCH_BOTH;
use const SQLSRV_FETCH_NUMERIC;
use const SQLSRV_PARAM_IN;
/** /**
* SQL Server Statement. * SQL Server Statement.
...@@ -166,9 +166,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -166,9 +166,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement
$this->stmt = null; $this->stmt = null;
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
// not having the result means there's nothing to close // not having the result means there's nothing to close
...@@ -186,9 +183,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -186,9 +183,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement
$this->result = false; $this->result = false;
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
if ($this->stmt === null) { if ($this->stmt === null) {
...@@ -306,12 +300,14 @@ final class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -306,12 +300,14 @@ final class SQLSrvStatement implements IteratorAggregate, Statement
while (($row = $this->fetch($fetchMode, ...$args)) !== false) { while (($row = $this->fetch($fetchMode, ...$args)) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
case FetchMode::COLUMN: case FetchMode::COLUMN:
while (($row = $this->fetchColumn()) !== false) { while (($row = $this->fetchColumn()) !== false) {
$rows[] = $row; $rows[] = $row;
} }
break; break;
default: default:
...@@ -341,9 +337,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement ...@@ -341,9 +337,6 @@ final class SQLSrvStatement implements IteratorAggregate, Statement
return $row[$columnIndex]; return $row[$columnIndex];
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
if ($this->stmt === null) { if ($this->stmt === null) {
......
...@@ -145,6 +145,7 @@ final class DriverManager ...@@ -145,6 +145,7 @@ final class DriverManager
if (! $config) { if (! $config) {
$config = new Configuration(); $config = new Configuration();
} }
if (! $eventManager) { if (! $eventManager) {
$eventManager = new EventManager(); $eventManager = new EventManager();
} }
...@@ -263,12 +264,15 @@ final class DriverManager ...@@ -263,12 +264,15 @@ final class DriverManager
if (isset($url['host'])) { if (isset($url['host'])) {
$params['host'] = $url['host']; $params['host'] = $url['host'];
} }
if (isset($url['port'])) { if (isset($url['port'])) {
$params['port'] = $url['port']; $params['port'] = $url['port'];
} }
if (isset($url['user'])) { if (isset($url['user'])) {
$params['user'] = $url['user']; $params['user'] = $url['user'];
} }
if (isset($url['pass'])) { if (isset($url['pass'])) {
$params['password'] = $url['pass']; $params['password'] = $url['pass'];
} }
......
...@@ -7,11 +7,11 @@ namespace Doctrine\DBAL\Event\Listeners; ...@@ -7,11 +7,11 @@ namespace Doctrine\DBAL\Event\Listeners;
use Doctrine\Common\EventSubscriber; use Doctrine\Common\EventSubscriber;
use Doctrine\DBAL\Event\ConnectionEventArgs; use Doctrine\DBAL\Event\ConnectionEventArgs;
use Doctrine\DBAL\Events; use Doctrine\DBAL\Events;
use const CASE_UPPER;
use function array_change_key_case; use function array_change_key_case;
use function array_merge; use function array_merge;
use function count; use function count;
use function implode; use function implode;
use const CASE_UPPER;
/** /**
* Should be used when Oracle Server default environment does not match the Doctrine requirements. * Should be used when Oracle Server default environment does not match the Doctrine requirements.
...@@ -57,6 +57,7 @@ class OracleSessionInit implements EventSubscriber ...@@ -57,6 +57,7 @@ class OracleSessionInit implements EventSubscriber
$vars[] = $option . " = '" . $value . "'"; $vars[] = $option . " = '" . $value . "'";
} }
} }
$sql = 'ALTER SESSION SET ' . implode(' ', $vars); $sql = 'ALTER SESSION SET ' . implode(' ', $vars);
$args->getConnection()->executeUpdate($sql); $args->getConnection()->executeUpdate($sql);
} }
......
...@@ -22,9 +22,6 @@ class DriverException extends DBALException implements DriverExceptionInterface ...@@ -22,9 +22,6 @@ class DriverException extends DBALException implements DriverExceptionInterface
parent::__construct($message, $driverException->getCode(), $driverException); parent::__construct($message, $driverException->getCode(), $driverException);
} }
/**
* {@inheritDoc}
*/
public function getSQLState() : ?string public function getSQLState() : ?string
{ {
$previous = $this->getPrevious(); $previous = $this->getPrevious();
......
...@@ -10,9 +10,9 @@ use Doctrine\DBAL\DriverManager; ...@@ -10,9 +10,9 @@ use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\FetchMode; use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\LockMode; use Doctrine\DBAL\LockMode;
use Throwable; use Throwable;
use const CASE_LOWER;
use function array_change_key_case; use function array_change_key_case;
use function sprintf; use function sprintf;
use const CASE_LOWER;
/** /**
* Table ID Generator for those poor languages that are missing sequences. * Table ID Generator for those poor languages that are missing sequences.
...@@ -71,6 +71,7 @@ class TableGenerator ...@@ -71,6 +71,7 @@ class TableGenerator
if ($params['driver'] === 'pdo_sqlite') { if ($params['driver'] === 'pdo_sqlite') {
throw new DBALException('Cannot use TableGenerator with SQLite.'); throw new DBALException('Cannot use TableGenerator with SQLite.');
} }
$this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager()); $this->conn = DriverManager::getConnection($params, $conn->getConfiguration(), $conn->getEventManager());
$this->generatorTableName = $generatorTableName; $this->generatorTableName = $generatorTableName;
} }
...@@ -134,6 +135,7 @@ class TableGenerator ...@@ -134,6 +135,7 @@ class TableGenerator
$this->conn->commit(); $this->conn->commit();
} catch (Throwable $e) { } catch (Throwable $e) {
$this->conn->rollBack(); $this->conn->rollBack();
throw new DBALException(sprintf('Error occurred while generating ID with TableGenerator, aborted generation with error: %s', $e->getMessage()), 0, $e); throw new DBALException(sprintf('Error occurred while generating ID with TableGenerator, aborted generation with error: %s', $e->getMessage()), 0, $e);
} }
......
...@@ -22,9 +22,6 @@ final class TableGeneratorSchemaVisitor implements Visitor ...@@ -22,9 +22,6 @@ final class TableGeneratorSchemaVisitor implements Visitor
$this->generatorTableName = $generatorTableName; $this->generatorTableName = $generatorTableName;
} }
/**
* {@inheritdoc}
*/
public function acceptSchema(Schema $schema) : void public function acceptSchema(Schema $schema) : void
{ {
$table = $schema->createTable($this->generatorTableName); $table = $schema->createTable($this->generatorTableName);
...@@ -34,37 +31,22 @@ final class TableGeneratorSchemaVisitor implements Visitor ...@@ -34,37 +31,22 @@ final class TableGeneratorSchemaVisitor implements Visitor
$table->addColumn('sequence_increment_by', 'integer', ['default' => 1]); $table->addColumn('sequence_increment_by', 'integer', ['default' => 1]);
} }
/**
* {@inheritdoc}
*/
public function acceptTable(Table $table) : void public function acceptTable(Table $table) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptColumn(Table $table, Column $column) : void public function acceptColumn(Table $table, Column $column) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptIndex(Table $table, Index $index) : void public function acceptIndex(Table $table, Index $index) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptSequence(Sequence $sequence) : void public function acceptSequence(Sequence $sequence) : void
{ {
} }
......
...@@ -44,9 +44,6 @@ final class DebugStack implements SQLLogger ...@@ -44,9 +44,6 @@ final class DebugStack implements SQLLogger
$this->queries[++$this->currentQuery] = ['sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0]; $this->queries[++$this->currentQuery] = ['sql' => $sql, 'params' => $params, 'types' => $types, 'executionMS' => 0];
} }
/**
* {@inheritdoc}
*/
public function stopQuery() : void public function stopQuery() : void
{ {
if (! $this->enabled) { if (! $this->enabled) {
......
...@@ -4,8 +4,8 @@ declare(strict_types=1); ...@@ -4,8 +4,8 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Logging; namespace Doctrine\DBAL\Logging;
use const PHP_EOL;
use function var_dump; use function var_dump;
use const PHP_EOL;
/** /**
* A SQL logger that logs to the standard output using echo/var_dump. * A SQL logger that logs to the standard output using echo/var_dump.
...@@ -30,9 +30,6 @@ final class EchoSQLLogger implements SQLLogger ...@@ -30,9 +30,6 @@ final class EchoSQLLogger implements SQLLogger
var_dump($types); var_dump($types);
} }
/**
* {@inheritdoc}
*/
public function stopQuery() : void public function stopQuery() : void
{ {
} }
......
...@@ -30,9 +30,6 @@ final class LoggerChain implements SQLLogger ...@@ -30,9 +30,6 @@ final class LoggerChain implements SQLLogger
} }
} }
/**
* {@inheritdoc}
*/
public function stopQuery() : void public function stopQuery() : void
{ {
foreach ($this->loggers as $logger) { foreach ($this->loggers as $logger) {
......
...@@ -18,9 +18,6 @@ final class NullLogger implements SQLLogger ...@@ -18,9 +18,6 @@ final class NullLogger implements SQLLogger
{ {
} }
/**
* {@inheritdoc}
*/
public function stopQuery() : void public function stopQuery() : void
{ {
} }
......
...@@ -1300,7 +1300,7 @@ abstract class AbstractPlatform ...@@ -1300,7 +1300,7 @@ abstract class AbstractPlatform
if (($createFlags & self::CREATE_INDEXES) > 0) { if (($createFlags & self::CREATE_INDEXES) > 0) {
foreach ($table->getIndexes() as $index) { foreach ($table->getIndexes() as $index) {
/** @var $index Index */ assert($index instanceof Index);
if (! $index->isPrimary()) { if (! $index->isPrimary()) {
$options['indexes'][$index->getQuotedName($this)] = $index; $options['indexes'][$index->getQuotedName($this)] = $index;
...@@ -1366,6 +1366,7 @@ abstract class AbstractPlatform ...@@ -1366,6 +1366,7 @@ abstract class AbstractPlatform
if ($table->hasOption('comment')) { if ($table->hasOption('comment')) {
$sql[] = $this->getCommentOnTableSQL($tableName, $table->getOption('comment')); $sql[] = $this->getCommentOnTableSQL($tableName, $table->getOption('comment'));
} }
foreach ($table->getColumns() as $column) { foreach ($table->getColumns() as $column) {
$comment = $this->getColumnComment($column); $comment = $this->getColumnComment($column);
...@@ -1452,6 +1453,7 @@ abstract class AbstractPlatform ...@@ -1452,6 +1453,7 @@ abstract class AbstractPlatform
if (! empty($check)) { if (! empty($check)) {
$query .= ', ' . $check; $query .= ', ' . $check;
} }
$query .= ')'; $query .= ')';
$sql = [$query]; $sql = [$query];
...@@ -1524,6 +1526,7 @@ abstract class AbstractPlatform ...@@ -1524,6 +1526,7 @@ abstract class AbstractPlatform
$referencesClause = ' REFERENCES ' . $constraint->getQuotedForeignTableName($this) . $referencesClause = ' REFERENCES ' . $constraint->getQuotedForeignTableName($this) .
' (' . implode(', ', $constraint->getQuotedForeignColumns($this)) . ')'; ' (' . implode(', ', $constraint->getQuotedForeignColumns($this)) . ')';
} }
$query .= ' ' . $columnList . $referencesClause; $query .= ' ' . $columnList . $referencesClause;
return $query; return $query;
...@@ -1541,6 +1544,7 @@ abstract class AbstractPlatform ...@@ -1541,6 +1544,7 @@ abstract class AbstractPlatform
if ($table instanceof Table) { if ($table instanceof Table) {
$table = $table->getQuotedName($this); $table = $table->getQuotedName($this);
} }
$name = $index->getQuotedName($this); $name = $index->getQuotedName($this);
$columns = $index->getColumns(); $columns = $index->getColumns();
...@@ -1786,6 +1790,7 @@ abstract class AbstractPlatform ...@@ -1786,6 +1790,7 @@ abstract class AbstractPlatform
foreach ($diff->removedForeignKeys as $foreignKey) { foreach ($diff->removedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
} }
foreach ($diff->changedForeignKeys as $foreignKey) { foreach ($diff->changedForeignKeys as $foreignKey) {
$sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName); $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
} }
...@@ -1794,6 +1799,7 @@ abstract class AbstractPlatform ...@@ -1794,6 +1799,7 @@ abstract class AbstractPlatform
foreach ($diff->removedIndexes as $index) { foreach ($diff->removedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName); $sql[] = $this->getDropIndexSQL($index, $tableName);
} }
foreach ($diff->changedIndexes as $index) { foreach ($diff->changedIndexes as $index) {
$sql[] = $this->getDropIndexSQL($index, $tableName); $sql[] = $this->getDropIndexSQL($index, $tableName);
} }
...@@ -2215,6 +2221,7 @@ abstract class AbstractPlatform ...@@ -2215,6 +2221,7 @@ abstract class AbstractPlatform
if ($this->supportsForeignKeyOnUpdate() && $foreignKey->hasOption('onUpdate')) { if ($this->supportsForeignKeyOnUpdate() && $foreignKey->hasOption('onUpdate')) {
$query .= ' ON UPDATE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onUpdate')); $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onUpdate'));
} }
if ($foreignKey->hasOption('onDelete')) { if ($foreignKey->hasOption('onDelete')) {
$query .= ' ON DELETE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete')); $query .= ' ON DELETE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete'));
} }
...@@ -2256,14 +2263,17 @@ abstract class AbstractPlatform ...@@ -2256,14 +2263,17 @@ abstract class AbstractPlatform
if ($foreignKey->getName() !== '') { if ($foreignKey->getName() !== '') {
$sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' '; $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
} }
$sql .= 'FOREIGN KEY ('; $sql .= 'FOREIGN KEY (';
if (count($foreignKey->getLocalColumns()) === 0) { if (count($foreignKey->getLocalColumns()) === 0) {
throw new InvalidArgumentException('Incomplete definition. "local" required.'); throw new InvalidArgumentException('Incomplete definition. "local" required.');
} }
if (count($foreignKey->getForeignColumns()) === 0) { if (count($foreignKey->getForeignColumns()) === 0) {
throw new InvalidArgumentException('Incomplete definition. "foreign" required.'); throw new InvalidArgumentException('Incomplete definition. "foreign" required.');
} }
if (strlen($foreignKey->getForeignTableName()) === 0) { if (strlen($foreignKey->getForeignTableName()) === 0) {
throw new InvalidArgumentException('Incomplete definition. "foreignTable" required.'); throw new InvalidArgumentException('Incomplete definition. "foreignTable" required.');
} }
......
...@@ -31,9 +31,6 @@ class DB2Platform extends AbstractPlatform ...@@ -31,9 +31,6 @@ class DB2Platform extends AbstractPlatform
return 'BLOB(1M)'; return 'BLOB(1M)';
} }
/**
* {@inheritDoc}
*/
public function initializeDoctrineTypeMappings() : void public function initializeDoctrineTypeMappings() : void
{ {
$this->doctrineTypeMapping = [ $this->doctrineTypeMapping = [
...@@ -55,9 +52,6 @@ class DB2Platform extends AbstractPlatform ...@@ -55,9 +52,6 @@ class DB2Platform extends AbstractPlatform
]; ];
} }
/**
* {@inheritdoc}
*/
public function isCommentedDoctrineType(Type $doctrineType) : bool public function isCommentedDoctrineType(Type $doctrineType) : bool
{ {
if ($doctrineType->getName() === Types::BOOLEAN) { if ($doctrineType->getName() === Types::BOOLEAN) {
...@@ -69,17 +63,11 @@ class DB2Platform extends AbstractPlatform ...@@ -69,17 +63,11 @@ class DB2Platform extends AbstractPlatform
return parent::isCommentedDoctrineType($doctrineType); return parent::isCommentedDoctrineType($doctrineType);
} }
/**
* {@inheritDoc}
*/
protected function getBinaryTypeDeclarationSQLSnippet(?int $length) : string protected function getBinaryTypeDeclarationSQLSnippet(?int $length) : string
{ {
return $this->getCharTypeDeclarationSQLSnippet($length) . ' FOR BIT DATA'; return $this->getCharTypeDeclarationSQLSnippet($length) . ' FOR BIT DATA';
} }
/**
* {@inheritDoc}
*/
protected function getVarbinaryTypeDeclarationSQLSnippet(?int $length) : string protected function getVarbinaryTypeDeclarationSQLSnippet(?int $length) : string
{ {
return $this->getVarcharTypeDeclarationSQLSnippet($length) . ' FOR BIT DATA'; return $this->getVarcharTypeDeclarationSQLSnippet($length) . ' FOR BIT DATA';
...@@ -94,9 +82,6 @@ class DB2Platform extends AbstractPlatform ...@@ -94,9 +82,6 @@ class DB2Platform extends AbstractPlatform
return 'CLOB(1M)'; return 'CLOB(1M)';
} }
/**
* {@inheritDoc}
*/
public function getName() : string public function getName() : string
{ {
return 'db2'; return 'db2';
...@@ -147,25 +132,16 @@ class DB2Platform extends AbstractPlatform ...@@ -147,25 +132,16 @@ class DB2Platform extends AbstractPlatform
return $autoinc; return $autoinc;
} }
/**
* {@inheritdoc}
*/
public function getBitAndComparisonExpression(string $value1, string $value2) : string public function getBitAndComparisonExpression(string $value1, string $value2) : string
{ {
return 'BITAND(' . $value1 . ', ' . $value2 . ')'; return 'BITAND(' . $value1 . ', ' . $value2 . ')';
} }
/**
* {@inheritdoc}
*/
public function getBitOrComparisonExpression(string $value1, string $value2) : string public function getBitOrComparisonExpression(string $value1, string $value2) : string
{ {
return 'BITOR(' . $value1 . ', ' . $value2 . ')'; return 'BITOR(' . $value1 . ', ' . $value2 . ')';
} }
/**
* {@inheritdoc}
*/
protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string
{ {
switch ($unit) { switch ($unit) {
...@@ -183,9 +159,6 @@ class DB2Platform extends AbstractPlatform ...@@ -183,9 +159,6 @@ class DB2Platform extends AbstractPlatform
return $date . ' ' . $operator . ' ' . $interval . ' ' . $unit; return $date . ' ' . $operator . ' ' . $interval . ' ' . $unit;
} }
/**
* {@inheritdoc}
*/
public function getDateDiffExpression(string $date1, string $date2) : string public function getDateDiffExpression(string $date1, string $date2) : string
{ {
return 'DAYS(' . $date1 . ') - DAYS(' . $date2 . ')'; return 'DAYS(' . $date1 . ') - DAYS(' . $date2 . ')';
...@@ -219,9 +192,6 @@ class DB2Platform extends AbstractPlatform ...@@ -219,9 +192,6 @@ class DB2Platform extends AbstractPlatform
return 'TIME'; return 'TIME';
} }
/**
* {@inheritdoc}
*/
public function getTruncateTableSQL(string $tableName, bool $cascade = false) : string public function getTruncateTableSQL(string $tableName, bool $cascade = false) : string
{ {
$tableIdentifier = new Identifier($tableName); $tableIdentifier = new Identifier($tableName);
...@@ -280,25 +250,16 @@ class DB2Platform extends AbstractPlatform ...@@ -280,25 +250,16 @@ class DB2Platform extends AbstractPlatform
'; ';
} }
/**
* {@inheritDoc}
*/
public function getListTablesSQL() : string public function getListTablesSQL() : string
{ {
return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'"; return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'";
} }
/**
* {@inheritDoc}
*/
public function getListViewsSQL(string $database) : string public function getListViewsSQL(string $database) : string
{ {
return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS'; return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS';
} }
/**
* {@inheritDoc}
*/
public function getListTableIndexesSQL(string $table, ?string $currentDatabase = null) : string public function getListTableIndexesSQL(string $table, ?string $currentDatabase = null) : string
{ {
$table = $this->quoteStringLiteral($table); $table = $this->quoteStringLiteral($table);
...@@ -320,9 +281,6 @@ class DB2Platform extends AbstractPlatform ...@@ -320,9 +281,6 @@ class DB2Platform extends AbstractPlatform
ORDER BY idxcol.COLSEQ ASC'; ORDER BY idxcol.COLSEQ ASC';
} }
/**
* {@inheritDoc}
*/
public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string
{ {
$table = $this->quoteStringLiteral($table); $table = $this->quoteStringLiteral($table);
...@@ -354,89 +312,56 @@ class DB2Platform extends AbstractPlatform ...@@ -354,89 +312,56 @@ class DB2Platform extends AbstractPlatform
ORDER BY fkcol.COLSEQ ASC'; ORDER BY fkcol.COLSEQ ASC';
} }
/**
* {@inheritDoc}
*/
public function getCreateViewSQL(string $name, string $sql) : string public function getCreateViewSQL(string $name, string $sql) : string
{ {
return 'CREATE VIEW ' . $name . ' AS ' . $sql; return 'CREATE VIEW ' . $name . ' AS ' . $sql;
} }
/**
* {@inheritDoc}
*/
public function getDropViewSQL(string $name) : string public function getDropViewSQL(string $name) : string
{ {
return 'DROP VIEW ' . $name; return 'DROP VIEW ' . $name;
} }
/**
* {@inheritDoc}
*/
public function getCreateDatabaseSQL(string $database) : string public function getCreateDatabaseSQL(string $database) : string
{ {
return 'CREATE DATABASE ' . $database; return 'CREATE DATABASE ' . $database;
} }
/**
* {@inheritDoc}
*/
public function getDropDatabaseSQL(string $database) : string public function getDropDatabaseSQL(string $database) : string
{ {
return 'DROP DATABASE ' . $database; return 'DROP DATABASE ' . $database;
} }
/**
* {@inheritDoc}
*/
public function supportsCreateDropDatabase() : bool public function supportsCreateDropDatabase() : bool
{ {
return false; return false;
} }
/**
* {@inheritDoc}
*/
public function supportsReleaseSavepoints() : bool public function supportsReleaseSavepoints() : bool
{ {
return false; return false;
} }
/**
* {@inheritdoc}
*/
public function supportsCommentOnStatement() : bool public function supportsCommentOnStatement() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function getCurrentDateSQL() : string public function getCurrentDateSQL() : string
{ {
return 'CURRENT DATE'; return 'CURRENT DATE';
} }
/**
* {@inheritDoc}
*/
public function getCurrentTimeSQL() : string public function getCurrentTimeSQL() : string
{ {
return 'CURRENT TIME'; return 'CURRENT TIME';
} }
/**
* {@inheritDoc}
*/
public function getCurrentTimestampSQL() : string public function getCurrentTimestampSQL() : string
{ {
return 'CURRENT TIMESTAMP'; return 'CURRENT TIMESTAMP';
} }
/**
* {@inheritDoc}
*/
public function getIndexDeclarationSQL(string $name, Index $index) : string public function getIndexDeclarationSQL(string $name, Index $index) : string
{ {
// Index declaration in statements like CREATE TABLE is not supported. // Index declaration in statements like CREATE TABLE is not supported.
...@@ -452,6 +377,7 @@ class DB2Platform extends AbstractPlatform ...@@ -452,6 +377,7 @@ class DB2Platform extends AbstractPlatform
if (isset($options['indexes'])) { if (isset($options['indexes'])) {
$indexes = $options['indexes']; $indexes = $options['indexes'];
} }
$options['indexes'] = []; $options['indexes'] = [];
$sqls = parent::_getCreateTableSQL($tableName, $columns, $options); $sqls = parent::_getCreateTableSQL($tableName, $columns, $options);
...@@ -719,33 +645,21 @@ class DB2Platform extends AbstractPlatform ...@@ -719,33 +645,21 @@ class DB2Platform extends AbstractPlatform
return parent::getDefaultValueDeclarationSQL($field); return parent::getDefaultValueDeclarationSQL($field);
} }
/**
* {@inheritDoc}
*/
public function getEmptyIdentityInsertSQL(string $tableName, string $identifierColumnName) : string public function getEmptyIdentityInsertSQL(string $tableName, string $identifierColumnName) : string
{ {
return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)'; return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
} }
/**
* {@inheritDoc}
*/
public function getCreateTemporaryTableSnippetSQL() : string public function getCreateTemporaryTableSnippetSQL() : string
{ {
return 'DECLARE GLOBAL TEMPORARY TABLE'; return 'DECLARE GLOBAL TEMPORARY TABLE';
} }
/**
* {@inheritDoc}
*/
public function getTemporaryTableName(string $tableName) : string public function getTemporaryTableName(string $tableName) : string
{ {
return 'SESSION.' . $tableName; return 'SESSION.' . $tableName;
} }
/**
* {@inheritDoc}
*/
protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string
{ {
$where = []; $where = [];
...@@ -770,9 +684,6 @@ class DB2Platform extends AbstractPlatform ...@@ -770,9 +684,6 @@ class DB2Platform extends AbstractPlatform
); );
} }
/**
* {@inheritDoc}
*/
public function getLocateExpression(string $string, string $substring, ?string $start = null) : string public function getLocateExpression(string $string, string $substring, ?string $start = null) : string
{ {
if ($start === null) { if ($start === null) {
...@@ -782,9 +693,6 @@ class DB2Platform extends AbstractPlatform ...@@ -782,9 +693,6 @@ class DB2Platform extends AbstractPlatform
return sprintf('LOCATE(%s, %s, %s)', $substring, $string, $start); return sprintf('LOCATE(%s, %s, %s)', $substring, $string, $start);
} }
/**
* {@inheritDoc}
*/
public function getSubstringExpression(string $string, string $start, ?string $length = null) : string public function getSubstringExpression(string $string, string $start, ?string $length = null) : string
{ {
if ($length === null) { if ($length === null) {
...@@ -794,25 +702,16 @@ class DB2Platform extends AbstractPlatform ...@@ -794,25 +702,16 @@ class DB2Platform extends AbstractPlatform
return sprintf('SUBSTR(%s, %s, %s)', $string, $start, $length); return sprintf('SUBSTR(%s, %s, %s)', $string, $start, $length);
} }
/**
* {@inheritDoc}
*/
public function getCurrentDatabaseExpression() : string public function getCurrentDatabaseExpression() : string
{ {
return 'CURRENT_USER'; return 'CURRENT_USER';
} }
/**
* {@inheritDoc}
*/
public function supportsIdentityColumns() : bool public function supportsIdentityColumns() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function prefersIdentityColumns() : bool public function prefersIdentityColumns() : bool
{ {
return true; return true;
...@@ -828,17 +727,11 @@ class DB2Platform extends AbstractPlatform ...@@ -828,17 +727,11 @@ class DB2Platform extends AbstractPlatform
return strtoupper($column); return strtoupper($column);
} }
/**
* {@inheritDoc}
*/
public function getForUpdateSQL() : string public function getForUpdateSQL() : string
{ {
return ' WITH RR USE AND KEEP UPDATE LOCKS'; return ' WITH RR USE AND KEEP UPDATE LOCKS';
} }
/**
* {@inheritDoc}
*/
public function getDummySelectSQL(string $expression = '1') : string public function getDummySelectSQL(string $expression = '1') : string
{ {
return sprintf('SELECT %s FROM sysibm.sysdummy1', $expression); return sprintf('SELECT %s FROM sysibm.sysdummy1', $expression);
...@@ -856,9 +749,6 @@ class DB2Platform extends AbstractPlatform ...@@ -856,9 +749,6 @@ class DB2Platform extends AbstractPlatform
return false; return false;
} }
/**
* {@inheritDoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\DB2Keywords::class; return Keywords\DB2Keywords::class;
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class DB2Keywords extends KeywordList class DB2Keywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'DB2'; return 'DB2';
......
...@@ -11,9 +11,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -11,9 +11,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
final class MariaDb102Keywords extends MySQLKeywords final class MariaDb102Keywords extends MySQLKeywords
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'MariaDb102'; return 'MariaDb102';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class MySQL57Keywords extends MySQLKeywords class MySQL57Keywords extends MySQLKeywords
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'MySQL57'; return 'MySQL57';
......
...@@ -11,9 +11,6 @@ use function array_merge; ...@@ -11,9 +11,6 @@ use function array_merge;
*/ */
class MySQL80Keywords extends MySQL57Keywords class MySQL80Keywords extends MySQL57Keywords
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'MySQL80'; return 'MySQL80';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class MySQLKeywords extends KeywordList class MySQLKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'MySQL'; return 'MySQL';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class OracleKeywords extends KeywordList class OracleKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'Oracle'; return 'Oracle';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class PostgreSQL100Keywords extends PostgreSQLKeywords class PostgreSQL100Keywords extends PostgreSQLKeywords
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'PostgreSQL100'; return 'PostgreSQL100';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class PostgreSQLKeywords extends KeywordList class PostgreSQLKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'PostgreSQL'; return 'PostgreSQL';
......
...@@ -71,9 +71,6 @@ class ReservedKeywordsValidator implements Visitor ...@@ -71,9 +71,6 @@ class ReservedKeywordsValidator implements Visitor
$this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms); $this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
} }
/**
* {@inheritdoc}
*/
public function acceptColumn(Table $table, Column $column) : void public function acceptColumn(Table $table, Column $column) : void
{ {
$this->addViolation( $this->addViolation(
...@@ -82,37 +79,22 @@ class ReservedKeywordsValidator implements Visitor ...@@ -82,37 +79,22 @@ class ReservedKeywordsValidator implements Visitor
); );
} }
/**
* {@inheritdoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptIndex(Table $table, Index $index) : void public function acceptIndex(Table $table, Index $index) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptSchema(Schema $schema) : void public function acceptSchema(Schema $schema) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptSequence(Sequence $sequence) : void public function acceptSequence(Sequence $sequence) : void
{ {
} }
/**
* {@inheritdoc}
*/
public function acceptTable(Table $table) : void public function acceptTable(Table $table) : void
{ {
$this->addViolation( $this->addViolation(
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class SQLAnywhereKeywords extends KeywordList class SQLAnywhereKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'SQLAnywhere'; return 'SQLAnywhere';
......
...@@ -11,9 +11,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -11,9 +11,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class SQLServerKeywords extends KeywordList class SQLServerKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'SQLServer'; return 'SQLServer';
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms\Keywords;
*/ */
class SQLiteKeywords extends KeywordList class SQLiteKeywords extends KeywordList
{ {
/**
* {@inheritdoc}
*/
public function getName() : string public function getName() : string
{ {
return 'SQLite'; return 'SQLite';
......
...@@ -23,17 +23,11 @@ final class MariaDb1027Platform extends MySqlPlatform ...@@ -23,17 +23,11 @@ final class MariaDb1027Platform extends MySqlPlatform
return 'LONGTEXT'; return 'LONGTEXT';
} }
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\MariaDb102Keywords::class; return Keywords\MariaDb102Keywords::class;
} }
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings() : void protected function initializeDoctrineTypeMappings() : void
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
......
...@@ -13,9 +13,6 @@ use Doctrine\DBAL\Types\Types; ...@@ -13,9 +13,6 @@ use Doctrine\DBAL\Types\Types;
*/ */
class MySQL57Platform extends MySqlPlatform class MySQL57Platform extends MySqlPlatform
{ {
/**
* {@inheritdoc}
*/
public function hasNativeJsonType() : bool public function hasNativeJsonType() : bool
{ {
return true; return true;
...@@ -53,17 +50,11 @@ class MySQL57Platform extends MySqlPlatform ...@@ -53,17 +50,11 @@ class MySQL57Platform extends MySqlPlatform
return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)]; return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)];
} }
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\MySQL57Keywords::class; return Keywords\MySQL57Keywords::class;
} }
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings() : void protected function initializeDoctrineTypeMappings() : void
{ {
parent::initializeDoctrineTypeMappings(); parent::initializeDoctrineTypeMappings();
......
...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms; ...@@ -9,9 +9,6 @@ namespace Doctrine\DBAL\Platforms;
*/ */
class MySQL80Platform extends MySQL57Platform class MySQL80Platform extends MySQL57Platform
{ {
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\MySQL80Keywords::class; return Keywords\MySQL80Keywords::class;
......
...@@ -44,9 +44,6 @@ class MySqlPlatform extends AbstractPlatform ...@@ -44,9 +44,6 @@ class MySqlPlatform extends AbstractPlatform
public const LENGTH_LIMIT_BLOB = 65535; public const LENGTH_LIMIT_BLOB = 65535;
public const LENGTH_LIMIT_MEDIUMBLOB = 16777215; public const LENGTH_LIMIT_MEDIUMBLOB = 16777215;
/**
* {@inheritDoc}
*/
protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string
{ {
if ($limit !== null) { if ($limit !== null) {
...@@ -63,25 +60,16 @@ class MySqlPlatform extends AbstractPlatform ...@@ -63,25 +60,16 @@ class MySqlPlatform extends AbstractPlatform
return $query; return $query;
} }
/**
* {@inheritDoc}
*/
public function getIdentifierQuoteCharacter() : string public function getIdentifierQuoteCharacter() : string
{ {
return '`'; return '`';
} }
/**
* {@inheritDoc}
*/
public function getRegexpExpression() : string public function getRegexpExpression() : string
{ {
return 'RLIKE'; return 'RLIKE';
} }
/**
* {@inheritDoc}
*/
public function getLocateExpression(string $string, string $substring, ?string $start = null) : string public function getLocateExpression(string $string, string $substring, ?string $start = null) : string
{ {
if ($start === null) { if ($start === null) {
...@@ -91,17 +79,11 @@ class MySqlPlatform extends AbstractPlatform ...@@ -91,17 +79,11 @@ class MySqlPlatform extends AbstractPlatform
return sprintf('LOCATE(%s, %s, %s)', $substring, $string, $start); return sprintf('LOCATE(%s, %s, %s)', $substring, $string, $start);
} }
/**
* {@inheritDoc}
*/
public function getConcatExpression(string ...$string) : string public function getConcatExpression(string ...$string) : string
{ {
return sprintf('CONCAT(%s)', implode(', ', $string)); return sprintf('CONCAT(%s)', implode(', ', $string));
} }
/**
* {@inheritdoc}
*/
protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string
{ {
$function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB'; $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB';
...@@ -109,33 +91,21 @@ class MySqlPlatform extends AbstractPlatform ...@@ -109,33 +91,21 @@ class MySqlPlatform extends AbstractPlatform
return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')'; return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')';
} }
/**
* {@inheritDoc}
*/
public function getDateDiffExpression(string $date1, string $date2) : string public function getDateDiffExpression(string $date1, string $date2) : string
{ {
return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')'; return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')';
} }
/**
* {@inheritDoc}
*/
public function getCurrentDatabaseExpression() : string public function getCurrentDatabaseExpression() : string
{ {
return 'DATABASE()'; return 'DATABASE()';
} }
/**
* {@inheritDoc}
*/
public function getListDatabasesSQL() : string public function getListDatabasesSQL() : string
{ {
return 'SHOW DATABASES'; return 'SHOW DATABASES';
} }
/**
* {@inheritDoc}
*/
public function getListTableConstraintsSQL(string $table) : string public function getListTableConstraintsSQL(string $table) : string
{ {
return 'SHOW INDEX FROM ' . $table; return 'SHOW INDEX FROM ' . $table;
...@@ -163,17 +133,11 @@ class MySqlPlatform extends AbstractPlatform ...@@ -163,17 +133,11 @@ class MySqlPlatform extends AbstractPlatform
return 'SHOW INDEX FROM ' . $table; return 'SHOW INDEX FROM ' . $table;
} }
/**
* {@inheritDoc}
*/
public function getListViewsSQL(string $database) : string public function getListViewsSQL(string $database) : string
{ {
return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $this->quoteStringLiteral($database); return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $this->quoteStringLiteral($database);
} }
/**
* {@inheritDoc}
*/
public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string
{ {
$table = $this->quoteStringLiteral($table); $table = $this->quoteStringLiteral($table);
...@@ -193,17 +157,11 @@ class MySqlPlatform extends AbstractPlatform ...@@ -193,17 +157,11 @@ class MySqlPlatform extends AbstractPlatform
return $sql; return $sql;
} }
/**
* {@inheritDoc}
*/
public function getCreateViewSQL(string $name, string $sql) : string public function getCreateViewSQL(string $name, string $sql) : string
{ {
return 'CREATE VIEW ' . $name . ' AS ' . $sql; return 'CREATE VIEW ' . $name . ' AS ' . $sql;
} }
/**
* {@inheritDoc}
*/
public function getDropViewSQL(string $name) : string public function getDropViewSQL(string $name) : string
{ {
return 'DROP VIEW ' . $name; return 'DROP VIEW ' . $name;
...@@ -296,33 +254,21 @@ class MySqlPlatform extends AbstractPlatform ...@@ -296,33 +254,21 @@ class MySqlPlatform extends AbstractPlatform
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsInlineColumnComments() : bool public function supportsInlineColumnComments() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsColumnCollation() : bool public function supportsColumnCollation() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function getListTablesSQL() : string public function getListTablesSQL() : string
{ {
return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'"; return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'";
} }
/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL(string $table, ?string $database = null) : string public function getListTableColumnsSQL(string $table, ?string $database = null) : string
{ {
return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' . return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' .
...@@ -346,17 +292,11 @@ SQL ...@@ -346,17 +292,11 @@ SQL
); );
} }
/**
* {@inheritDoc}
*/
public function getCreateDatabaseSQL(string $database) : string public function getCreateDatabaseSQL(string $database) : string
{ {
return 'CREATE DATABASE ' . $database; return 'CREATE DATABASE ' . $database;
} }
/**
* {@inheritDoc}
*/
public function getDropDatabaseSQL(string $database) : string public function getDropDatabaseSQL(string $database) : string
{ {
return 'DROP DATABASE ' . $database; return 'DROP DATABASE ' . $database;
...@@ -580,6 +520,7 @@ SQL ...@@ -580,6 +520,7 @@ SQL
if (count($queryParts) > 0) { if (count($queryParts) > 0) {
$sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(', ', $queryParts); $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(', ', $queryParts);
} }
$sql = array_merge( $sql = array_merge(
$this->getPreAlterTableIndexForeignKeySQL($diff), $this->getPreAlterTableIndexForeignKeySQL($diff),
$sql, $sql,
...@@ -823,9 +764,6 @@ SQL ...@@ -823,9 +764,6 @@ SQL
return $sql; return $sql;
} }
/**
* {@inheritDoc}
*/
protected function getCreateIndexSQLFlags(Index $index) : string protected function getCreateIndexSQLFlags(Index $index) : string
{ {
$type = ''; $type = '';
...@@ -903,31 +841,23 @@ SQL ...@@ -903,31 +841,23 @@ SQL
return $this->getUnsignedDeclaration($columnDef) . $autoinc; return $this->getUnsignedDeclaration($columnDef) . $autoinc;
} }
/**
* {@inheritDoc}
*/
public function getColumnCharsetDeclarationSQL(string $charset) : string public function getColumnCharsetDeclarationSQL(string $charset) : string
{ {
return 'CHARACTER SET ' . $charset; return 'CHARACTER SET ' . $charset;
} }
/**
* {@inheritDoc}
*/
public function getColumnCollationDeclarationSQL(string $collation) : string public function getColumnCollationDeclarationSQL(string $collation) : string
{ {
return 'COLLATE ' . $this->quoteSingleIdentifier($collation); return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
} }
/**
* {@inheritDoc}
*/
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) : string public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) : string
{ {
$query = ''; $query = '';
if ($foreignKey->hasOption('match')) { if ($foreignKey->hasOption('match')) {
$query .= ' MATCH ' . $foreignKey->getOption('match'); $query .= ' MATCH ' . $foreignKey->getOption('match');
} }
$query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey); $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
return $query; return $query;
...@@ -966,33 +896,21 @@ SQL ...@@ -966,33 +896,21 @@ SQL
return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY'; return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
} }
/**
* {@inheritDoc}
*/
public function getSetTransactionIsolationSQL(int $level) : string public function getSetTransactionIsolationSQL(int $level) : string
{ {
return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level); return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
} }
/**
* {@inheritDoc}
*/
public function getName() : string public function getName() : string
{ {
return 'mysql'; return 'mysql';
} }
/**
* {@inheritDoc}
*/
public function getReadLockSQL() : string public function getReadLockSQL() : string
{ {
return 'LOCK IN SHARE MODE'; return 'LOCK IN SHARE MODE';
} }
/**
* {@inheritDoc}
*/
protected function initializeDoctrineTypeMappings() : void protected function initializeDoctrineTypeMappings() : void
{ {
$this->doctrineTypeMapping = [ $this->doctrineTypeMapping = [
...@@ -1029,9 +947,6 @@ SQL ...@@ -1029,9 +947,6 @@ SQL
]; ];
} }
/**
* {@inheritDoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\MySQLKeywords::class; return Keywords\MySQLKeywords::class;
...@@ -1084,9 +999,6 @@ SQL ...@@ -1084,9 +999,6 @@ SQL
return 'LONGBLOB'; return 'LONGBLOB';
} }
/**
* {@inheritdoc}
*/
public function quoteStringLiteral(string $str) : string public function quoteStringLiteral(string $str) : string
{ {
$str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped aswell. $str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped aswell.
...@@ -1094,17 +1006,11 @@ SQL ...@@ -1094,17 +1006,11 @@ SQL
return parent::quoteStringLiteral($str); return parent::quoteStringLiteral($str);
} }
/**
* {@inheritdoc}
*/
public function getDefaultTransactionIsolationLevel() : int public function getDefaultTransactionIsolationLevel() : int
{ {
return TransactionIsolationLevel::REPEATABLE_READ; return TransactionIsolationLevel::REPEATABLE_READ;
} }
/**
* {@inheritdoc}
*/
public function supportsColumnLengthIndexes() : bool public function supportsColumnLengthIndexes() : bool
{ {
return true; return true;
......
...@@ -11,9 +11,6 @@ use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords; ...@@ -11,9 +11,6 @@ use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
*/ */
class PostgreSQL100Platform extends PostgreSqlPlatform class PostgreSQL100Platform extends PostgreSqlPlatform
{ {
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return PostgreSQL100Keywords::class; return PostgreSQL100Keywords::class;
......
...@@ -34,17 +34,11 @@ use function trim; ...@@ -34,17 +34,11 @@ use function trim;
*/ */
class SqlitePlatform extends AbstractPlatform class SqlitePlatform extends AbstractPlatform
{ {
/**
* {@inheritDoc}
*/
public function getRegexpExpression() : string public function getRegexpExpression() : string
{ {
return 'REGEXP'; return 'REGEXP';
} }
/**
* {@inheritDoc}
*/
public function getNowExpression(string $type = 'timestamp') : string public function getNowExpression(string $type = 'timestamp') : string
{ {
switch ($type) { switch ($type) {
...@@ -58,9 +52,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -58,9 +52,6 @@ class SqlitePlatform extends AbstractPlatform
} }
} }
/**
* {@inheritDoc}
*/
public function getTrimExpression(string $str, int $mode = TrimMode::UNSPECIFIED, ?string $char = null) : string public function getTrimExpression(string $str, int $mode = TrimMode::UNSPECIFIED, ?string $char = null) : string
{ {
switch ($mode) { switch ($mode) {
...@@ -95,9 +86,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -95,9 +86,6 @@ class SqlitePlatform extends AbstractPlatform
return sprintf('%s(%s)', $trimFn, implode(', ', $arguments)); return sprintf('%s(%s)', $trimFn, implode(', ', $arguments));
} }
/**
* {@inheritDoc}
*/
public function getSubstringExpression(string $string, string $start, ?string $length = null) : string public function getSubstringExpression(string $string, string $start, ?string $length = null) : string
{ {
if ($length === null) { if ($length === null) {
...@@ -107,9 +95,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -107,9 +95,6 @@ class SqlitePlatform extends AbstractPlatform
return sprintf('SUBSTR(%s, %s, %s)', $string, $start, $length); return sprintf('SUBSTR(%s, %s, %s)', $string, $start, $length);
} }
/**
* {@inheritDoc}
*/
public function getLocateExpression(string $string, string $substring, ?string $start = null) : string public function getLocateExpression(string $string, string $substring, ?string $start = null) : string
{ {
if ($start === null) { if ($start === null) {
...@@ -119,9 +104,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -119,9 +104,6 @@ class SqlitePlatform extends AbstractPlatform
return sprintf('LOCATE(%s, %s, %s)', $string, $substring, $start); return sprintf('LOCATE(%s, %s, %s)', $string, $substring, $start);
} }
/**
* {@inheritdoc}
*/
protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string protected function getDateArithmeticIntervalExpression(string $date, string $operator, string $interval, string $unit) : string
{ {
switch ($unit) { switch ($unit) {
...@@ -143,9 +125,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -143,9 +125,6 @@ class SqlitePlatform extends AbstractPlatform
) . ')'; ) . ')';
} }
/**
* {@inheritDoc}
*/
public function getDateDiffExpression(string $date1, string $date2) : string public function getDateDiffExpression(string $date1, string $date2) : string
{ {
return sprintf("JULIANDAY(%s, 'start of day') - JULIANDAY(%s, 'start of day')", $date1, $date2); return sprintf("JULIANDAY(%s, 'start of day') - JULIANDAY(%s, 'start of day')", $date1, $date2);
...@@ -164,9 +143,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -164,9 +143,6 @@ class SqlitePlatform extends AbstractPlatform
return "''"; return "''";
} }
/**
* {@inheritDoc}
*/
protected function _getTransactionIsolationLevelSQL(int $level) : string protected function _getTransactionIsolationLevelSQL(int $level) : string
{ {
switch ($level) { switch ($level) {
...@@ -181,17 +157,11 @@ class SqlitePlatform extends AbstractPlatform ...@@ -181,17 +157,11 @@ class SqlitePlatform extends AbstractPlatform
} }
} }
/**
* {@inheritDoc}
*/
public function getSetTransactionIsolationSQL(int $level) : string public function getSetTransactionIsolationSQL(int $level) : string
{ {
return 'PRAGMA read_uncommitted = ' . $this->_getTransactionIsolationLevelSQL($level); return 'PRAGMA read_uncommitted = ' . $this->_getTransactionIsolationLevelSQL($level);
} }
/**
* {@inheritDoc}
*/
public function prefersIdentityColumns() : bool public function prefersIdentityColumns() : bool
{ {
return true; return true;
...@@ -302,9 +272,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -302,9 +272,6 @@ class SqlitePlatform extends AbstractPlatform
return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : ''; return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : '';
} }
/**
* {@inheritDoc}
*/
public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) : string public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey) : string
{ {
return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint( return parent::getForeignKeyDeclarationSQL(new ForeignKeyConstraint(
...@@ -391,17 +358,11 @@ class SqlitePlatform extends AbstractPlatform ...@@ -391,17 +358,11 @@ class SqlitePlatform extends AbstractPlatform
return ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')'; return ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
} }
/**
* {@inheritdoc}
*/
protected function getBinaryTypeDeclarationSQLSnippet(?int $length) : string protected function getBinaryTypeDeclarationSQLSnippet(?int $length) : string
{ {
return 'BLOB'; return 'BLOB';
} }
/**
* {@inheritdoc}
*/
protected function getVarcharTypeDeclarationSQLSnippet(?int $length) : string protected function getVarcharTypeDeclarationSQLSnippet(?int $length) : string
{ {
$sql = 'VARCHAR'; $sql = 'VARCHAR';
...@@ -413,9 +374,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -413,9 +374,6 @@ class SqlitePlatform extends AbstractPlatform
return $sql; return $sql;
} }
/**
* {@inheritDoc}
*/
protected function getVarbinaryTypeDeclarationSQLSnippet(?int $length) : string protected function getVarbinaryTypeDeclarationSQLSnippet(?int $length) : string
{ {
return 'BLOB'; return 'BLOB';
...@@ -429,9 +387,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -429,9 +387,6 @@ class SqlitePlatform extends AbstractPlatform
return 'CLOB'; return 'CLOB';
} }
/**
* {@inheritDoc}
*/
public function getListTableConstraintsSQL(string $table) : string public function getListTableConstraintsSQL(string $table) : string
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
...@@ -442,9 +397,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -442,9 +397,6 @@ class SqlitePlatform extends AbstractPlatform
); );
} }
/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL(string $table, ?string $database = null) : string public function getListTableColumnsSQL(string $table, ?string $database = null) : string
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
...@@ -452,9 +404,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -452,9 +404,6 @@ class SqlitePlatform extends AbstractPlatform
return sprintf('PRAGMA table_info(%s)', $this->quoteStringLiteral($table)); return sprintf('PRAGMA table_info(%s)', $this->quoteStringLiteral($table));
} }
/**
* {@inheritDoc}
*/
public function getListTableIndexesSQL(string $table, ?string $currentDatabase = null) : string public function getListTableIndexesSQL(string $table, ?string $currentDatabase = null) : string
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
...@@ -462,9 +411,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -462,9 +411,6 @@ class SqlitePlatform extends AbstractPlatform
return sprintf('PRAGMA index_list(%s)', $this->quoteStringLiteral($table)); return sprintf('PRAGMA index_list(%s)', $this->quoteStringLiteral($table));
} }
/**
* {@inheritDoc}
*/
public function getListTablesSQL() : string public function getListTablesSQL() : string
{ {
return "SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' " return "SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'sqlite_sequence' AND name != 'geometry_columns' AND name != 'spatial_ref_sys' "
...@@ -472,33 +418,21 @@ class SqlitePlatform extends AbstractPlatform ...@@ -472,33 +418,21 @@ class SqlitePlatform extends AbstractPlatform
. "WHERE type = 'table' ORDER BY name"; . "WHERE type = 'table' ORDER BY name";
} }
/**
* {@inheritDoc}
*/
public function getListViewsSQL(string $database) : string public function getListViewsSQL(string $database) : string
{ {
return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL"; return "SELECT name, sql FROM sqlite_master WHERE type='view' AND sql NOT NULL";
} }
/**
* {@inheritDoc}
*/
public function getCreateViewSQL(string $name, string $sql) : string public function getCreateViewSQL(string $name, string $sql) : string
{ {
return 'CREATE VIEW ' . $name . ' AS ' . $sql; return 'CREATE VIEW ' . $name . ' AS ' . $sql;
} }
/**
* {@inheritDoc}
*/
public function getDropViewSQL(string $name) : string public function getDropViewSQL(string $name) : string
{ {
return 'DROP VIEW ' . $name; return 'DROP VIEW ' . $name;
} }
/**
* {@inheritDoc}
*/
public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) : string public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey) : string
{ {
$query = parent::getAdvancedForeignKeyOptionsSQL($foreignKey); $query = parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
...@@ -509,41 +443,26 @@ class SqlitePlatform extends AbstractPlatform ...@@ -509,41 +443,26 @@ class SqlitePlatform extends AbstractPlatform
return $query; return $query;
} }
/**
* {@inheritDoc}
*/
public function supportsIdentityColumns() : bool public function supportsIdentityColumns() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsColumnCollation() : bool public function supportsColumnCollation() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsInlineColumnComments() : bool public function supportsInlineColumnComments() : bool
{ {
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function getName() : string public function getName() : string
{ {
return 'sqlite'; return 'sqlite';
} }
/**
* {@inheritDoc}
*/
public function getTruncateTableSQL(string $tableName, bool $cascade = false) : string public function getTruncateTableSQL(string $tableName, bool $cascade = false) : string
{ {
$tableIdentifier = new Identifier($tableName); $tableIdentifier = new Identifier($tableName);
...@@ -587,17 +506,11 @@ class SqlitePlatform extends AbstractPlatform ...@@ -587,17 +506,11 @@ class SqlitePlatform extends AbstractPlatform
return 0; return 0;
} }
/**
* {@inheritDoc}
*/
public function getForUpdateSql() : string public function getForUpdateSql() : string
{ {
return ''; return '';
} }
/**
* {@inheritDoc}
*/
public function getInlineColumnCommentSQL(?string $comment) : string public function getInlineColumnCommentSQL(?string $comment) : string
{ {
if ($comment === null || $comment === '') { if ($comment === null || $comment === '') {
...@@ -612,9 +525,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -612,9 +525,6 @@ class SqlitePlatform extends AbstractPlatform
return $this->getInlineColumnCommentSQL($comment); return $this->getInlineColumnCommentSQL($comment);
} }
/**
* {@inheritDoc}
*/
protected function initializeDoctrineTypeMappings() : void protected function initializeDoctrineTypeMappings() : void
{ {
$this->doctrineTypeMapping = [ $this->doctrineTypeMapping = [
...@@ -654,9 +564,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -654,9 +564,6 @@ class SqlitePlatform extends AbstractPlatform
]; ];
} }
/**
* {@inheritDoc}
*/
protected function getReservedKeywordsClass() : string protected function getReservedKeywordsClass() : string
{ {
return Keywords\SQLiteKeywords::class; return Keywords\SQLiteKeywords::class;
...@@ -710,9 +617,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -710,9 +617,6 @@ class SqlitePlatform extends AbstractPlatform
return $sql; return $sql;
} }
/**
* {@inheritDoc}
*/
protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string protected function doModifyLimitQuery(string $query, ?int $limit, int $offset) : string
{ {
if ($limit === null && $offset > 0) { if ($limit === null && $offset > 0) {
...@@ -730,9 +634,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -730,9 +634,6 @@ class SqlitePlatform extends AbstractPlatform
return 'BLOB'; return 'BLOB';
} }
/**
* {@inheritDoc}
*/
public function getTemporaryTableName(string $tableName) : string public function getTemporaryTableName(string $tableName) : string
{ {
$tableName = str_replace('.', '__', $tableName); $tableName = str_replace('.', '__', $tableName);
...@@ -754,9 +655,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -754,9 +655,6 @@ class SqlitePlatform extends AbstractPlatform
return true; return true;
} }
/**
* {@inheritDoc}
*/
public function supportsForeignKeyConstraints() : bool public function supportsForeignKeyConstraints() : bool
{ {
return false; return false;
...@@ -802,9 +700,6 @@ class SqlitePlatform extends AbstractPlatform ...@@ -802,9 +700,6 @@ class SqlitePlatform extends AbstractPlatform
return parent::getCreateTableSQL($table, $createFlags); return parent::getCreateTableSQL($table, $createFlags);
} }
/**
* {@inheritDoc}
*/
public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string public function getListTableForeignKeysSQL(string $table, ?string $database = null) : string
{ {
$table = str_replace('.', '__', $table); $table = str_replace('.', '__', $table);
......
...@@ -38,9 +38,6 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -38,9 +38,6 @@ class Connection extends \Doctrine\DBAL\Connection
/** @var int|null */ /** @var int|null */
private $case; private $case;
/**
* {@inheritdoc}
*/
public function connect() : void public function connect() : void
{ {
if ($this->isConnected()) { if ($this->isConnected()) {
...@@ -67,6 +64,7 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -67,6 +64,7 @@ class Connection extends \Doctrine\DBAL\Connection
} else { } else {
$params['portability'] &= self::PORTABILITY_OTHERVENDORS; $params['portability'] &= self::PORTABILITY_OTHERVENDORS;
} }
$this->portability = $params['portability']; $this->portability = $params['portability'];
} }
...@@ -107,9 +105,6 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -107,9 +105,6 @@ class Connection extends \Doctrine\DBAL\Connection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function prepare(string $sql) : DriverStatement public function prepare(string $sql) : DriverStatement
{ {
$stmt = new Statement(parent::prepare($sql), $this); $stmt = new Statement(parent::prepare($sql), $this);
...@@ -118,9 +113,6 @@ class Connection extends \Doctrine\DBAL\Connection ...@@ -118,9 +113,6 @@ class Connection extends \Doctrine\DBAL\Connection
return $stmt; return $stmt;
} }
/**
* {@inheritdoc}
*/
public function query(string $sql) : ResultStatement public function query(string $sql) : ResultStatement
{ {
$connection = $this->getWrappedConnection(); $connection = $this->getWrappedConnection();
......
...@@ -64,17 +64,11 @@ final class Statement implements IteratorAggregate, DriverStatement ...@@ -64,17 +64,11 @@ final class Statement implements IteratorAggregate, DriverStatement
$this->stmt->bindValue($param, $value, $type); $this->stmt->bindValue($param, $value, $type);
} }
/**
* {@inheritdoc}
*/
public function closeCursor() : void public function closeCursor() : void
{ {
$this->stmt->closeCursor(); $this->stmt->closeCursor();
} }
/**
* {@inheritdoc}
*/
public function columnCount() : int public function columnCount() : int
{ {
return $this->stmt->columnCount(); return $this->stmt->columnCount();
...@@ -182,9 +176,6 @@ final class Statement implements IteratorAggregate, DriverStatement ...@@ -182,9 +176,6 @@ final class Statement implements IteratorAggregate, DriverStatement
return $value; return $value;
} }
/**
* {@inheritdoc}
*/
public function rowCount() : int public function rowCount() : int
{ {
assert($this->stmt instanceof DriverStatement); assert($this->stmt instanceof DriverStatement);
......
...@@ -1274,6 +1274,7 @@ class QueryBuilder ...@@ -1274,6 +1274,7 @@ class QueryBuilder
$this->boundCounter++; $this->boundCounter++;
$placeHolder = ':dcValue' . $this->boundCounter; $placeHolder = ':dcValue' . $this->boundCounter;
} }
$this->setParameter(substr($placeHolder, 1), $value, $type); $this->setParameter(substr($placeHolder, 1), $value, $type);
return $placeHolder; return $placeHolder;
...@@ -1323,6 +1324,7 @@ class QueryBuilder ...@@ -1323,6 +1324,7 @@ class QueryBuilder
if (array_key_exists($join->alias, $knownAliases)) { if (array_key_exists($join->alias, $knownAliases)) {
throw NonUniqueAlias::new($join->alias, array_keys($knownAliases)); throw NonUniqueAlias::new($join->alias, array_keys($knownAliases));
} }
$sql .= ' ' . $join->type $sql .= ' ' . $join->type
. ' JOIN ' . $join->table . ' ' . $join->alias . ' JOIN ' . $join->table . ' ' . $join->alias
. ' ON ' . ((string) $join->condition); . ' ON ' . ((string) $join->condition);
......
...@@ -6,7 +6,6 @@ namespace Doctrine\DBAL; ...@@ -6,7 +6,6 @@ namespace Doctrine\DBAL;
use Doctrine\DBAL\Exception\MissingArrayParameter; use Doctrine\DBAL\Exception\MissingArrayParameter;
use Doctrine\DBAL\Exception\MissingArrayParameterType; use Doctrine\DBAL\Exception\MissingArrayParameterType;
use const PREG_OFFSET_CAPTURE;
use function array_fill; use function array_fill;
use function array_key_exists; use function array_key_exists;
use function array_merge; use function array_merge;
...@@ -22,6 +21,7 @@ use function sprintf; ...@@ -22,6 +21,7 @@ use function sprintf;
use function strlen; use function strlen;
use function strpos; use function strpos;
use function substr; use function substr;
use const PREG_OFFSET_CAPTURE;
/** /**
* Utility class that parses sql statements with regard to types and parameters. * Utility class that parses sql statements with regard to types and parameters.
...@@ -171,8 +171,8 @@ class SQLParserUtils ...@@ -171,8 +171,8 @@ class SQLParserUtils
$expandStr = $count ? implode(', ', array_fill(0, $count, '?')) : 'NULL'; $expandStr = $count ? implode(', ', array_fill(0, $count, '?')) : 'NULL';
$query = substr($query, 0, $needlePos) . $expandStr . substr($query, $needlePos + 1); $query = substr($query, 0, $needlePos) . $expandStr . substr($query, $needlePos + 1);
$paramOffset += ($count - 1); // Grows larger by number of parameters minus the replaced needle. $paramOffset += $count - 1; // Grows larger by number of parameters minus the replaced needle.
$queryOffset += (strlen($expandStr) - 1); $queryOffset += strlen($expandStr) - 1;
} }
return [$query, $params, $types]; return [$query, $params, $types];
...@@ -190,10 +190,10 @@ class SQLParserUtils ...@@ -190,10 +190,10 @@ class SQLParserUtils
if (! isset($arrayPositions[$paramName]) && ! isset($arrayPositions[':' . $paramName])) { if (! isset($arrayPositions[$paramName]) && ! isset($arrayPositions[':' . $paramName])) {
$pos += $queryOffset; $pos += $queryOffset;
$queryOffset -= ($paramLen - 1); $queryOffset -= $paramLen - 1;
$paramsOrd[] = $value; $paramsOrd[] = $value;
$typesOrd[] = static::extractParam($paramName, $types, false, ParameterType::STRING); $typesOrd[] = static::extractParam($paramName, $types, false, ParameterType::STRING);
$query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen)); $query = substr($query, 0, $pos) . '?' . substr($query, $pos + $paramLen);
continue; continue;
} }
...@@ -207,8 +207,8 @@ class SQLParserUtils ...@@ -207,8 +207,8 @@ class SQLParserUtils
} }
$pos += $queryOffset; $pos += $queryOffset;
$queryOffset += (strlen($expandStr) - $paramLen); $queryOffset += strlen($expandStr) - $paramLen;
$query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen)); $query = substr($query, 0, $pos) . $expandStr . substr($query, $pos + $paramLen);
} }
return [$query, $paramsOrd, $typesOrd]; return [$query, $paramsOrd, $typesOrd];
......
...@@ -46,11 +46,13 @@ abstract class AbstractAsset ...@@ -46,11 +46,13 @@ abstract class AbstractAsset
$this->_quoted = true; $this->_quoted = true;
$name = $this->trimQuotes($name); $name = $this->trimQuotes($name);
} }
if (strpos($name, '.') !== false) { if (strpos($name, '.') !== false) {
$parts = explode('.', $name); $parts = explode('.', $name);
$this->_namespace = $parts[0]; $this->_namespace = $parts[0];
$name = $parts[1]; $name = $parts[1];
} }
$this->_name = $name; $this->_name = $name;
} }
......
...@@ -283,6 +283,7 @@ abstract class AbstractSchemaManager ...@@ -283,6 +283,7 @@ abstract class AbstractSchemaManager
if ($database === null) { if ($database === null) {
$database = $this->_conn->getDatabase(); $database = $this->_conn->getDatabase();
} }
$sql = $this->_platform->getListTableForeignKeysSQL($table, $database); $sql = $this->_platform->getListTableForeignKeysSQL($table, $database);
$tableForeignKeys = $this->_conn->fetchAll($sql); $tableForeignKeys = $this->_conn->fetchAll($sql);
...@@ -687,6 +688,7 @@ abstract class AbstractSchemaManager ...@@ -687,6 +688,7 @@ abstract class AbstractSchemaManager
if ($tableIndex['primary']) { if ($tableIndex['primary']) {
$keyName = 'primary'; $keyName = 'primary';
} }
$keyName = strtolower($keyName); $keyName = strtolower($keyName);
if (! isset($result[$keyName])) { if (! isset($result[$keyName])) {
...@@ -901,9 +903,11 @@ abstract class AbstractSchemaManager ...@@ -901,9 +903,11 @@ abstract class AbstractSchemaManager
if (! isset($params['defaultTableOptions'])) { if (! isset($params['defaultTableOptions'])) {
$params['defaultTableOptions'] = []; $params['defaultTableOptions'] = [];
} }
if (! isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) { if (! isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) {
$params['defaultTableOptions']['charset'] = $params['charset']; $params['defaultTableOptions']['charset'] = $params['charset'];
} }
$schemaConfig->setDefaultTableOptions($params['defaultTableOptions']); $schemaConfig->setDefaultTableOptions($params['defaultTableOptions']);
return $schemaConfig; return $schemaConfig;
......
...@@ -85,6 +85,7 @@ class Comparator ...@@ -85,6 +85,7 @@ class Comparator
if (! isset($foreignKeysToTable[$foreignTable])) { if (! isset($foreignKeysToTable[$foreignTable])) {
$foreignKeysToTable[$foreignTable] = []; $foreignKeysToTable[$foreignTable] = [];
} }
$foreignKeysToTable[$foreignTable][] = $foreignKey; $foreignKeysToTable[$foreignTable][] = $foreignKey;
} }
} }
...@@ -112,6 +113,7 @@ class Comparator ...@@ -112,6 +113,7 @@ class Comparator
if ($tableName !== strtolower($removedForeignKey->getForeignTableName())) { if ($tableName !== strtolower($removedForeignKey->getForeignTableName())) {
continue; continue;
} }
unset($diff->changedTables[$localTableName]->removedForeignKeys[$key]); unset($diff->changedTables[$localTableName]->removedForeignKeys[$key]);
} }
} }
...@@ -190,6 +192,7 @@ class Comparator ...@@ -190,6 +192,7 @@ class Comparator
$tableDifferences->addedColumns[$columnName] = $column; $tableDifferences->addedColumns[$columnName] = $column;
$changes++; $changes++;
} }
/* See if there are any removed fields in table 2 */ /* See if there are any removed fields in table 2 */
foreach ($table1Columns as $columnName => $column) { foreach ($table1Columns as $columnName => $column) {
// See if column is removed in table 2. // See if column is removed in table 2.
...@@ -226,6 +229,7 @@ class Comparator ...@@ -226,6 +229,7 @@ class Comparator
$tableDifferences->addedIndexes[$indexName] = $index; $tableDifferences->addedIndexes[$indexName] = $index;
$changes++; $changes++;
} }
/* See if there are any removed indexes in table 2 */ /* See if there are any removed indexes in table 2 */
foreach ($table1Indexes as $indexName => $index) { foreach ($table1Indexes as $indexName => $index) {
// See if index is removed in table 2. // See if index is removed in table 2.
...@@ -436,6 +440,7 @@ class Comparator ...@@ -436,6 +440,7 @@ class Comparator
if (($properties1['precision'] ?: 10) !== ($properties2['precision'] ?: 10)) { if (($properties1['precision'] ?: 10) !== ($properties2['precision'] ?: 10)) {
$changedProperties[] = 'precision'; $changedProperties[] = 'precision';
} }
if ($properties1['scale'] !== $properties2['scale']) { if ($properties1['scale'] !== $properties2['scale']) {
$changedProperties[] = 'scale'; $changedProperties[] = 'scale';
} }
......
...@@ -6,14 +6,15 @@ namespace Doctrine\DBAL\Schema; ...@@ -6,14 +6,15 @@ namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Platforms\DB2Platform; use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use const CASE_LOWER;
use function array_change_key_case; use function array_change_key_case;
use function assert;
use function is_resource; use function is_resource;
use function preg_match; use function preg_match;
use function str_replace; use function str_replace;
use function strpos; use function strpos;
use function strtolower; use function strtolower;
use function substr; use function substr;
use const CASE_LOWER;
/** /**
* IBM Db2 Schema Manager. * IBM Db2 Schema Manager.
...@@ -190,9 +191,9 @@ class DB2SchemaManager extends AbstractSchemaManager ...@@ -190,9 +191,9 @@ class DB2SchemaManager extends AbstractSchemaManager
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($tableName);
/** @var DB2Platform $platform */
$platform = $this->_platform; $platform = $this->_platform;
$sql = $platform->getListTableCommentsSQL($tableName); assert($platform instanceof DB2Platform);
$sql = $platform->getListTableCommentsSQL($tableName);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
$table->addOption('comment', $tableOptions['REMARKS']); $table->addOption('comment', $tableOptions['REMARKS']);
......
...@@ -7,7 +7,6 @@ namespace Doctrine\DBAL\Schema; ...@@ -7,7 +7,6 @@ namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Platforms\MariaDb1027Platform; use Doctrine\DBAL\Platforms\MariaDb1027Platform;
use Doctrine\DBAL\Platforms\MySqlPlatform; use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Types\Type; use Doctrine\DBAL\Types\Type;
use const CASE_LOWER;
use function array_change_key_case; use function array_change_key_case;
use function array_values; use function array_values;
use function assert; use function assert;
...@@ -18,6 +17,7 @@ use function strpos; ...@@ -18,6 +17,7 @@ use function strpos;
use function strtok; use function strtok;
use function strtolower; use function strtolower;
use function strtr; use function strtr;
use const CASE_LOWER;
/** /**
* Schema manager for the MySql RDBMS. * Schema manager for the MySql RDBMS.
...@@ -75,11 +75,13 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -75,11 +75,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
} else { } else {
$v['primary'] = false; $v['primary'] = false;
} }
if (strpos($v['index_type'], 'FULLTEXT') !== false) { if (strpos($v['index_type'], 'FULLTEXT') !== false) {
$v['flags'] = ['FULLTEXT']; $v['flags'] = ['FULLTEXT'];
} elseif (strpos($v['index_type'], 'SPATIAL') !== false) { } elseif (strpos($v['index_type'], 'SPATIAL') !== false) {
$v['flags'] = ['SPATIAL']; $v['flags'] = ['SPATIAL'];
} }
$v['length'] = isset($v['sub_part']) ? (int) $v['sub_part'] : null; $v['length'] = isset($v['sub_part']) ? (int) $v['sub_part'] : null;
$tableIndexRows[$k] = $v; $tableIndexRows[$k] = $v;
...@@ -136,6 +138,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -136,6 +138,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
$scale = (int) $match[2]; $scale = (int) $match[2];
$length = null; $length = null;
} }
break; break;
case 'tinytext': case 'tinytext':
$length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT; $length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT;
...@@ -191,6 +194,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -191,6 +194,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
if (isset($tableColumn['characterset'])) { if (isset($tableColumn['characterset'])) {
$column->setPlatformOption('charset', $tableColumn['characterset']); $column->setPlatformOption('charset', $tableColumn['characterset']);
} }
if (isset($tableColumn['collation'])) { if (isset($tableColumn['collation'])) {
$column->setPlatformOption('collation', $tableColumn['collation']); $column->setPlatformOption('collation', $tableColumn['collation']);
} }
...@@ -248,6 +252,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -248,6 +252,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
if (! isset($value['delete_rule']) || $value['delete_rule'] === 'RESTRICT') { if (! isset($value['delete_rule']) || $value['delete_rule'] === 'RESTRICT') {
$value['delete_rule'] = null; $value['delete_rule'] = null;
} }
if (! isset($value['update_rule']) || $value['update_rule'] === 'RESTRICT') { if (! isset($value['update_rule']) || $value['update_rule'] === 'RESTRICT') {
$value['update_rule'] = null; $value['update_rule'] = null;
} }
...@@ -261,6 +266,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -261,6 +266,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
'onUpdate' => $value['update_rule'], 'onUpdate' => $value['update_rule'],
]; ];
} }
$list[$value['constraint_name']]['local'][] = $value['column_name']; $list[$value['constraint_name']]['local'][] = $value['column_name'];
$list[$value['constraint_name']]['foreign'][] = $value['referenced_column_name']; $list[$value['constraint_name']]['foreign'][] = $value['referenced_column_name'];
} }
...@@ -282,16 +288,13 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -282,16 +288,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
return $result; return $result;
} }
/**
* {@inheritdoc}
*/
public function listTableDetails(string $tableName) : Table public function listTableDetails(string $tableName) : Table
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($tableName);
/** @var MySqlPlatform $platform */
$platform = $this->_platform; $platform = $this->_platform;
$sql = $platform->getListTableMetadataSQL($tableName); assert($platform instanceof MySqlPlatform);
$sql = $platform->getListTableMetadataSQL($tableName);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
...@@ -25,9 +25,6 @@ use function strtok; ...@@ -25,9 +25,6 @@ use function strtok;
*/ */
class SQLServerSchemaManager extends AbstractSchemaManager class SQLServerSchemaManager extends AbstractSchemaManager
{ {
/**
* {@inheritdoc}
*/
public function dropDatabase(string $database) : void public function dropDatabase(string $database) : void
{ {
try { try {
...@@ -105,6 +102,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -105,6 +102,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
if ($length === -1) { if ($length === -1) {
$dbType = 'text'; $dbType = 'text';
} }
break; break;
} }
...@@ -275,9 +273,6 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -275,9 +273,6 @@ class SQLServerSchemaManager extends AbstractSchemaManager
return $this->_getPortableTableIndexesList($tableIndexes, $table); return $this->_getPortableTableIndexesList($tableIndexes, $table);
} }
/**
* {@inheritdoc}
*/
public function alterTable(TableDiff $tableDiff) : void public function alterTable(TableDiff $tableDiff) : void
{ {
if (count($tableDiff->removedColumns) > 0) { if (count($tableDiff->removedColumns) > 0) {
...@@ -333,9 +328,9 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -333,9 +328,9 @@ class SQLServerSchemaManager extends AbstractSchemaManager
{ {
$table = parent::listTableDetails($tableName); $table = parent::listTableDetails($tableName);
/** @var SQLServerPlatform $platform */
$platform = $this->_platform; $platform = $this->_platform;
$sql = $platform->getListTableMetadataSQL($tableName); assert($platform instanceof SQLServerPlatform);
$sql = $platform->getListTableMetadataSQL($tableName);
$tableOptions = $this->_conn->fetchAssoc($sql); $tableOptions = $this->_conn->fetchAssoc($sql);
......
This diff is collapsed.
...@@ -151,6 +151,7 @@ class SchemaDiff ...@@ -151,6 +151,7 @@ class SchemaDiff
$foreignKeySql[] = $platform->getCreateForeignKeySQL($foreignKey, $table); $foreignKeySql[] = $platform->getCreateForeignKeySQL($foreignKey, $table);
} }
} }
$sql = array_merge($sql, $foreignKeySql); $sql = array_merge($sql, $foreignKeySql);
if ($saveMode === false) { if ($saveMode === false) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment