Suppressed a defective error message and restored/added the missing line breaks

parent a92fa151
...@@ -98,32 +98,40 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -98,32 +98,40 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA
switch ($exception->getCode()) { switch ($exception->getCode()) {
case self::ER_LOCK_DEADLOCK: case self::ER_LOCK_DEADLOCK:
return new Exception\DeadlockException($message, $exception); return new Exception\DeadlockException($message, $exception);
case self::ER_LOCK_WAIT_TIMEOUT: case self::ER_LOCK_WAIT_TIMEOUT:
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:
...@@ -137,6 +145,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -137,6 +145,7 @@ 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:
...@@ -150,6 +159,7 @@ abstract class AbstractMySQLDriver implements ExceptionConverterDriver, VersionA ...@@ -150,6 +159,7 @@ 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:
......
...@@ -27,22 +27,30 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver ...@@ -27,22 +27,30 @@ 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:
......
...@@ -35,6 +35,7 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver ...@@ -35,6 +35,7 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
case '40001': case '40001':
case '40P01': case '40P01':
return new Exception\DeadlockException($message, $exception); return new Exception\DeadlockException($message, $exception);
case '0A000': case '0A000':
// Foreign key constraint violations during a TRUNCATE operation // Foreign key constraint violations during a TRUNCATE operation
// are considered "feature not supported" in PostgreSQL. // are considered "feature not supported" in PostgreSQL.
...@@ -43,20 +44,28 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver ...@@ -43,20 +44,28 @@ 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);
} }
......
...@@ -33,31 +33,41 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve ...@@ -33,31 +33,41 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
case -307: case -307:
case -684: case -684:
return new Exception\DeadlockException($message, $exception); return new Exception\DeadlockException($message, $exception);
case -210: case -210:
case -1175: case -1175:
case -1281: case -1281:
return new Exception\LockWaitTimeoutException($message, $exception); return new Exception\LockWaitTimeoutException($message, $exception);
case -100: case -100:
case -103: case -103:
case -832: case -832:
return new Exception\ConnectionException($message, $exception); return new Exception\ConnectionException($message, $exception);
case -143: case -143:
return new Exception\InvalidFieldNameException($message, $exception); return new Exception\InvalidFieldNameException($message, $exception);
case -193: case -193:
case -196: case -196:
return new Exception\UniqueConstraintViolationException($message, $exception); return new Exception\UniqueConstraintViolationException($message, $exception);
case -194: case -194:
case -198: case -198:
return new Exception\ForeignKeyConstraintViolationException($message, $exception); return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case -144: case -144:
return new Exception\NonUniqueFieldNameException($message, $exception); return new Exception\NonUniqueFieldNameException($message, $exception);
case -184: case -184:
case -195: case -195:
return new Exception\NotNullConstraintViolationException($message, $exception); return new Exception\NotNullConstraintViolationException($message, $exception);
case -131: case -131:
return new Exception\SyntaxErrorException($message, $exception); return new Exception\SyntaxErrorException($message, $exception);
case -110: case -110:
return new Exception\TableExistsException($message, $exception); return new Exception\TableExistsException($message, $exception);
case -141: case -141:
case -1041: case -1041:
return new Exception\TableNotFoundException($message, $exception); return new Exception\TableNotFoundException($message, $exception);
...@@ -79,11 +89,8 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve ...@@ -79,11 +89,8 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
); );
} }
switch (true) {
default:
return new SQLAnywherePlatform(); return new SQLAnywherePlatform();
} }
}
public function getDatabasePlatform() : AbstractPlatform public function getDatabasePlatform() : AbstractPlatform
{ {
......
...@@ -227,10 +227,13 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -227,10 +227,13 @@ 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;
...@@ -247,10 +250,13 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -247,10 +250,13 @@ 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.');
} }
...@@ -270,12 +276,14 @@ final class DB2Statement implements IteratorAggregate, Statement ...@@ -270,12 +276,14 @@ final class DB2Statement implements IteratorAggregate, Statement
} }
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) {
$rows[] = $row; $rows[] = $row;
......
...@@ -361,10 +361,13 @@ final class MysqliStatement implements IteratorAggregate, Statement ...@@ -361,10 +361,13 @@ 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);
} }
......
...@@ -161,8 +161,10 @@ final class OCI8Statement implements IteratorAggregate, Statement ...@@ -161,8 +161,10 @@ 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;
} }
......
...@@ -184,10 +184,13 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -184,10 +184,13 @@ 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;
...@@ -204,10 +207,13 @@ final class SQLAnywhereStatement implements IteratorAggregate, Statement ...@@ -204,10 +207,13 @@ 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));
} }
......
...@@ -2246,6 +2246,7 @@ abstract class AbstractPlatform ...@@ -2246,6 +2246,7 @@ abstract class AbstractPlatform
case 'RESTRICT': case 'RESTRICT':
case 'SET DEFAULT': case 'SET DEFAULT':
return $upper; return $upper;
default: default:
throw new InvalidArgumentException(sprintf('Invalid foreign key action "%s".', $upper)); throw new InvalidArgumentException(sprintf('Invalid foreign key action "%s".', $upper));
} }
...@@ -2438,12 +2439,16 @@ abstract class AbstractPlatform ...@@ -2438,12 +2439,16 @@ abstract class AbstractPlatform
switch ($level) { switch ($level) {
case TransactionIsolationLevel::READ_UNCOMMITTED: case TransactionIsolationLevel::READ_UNCOMMITTED:
return 'READ UNCOMMITTED'; return 'READ UNCOMMITTED';
case TransactionIsolationLevel::READ_COMMITTED: case TransactionIsolationLevel::READ_COMMITTED:
return 'READ COMMITTED'; return 'READ COMMITTED';
case TransactionIsolationLevel::REPEATABLE_READ: case TransactionIsolationLevel::REPEATABLE_READ:
return 'REPEATABLE READ'; return 'REPEATABLE READ';
case TransactionIsolationLevel::SERIALIZABLE: case TransactionIsolationLevel::SERIALIZABLE:
return 'SERIALIZABLE'; return 'SERIALIZABLE';
default: default:
throw new InvalidArgumentException(sprintf('Invalid isolation level "%s".', $level)); throw new InvalidArgumentException(sprintf('Invalid isolation level "%s".', $level));
} }
......
...@@ -91,6 +91,7 @@ class OraclePlatform extends AbstractPlatform ...@@ -91,6 +91,7 @@ class OraclePlatform extends AbstractPlatform
} }
return 'ADD_MONTHS(' . $date . ', ' . $operator . $interval . ')'; return 'ADD_MONTHS(' . $date . ', ' . $operator . $interval . ')';
default: default:
$calculationClause = ''; $calculationClause = '';
...@@ -196,11 +197,14 @@ class OraclePlatform extends AbstractPlatform ...@@ -196,11 +197,14 @@ class OraclePlatform extends AbstractPlatform
switch ($level) { switch ($level) {
case TransactionIsolationLevel::READ_UNCOMMITTED: case TransactionIsolationLevel::READ_UNCOMMITTED:
return 'READ UNCOMMITTED'; return 'READ UNCOMMITTED';
case TransactionIsolationLevel::READ_COMMITTED: case TransactionIsolationLevel::READ_COMMITTED:
return 'READ COMMITTED'; return 'READ COMMITTED';
case TransactionIsolationLevel::REPEATABLE_READ: case TransactionIsolationLevel::REPEATABLE_READ:
case TransactionIsolationLevel::SERIALIZABLE: case TransactionIsolationLevel::SERIALIZABLE:
return 'SERIALIZABLE'; return 'SERIALIZABLE';
default: default:
return parent::_getTransactionIsolationLevelSQL($level); return parent::_getTransactionIsolationLevelSQL($level);
} }
...@@ -658,9 +662,11 @@ SQL ...@@ -658,9 +662,11 @@ SQL
// NO ACTION cannot be declared explicitly, // NO ACTION cannot be declared explicitly,
// therefore returning empty string to indicate to OMIT the referential clause. // therefore returning empty string to indicate to OMIT the referential clause.
return ''; return '';
case 'CASCADE': case 'CASCADE':
case 'SET NULL': case 'SET NULL':
return $action; return $action;
default: default:
// SET DEFAULT is not supported, throw exception instead. // SET DEFAULT is not supported, throw exception instead.
throw new InvalidArgumentException(sprintf('Invalid foreign key action "%s".', $action)); throw new InvalidArgumentException(sprintf('Invalid foreign key action "%s".', $action));
......
...@@ -51,10 +51,13 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -51,10 +51,13 @@ class SQLAnywherePlatform extends AbstractPlatform
switch (true) { switch (true) {
case $lockMode === LockMode::NONE: case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)'; return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ: case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (UPDLOCK)'; return $fromClause . ' WITH (UPDLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE: case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (XLOCK)'; return $fromClause . ' WITH (XLOCK)';
default: default:
return $fromClause; return $fromClause;
} }
...@@ -546,17 +549,15 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -546,17 +549,15 @@ class SQLAnywherePlatform extends AbstractPlatform
case self::FOREIGN_KEY_MATCH_SIMPLE: case self::FOREIGN_KEY_MATCH_SIMPLE:
return 'SIMPLE'; return 'SIMPLE';
break;
case self::FOREIGN_KEY_MATCH_FULL: case self::FOREIGN_KEY_MATCH_FULL:
return 'FULL'; return 'FULL';
break;
case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE: case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE:
return 'UNIQUE SIMPLE'; return 'UNIQUE SIMPLE';
break;
case self::FOREIGN_KEY_MATCH_FULL_UNIQUE: case self::FOREIGN_KEY_MATCH_FULL_UNIQUE:
return 'UNIQUE FULL'; return 'UNIQUE FULL';
default: default:
throw new InvalidArgumentException(sprintf('Invalid foreign key match type "%s".', $type)); throw new InvalidArgumentException(sprintf('Invalid foreign key match type "%s".', $type));
} }
...@@ -991,8 +992,10 @@ SQL ...@@ -991,8 +992,10 @@ SQL
switch ($mode) { switch ($mode) {
case TrimMode::LEADING: case TrimMode::LEADING:
return $this->getLtrimExpression($str); return $this->getLtrimExpression($str);
case TrimMode::TRAILING: case TrimMode::TRAILING:
return $this->getRtrimExpression($str); return $this->getRtrimExpression($str);
default: default:
return 'TRIM(' . $str . ')'; return 'TRIM(' . $str . ')';
} }
...@@ -1003,8 +1006,10 @@ SQL ...@@ -1003,8 +1006,10 @@ SQL
switch ($mode) { switch ($mode) {
case TrimMode::LEADING: case TrimMode::LEADING:
return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))'; return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))';
case TrimMode::TRAILING: case TrimMode::TRAILING:
return 'REVERSE(SUBSTR(REVERSE(' . $str . '), PATINDEX(' . $pattern . ', REVERSE(' . $str . '))))'; return 'REVERSE(SUBSTR(REVERSE(' . $str . '), PATINDEX(' . $pattern . ', REVERSE(' . $str . '))))';
default: default:
return 'REVERSE(SUBSTR(REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))), ' . return 'REVERSE(SUBSTR(REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))), ' .
'PATINDEX(' . $pattern . ', REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))))))'; 'PATINDEX(' . $pattern . ', REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))))))';
...@@ -1157,12 +1162,16 @@ SQL ...@@ -1157,12 +1162,16 @@ SQL
switch ($level) { switch ($level) {
case TransactionIsolationLevel::READ_UNCOMMITTED: case TransactionIsolationLevel::READ_UNCOMMITTED:
return '0'; return '0';
case TransactionIsolationLevel::READ_COMMITTED: case TransactionIsolationLevel::READ_COMMITTED:
return '1'; return '1';
case TransactionIsolationLevel::REPEATABLE_READ: case TransactionIsolationLevel::REPEATABLE_READ:
return '2'; return '2';
case TransactionIsolationLevel::SERIALIZABLE: case TransactionIsolationLevel::SERIALIZABLE:
return '3'; return '3';
default: default:
throw new InvalidArgumentException(sprintf('Invalid isolation level %d.', $level)); throw new InvalidArgumentException(sprintf('Invalid isolation level %d.', $level));
} }
......
...@@ -1001,8 +1001,10 @@ SQL ...@@ -1001,8 +1001,10 @@ SQL
switch ($mode) { switch ($mode) {
case TrimMode::LEADING: case TrimMode::LEADING:
return 'LTRIM(' . $str . ')'; return 'LTRIM(' . $str . ')';
case TrimMode::TRAILING: case TrimMode::TRAILING:
return 'RTRIM(' . $str . ')'; return 'RTRIM(' . $str . ')';
default: default:
return 'LTRIM(RTRIM(' . $str . '))'; return 'LTRIM(RTRIM(' . $str . '))';
} }
...@@ -1349,10 +1351,13 @@ SQL ...@@ -1349,10 +1351,13 @@ SQL
switch (true) { switch (true) {
case $lockMode === LockMode::NONE: case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)'; return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ: case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)'; return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE: case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (UPDLOCK, ROWLOCK)'; return $fromClause . ' WITH (UPDLOCK, ROWLOCK)';
default: default:
return $fromClause; return $fromClause;
} }
......
...@@ -44,8 +44,10 @@ class SqlitePlatform extends AbstractPlatform ...@@ -44,8 +44,10 @@ class SqlitePlatform extends AbstractPlatform
switch ($type) { switch ($type) {
case 'time': case 'time':
return 'time(\'now\')'; return 'time(\'now\')';
case 'date': case 'date':
return 'date(\'now\')'; return 'date(\'now\')';
case 'timestamp': case 'timestamp':
default: default:
return 'datetime(\'now\')'; return 'datetime(\'now\')';
...@@ -148,10 +150,12 @@ class SqlitePlatform extends AbstractPlatform ...@@ -148,10 +150,12 @@ class SqlitePlatform extends AbstractPlatform
switch ($level) { switch ($level) {
case TransactionIsolationLevel::READ_UNCOMMITTED: case TransactionIsolationLevel::READ_UNCOMMITTED:
return '0'; return '0';
case TransactionIsolationLevel::READ_COMMITTED: case TransactionIsolationLevel::READ_COMMITTED:
case TransactionIsolationLevel::REPEATABLE_READ: case TransactionIsolationLevel::REPEATABLE_READ:
case TransactionIsolationLevel::SERIALIZABLE: case TransactionIsolationLevel::SERIALIZABLE:
return '1'; return '1';
default: default:
return parent::_getTransactionIsolationLevelSQL($level); return parent::_getTransactionIsolationLevelSQL($level);
} }
......
...@@ -282,6 +282,7 @@ class QueryBuilder ...@@ -282,6 +282,7 @@ class QueryBuilder
case self::INSERT: case self::INSERT:
$sql = $this->getSQLForInsert(); $sql = $this->getSQLForInsert();
break; break;
case self::DELETE: case self::DELETE:
$sql = $this->getSQLForDelete(); $sql = $this->getSQLForDelete();
break; break;
......
...@@ -62,13 +62,16 @@ class DB2SchemaManager extends AbstractSchemaManager ...@@ -62,13 +62,16 @@ class DB2SchemaManager extends AbstractSchemaManager
case 'varchar': case 'varchar':
$length = $tableColumn['length']; $length = $tableColumn['length'];
break; break;
case 'character': case 'character':
$length = $tableColumn['length']; $length = $tableColumn['length'];
$fixed = true; $fixed = true;
break; break;
case 'clob': case 'clob':
$length = $tableColumn['length']; $length = $tableColumn['length'];
break; break;
case 'decimal': case 'decimal':
case 'double': case 'double':
case 'real': case 'real':
......
...@@ -128,6 +128,7 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -128,6 +128,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
case 'binary': case 'binary':
$fixed = true; $fixed = true;
break; break;
case 'float': case 'float':
case 'double': case 'double':
case 'real': case 'real':
...@@ -140,24 +141,31 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -140,24 +141,31 @@ class MySqlSchemaManager extends AbstractSchemaManager
} }
break; break;
case 'tinytext': case 'tinytext':
$length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT; $length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT;
break; break;
case 'text': case 'text':
$length = MySqlPlatform::LENGTH_LIMIT_TEXT; $length = MySqlPlatform::LENGTH_LIMIT_TEXT;
break; break;
case 'mediumtext': case 'mediumtext':
$length = MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT; $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT;
break; break;
case 'tinyblob': case 'tinyblob':
$length = MySqlPlatform::LENGTH_LIMIT_TINYBLOB; $length = MySqlPlatform::LENGTH_LIMIT_TINYBLOB;
break; break;
case 'blob': case 'blob':
$length = MySqlPlatform::LENGTH_LIMIT_BLOB; $length = MySqlPlatform::LENGTH_LIMIT_BLOB;
break; break;
case 'mediumblob': case 'mediumblob':
$length = MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB; $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB;
break; break;
case 'tinyint': case 'tinyint':
case 'smallint': case 'smallint':
case 'mediumint': case 'mediumint':
...@@ -231,8 +239,10 @@ class MySqlSchemaManager extends AbstractSchemaManager ...@@ -231,8 +239,10 @@ class MySqlSchemaManager extends AbstractSchemaManager
switch ($columnDefault) { switch ($columnDefault) {
case 'current_timestamp()': case 'current_timestamp()':
return $platform->getCurrentTimestampSQL(); return $platform->getCurrentTimestampSQL();
case 'curdate()': case 'curdate()':
return $platform->getCurrentDateSQL(); return $platform->getCurrentDateSQL();
case 'curtime()': case 'curtime()':
return $platform->getCurrentTimeSQL(); return $platform->getCurrentTimeSQL();
} }
......
...@@ -179,11 +179,13 @@ class OracleSchemaManager extends AbstractSchemaManager ...@@ -179,11 +179,13 @@ class OracleSchemaManager extends AbstractSchemaManager
} }
break; break;
case 'varchar': case 'varchar':
case 'varchar2': case 'varchar2':
case 'nvarchar2': case 'nvarchar2':
$length = (int) $tableColumn['char_length']; $length = (int) $tableColumn['char_length'];
break; break;
case 'char': case 'char':
case 'nchar': case 'nchar':
$length = (int) $tableColumn['char_length']; $length = (int) $tableColumn['char_length'];
......
...@@ -363,17 +363,20 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -363,17 +363,20 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']); $tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']);
$length = null; $length = null;
break; break;
case 'int': case 'int':
case 'int4': case 'int4':
case 'integer': case 'integer':
$tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']); $tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']);
$length = null; $length = null;
break; break;
case 'bigint': case 'bigint':
case 'int8': case 'int8':
$tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']); $tableColumn['default'] = $this->fixVersion94NegativeNumericDefaultValue($tableColumn['default']);
$length = null; $length = null;
break; break;
case 'bool': case 'bool':
case 'boolean': case 'boolean':
if ($tableColumn['default'] === 'true') { if ($tableColumn['default'] === 'true') {
...@@ -386,15 +389,18 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -386,15 +389,18 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$length = null; $length = null;
break; break;
case 'text': case 'text':
case '_varchar': case '_varchar':
case 'varchar': case 'varchar':
$tableColumn['default'] = $this->parseDefaultExpression($tableColumn['default']); $tableColumn['default'] = $this->parseDefaultExpression($tableColumn['default']);
break; break;
case 'char': case 'char':
case 'bpchar': case 'bpchar':
$fixed = true; $fixed = true;
break; break;
case 'float': case 'float':
case 'float4': case 'float4':
case 'float8': case 'float8':
...@@ -413,6 +419,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -413,6 +419,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
} }
break; break;
case 'year': case 'year':
$length = null; $length = null;
break; break;
......
...@@ -100,6 +100,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager ...@@ -100,6 +100,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
case 'char': case 'char':
case 'nchar': case 'nchar':
$fixed = true; $fixed = true;
break;
} }
switch ($type) { switch ($type) {
...@@ -107,6 +108,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager ...@@ -107,6 +108,7 @@ class SQLAnywhereSchemaManager extends AbstractSchemaManager
case 'float': case 'float':
$precision = $tableColumn['length']; $precision = $tableColumn['length'];
$scale = $tableColumn['scale']; $scale = $tableColumn['scale'];
break;
} }
return new Column( return new Column(
......
...@@ -97,6 +97,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager ...@@ -97,6 +97,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
// Unicode data requires 2 bytes per character // Unicode data requires 2 bytes per character
$length /= 2; $length /= 2;
break; break;
case 'varchar': case 'varchar':
// TEXT type is returned as VARCHAR(MAX) with a length of -1 // TEXT type is returned as VARCHAR(MAX) with a length of -1
if ($length === -1) { if ($length === -1) {
......
...@@ -19,8 +19,11 @@ ...@@ -19,8 +19,11 @@
<rule ref="Doctrine"> <rule ref="Doctrine">
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/> <exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/> <exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/> <exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<!-- https://github.com/slevomat/coding-standard/issues/867 -->
<exclude name="SlevomatCodingStandard.ControlStructures.JumpStatementsSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore"/> <exclude name="Squiz.NamingConventions.ValidVariableName.PublicHasUnderscore"/>
</rule> </rule>
......
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