Unverified Commit d9aaf542 authored by Marco Pivetta's avatar Marco Pivetta

Merge branch 'feature/#2998-segregate-constants-to-enum-alike-classes'

Close #2998
the commit.
parents e125a45c fab1b8ec
# Upgrade to 2.7
## Doctrine\DBAL\Platforms\AbstractPlatform::DATE_INTERVAL_UNIT_* constants deprecated
``Doctrine\DBAL\Platforms\AbstractPlatform::DATE_INTERVAL_UNIT_*`` constants were moved into ``Doctrine\DBAL\Platforms\DateIntervalUnit`` class without the ``DATE_INTERVAL_UNIT_`` prefix.
## Doctrine\DBAL\Platforms\AbstractPlatform::TRIM_* constants deprecated
``Doctrine\DBAL\Platforms\AbstractPlatform::TRIM_*`` constants were moved into ``Doctrine\DBAL\Platforms\TrimMode`` class without the ``TRIM_`` prefix.
## Doctrine\DBAL\Connection::TRANSACTION_* constants deprecated
``Doctrine\DBAL\Connection::TRANSACTION_*`` were moved into ``Doctrine\DBAL\TransactionIsolationLevel`` class without the ``TRANSACTION_`` prefix.
# Upgrade to 2.6
## MINOR BC BREAK: `fetch()` and `fetchAll()` method signatures in `Doctrine\DBAL\Driver\ResultStatement`
......
......@@ -52,23 +52,31 @@ class Connection implements DriverConnection
{
/**
* Constant for transaction isolation level READ UNCOMMITTED.
*
* @deprecated Use TransactionIsolationLevel::READ_UNCOMMITTED.
*/
const TRANSACTION_READ_UNCOMMITTED = 1;
public const TRANSACTION_READ_UNCOMMITTED = TransactionIsolationLevel::READ_UNCOMMITTED;
/**
* Constant for transaction isolation level READ COMMITTED.
*
* @deprecated Use TransactionIsolationLevel::READ_COMMITTED.
*/
const TRANSACTION_READ_COMMITTED = 2;
public const TRANSACTION_READ_COMMITTED = TransactionIsolationLevel::READ_COMMITTED;
/**
* Constant for transaction isolation level REPEATABLE READ.
*
* @deprecated Use TransactionIsolationLevel::REPEATABLE_READ.
*/
const TRANSACTION_REPEATABLE_READ = 3;
public const TRANSACTION_REPEATABLE_READ = TransactionIsolationLevel::REPEATABLE_READ;
/**
* Constant for transaction isolation level SERIALIZABLE.
*
* @deprecated Use TransactionIsolationLevel::SERIALIZABLE.
*/
const TRANSACTION_SERIALIZABLE = 4;
public const TRANSACTION_SERIALIZABLE = TransactionIsolationLevel::SERIALIZABLE;
/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
......
......@@ -20,7 +20,6 @@
namespace Doctrine\DBAL\Platforms;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs;
use Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs;
......@@ -40,6 +39,7 @@ use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types;
use Doctrine\DBAL\Types\Type;
......@@ -70,64 +70,72 @@ abstract class AbstractPlatform
const CREATE_FOREIGNKEYS = 2;
/**
* @var string
* @deprecated Use DateIntervalUnit::INTERVAL_UNIT_SECOND.
*/
const DATE_INTERVAL_UNIT_SECOND = 'SECOND';
public const DATE_INTERVAL_UNIT_SECOND = DateIntervalUnit::SECOND;
/**
* @var string
* @deprecated Use DateIntervalUnit::MINUTE.
*/
const DATE_INTERVAL_UNIT_MINUTE = 'MINUTE';
public const DATE_INTERVAL_UNIT_MINUTE = DateIntervalUnit::MINUTE;
/**
* @var string
* @deprecated Use DateIntervalUnit::HOUR.
*/
const DATE_INTERVAL_UNIT_HOUR = 'HOUR';
public const DATE_INTERVAL_UNIT_HOUR = DateIntervalUnit::HOUR;
/**
* @var string
* @deprecated Use DateIntervalUnit::DAY.
*/
const DATE_INTERVAL_UNIT_DAY = 'DAY';
public const DATE_INTERVAL_UNIT_DAY = DateIntervalUnit::DAY;
/**
* @var string
* @deprecated Use DateIntervalUnit::WEEK.
*/
const DATE_INTERVAL_UNIT_WEEK = 'WEEK';
public const DATE_INTERVAL_UNIT_WEEK = DateIntervalUnit::WEEK;
/**
* @var string
* @deprecated Use DateIntervalUnit::MONTH.
*/
const DATE_INTERVAL_UNIT_MONTH = 'MONTH';
public const DATE_INTERVAL_UNIT_MONTH = DateIntervalUnit::MONTH;
/**
* @var string
* @deprecated Use DateIntervalUnit::QUARTER.
*/
const DATE_INTERVAL_UNIT_QUARTER = 'QUARTER';
public const DATE_INTERVAL_UNIT_QUARTER = DateIntervalUnit::QUARTER;
/**
* @var string
* @deprecated Use DateIntervalUnit::QUARTER.
*/
const DATE_INTERVAL_UNIT_YEAR = 'YEAR';
public const DATE_INTERVAL_UNIT_YEAR = DateIntervalUnit::YEAR;
/**
* @var int
*
* @deprecated Use TrimMode::UNSPECIFIED.
*/
const TRIM_UNSPECIFIED = 0;
public const TRIM_UNSPECIFIED = TrimMode::UNSPECIFIED;
/**
* @var int
*
* @deprecated Use TrimMode::LEADING.
*/
const TRIM_LEADING = 1;
public const TRIM_LEADING = TrimMode::LEADING;
/**
* @var int
*
* @deprecated Use TrimMode::TRAILING.
*/
const TRIM_TRAILING = 2;
public const TRIM_TRAILING = TrimMode::TRAILING;
/**
* @var int
*
* @deprecated Use TrimMode::BOTH.
*/
const TRIM_BOTH = 3;
public const TRIM_BOTH = TrimMode::BOTH;
/**
* @var array|null
......@@ -765,35 +773,35 @@ abstract class AbstractPlatform
/**
* Returns the SQL snippet to trim a string.
*
* @param string $str The expression to apply the trim to.
* @param int $pos The position of the trim (leading/trailing/both).
* @param string|boolean $char The char to trim, has to be quoted already. Defaults to space.
* @param string $str The expression to apply the trim to.
* @param int $mode The position of the trim (leading/trailing/both).
* @param string|bool $char The char to trim, has to be quoted already. Defaults to space.
*
* @return string
*/
public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false)
public function getTrimExpression($str, $mode = TrimMode::UNSPECIFIED, $char = false)
{
$expression = '';
switch ($pos) {
case self::TRIM_LEADING:
switch ($mode) {
case TrimMode::LEADING:
$expression = 'LEADING ';
break;
case self::TRIM_TRAILING:
case TrimMode::TRAILING:
$expression = 'TRAILING ';
break;
case self::TRIM_BOTH:
case TrimMode::BOTH:
$expression = 'BOTH ';
break;
}
if (false !== $char) {
if ($char !== false) {
$expression .= $char . ' ';
}
if ($pos || false !== $char) {
if ($mode || $char !== false) {
$expression .= 'FROM ';
}
......@@ -1049,7 +1057,7 @@ abstract class AbstractPlatform
*/
public function getDateAddSecondsExpression($date, $seconds)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $seconds, self::DATE_INTERVAL_UNIT_SECOND);
return $this->getDateArithmeticIntervalExpression($date, '+', $seconds, DateIntervalUnit::SECOND);
}
/**
......@@ -1064,7 +1072,7 @@ abstract class AbstractPlatform
*/
public function getDateSubSecondsExpression($date, $seconds)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $seconds, self::DATE_INTERVAL_UNIT_SECOND);
return $this->getDateArithmeticIntervalExpression($date, '-', $seconds, DateIntervalUnit::SECOND);
}
/**
......@@ -1079,7 +1087,7 @@ abstract class AbstractPlatform
*/
public function getDateAddMinutesExpression($date, $minutes)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $minutes, self::DATE_INTERVAL_UNIT_MINUTE);
return $this->getDateArithmeticIntervalExpression($date, '+', $minutes, DateIntervalUnit::MINUTE);
}
/**
......@@ -1094,7 +1102,7 @@ abstract class AbstractPlatform
*/
public function getDateSubMinutesExpression($date, $minutes)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $minutes, self::DATE_INTERVAL_UNIT_MINUTE);
return $this->getDateArithmeticIntervalExpression($date, '-', $minutes, DateIntervalUnit::MINUTE);
}
/**
......@@ -1109,7 +1117,7 @@ abstract class AbstractPlatform
*/
public function getDateAddHourExpression($date, $hours)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $hours, self::DATE_INTERVAL_UNIT_HOUR);
return $this->getDateArithmeticIntervalExpression($date, '+', $hours, DateIntervalUnit::HOUR);
}
/**
......@@ -1124,7 +1132,7 @@ abstract class AbstractPlatform
*/
public function getDateSubHourExpression($date, $hours)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $hours, self::DATE_INTERVAL_UNIT_HOUR);
return $this->getDateArithmeticIntervalExpression($date, '-', $hours, DateIntervalUnit::HOUR);
}
/**
......@@ -1139,7 +1147,7 @@ abstract class AbstractPlatform
*/
public function getDateAddDaysExpression($date, $days)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $days, self::DATE_INTERVAL_UNIT_DAY);
return $this->getDateArithmeticIntervalExpression($date, '+', $days, DateIntervalUnit::DAY);
}
/**
......@@ -1154,7 +1162,7 @@ abstract class AbstractPlatform
*/
public function getDateSubDaysExpression($date, $days)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $days, self::DATE_INTERVAL_UNIT_DAY);
return $this->getDateArithmeticIntervalExpression($date, '-', $days, DateIntervalUnit::DAY);
}
/**
......@@ -1169,7 +1177,7 @@ abstract class AbstractPlatform
*/
public function getDateAddWeeksExpression($date, $weeks)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $weeks, self::DATE_INTERVAL_UNIT_WEEK);
return $this->getDateArithmeticIntervalExpression($date, '+', $weeks, DateIntervalUnit::WEEK);
}
/**
......@@ -1184,7 +1192,7 @@ abstract class AbstractPlatform
*/
public function getDateSubWeeksExpression($date, $weeks)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $weeks, self::DATE_INTERVAL_UNIT_WEEK);
return $this->getDateArithmeticIntervalExpression($date, '-', $weeks, DateIntervalUnit::WEEK);
}
/**
......@@ -1199,7 +1207,7 @@ abstract class AbstractPlatform
*/
public function getDateAddMonthExpression($date, $months)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $months, self::DATE_INTERVAL_UNIT_MONTH);
return $this->getDateArithmeticIntervalExpression($date, '+', $months, DateIntervalUnit::MONTH);
}
/**
......@@ -1214,7 +1222,7 @@ abstract class AbstractPlatform
*/
public function getDateSubMonthExpression($date, $months)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $months, self::DATE_INTERVAL_UNIT_MONTH);
return $this->getDateArithmeticIntervalExpression($date, '-', $months, DateIntervalUnit::MONTH);
}
/**
......@@ -1229,7 +1237,7 @@ abstract class AbstractPlatform
*/
public function getDateAddQuartersExpression($date, $quarters)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $quarters, self::DATE_INTERVAL_UNIT_QUARTER);
return $this->getDateArithmeticIntervalExpression($date, '+', $quarters, DateIntervalUnit::QUARTER);
}
/**
......@@ -1244,7 +1252,7 @@ abstract class AbstractPlatform
*/
public function getDateSubQuartersExpression($date, $quarters)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $quarters, self::DATE_INTERVAL_UNIT_QUARTER);
return $this->getDateArithmeticIntervalExpression($date, '-', $quarters, DateIntervalUnit::QUARTER);
}
/**
......@@ -1259,7 +1267,7 @@ abstract class AbstractPlatform
*/
public function getDateAddYearsExpression($date, $years)
{
return $this->getDateArithmeticIntervalExpression($date, '+', $years, self::DATE_INTERVAL_UNIT_YEAR);
return $this->getDateArithmeticIntervalExpression($date, '+', $years, DateIntervalUnit::YEAR);
}
/**
......@@ -1274,7 +1282,7 @@ abstract class AbstractPlatform
*/
public function getDateSubYearsExpression($date, $years)
{
return $this->getDateArithmeticIntervalExpression($date, '-', $years, self::DATE_INTERVAL_UNIT_YEAR);
return $this->getDateArithmeticIntervalExpression($date, '-', $years, DateIntervalUnit::YEAR);
}
/**
......@@ -2715,13 +2723,13 @@ abstract class AbstractPlatform
protected function _getTransactionIsolationLevelSQL($level)
{
switch ($level) {
case Connection::TRANSACTION_READ_UNCOMMITTED:
case TransactionIsolationLevel::READ_UNCOMMITTED:
return 'READ UNCOMMITTED';
case Connection::TRANSACTION_READ_COMMITTED:
case TransactionIsolationLevel::READ_COMMITTED:
return 'READ COMMITTED';
case Connection::TRANSACTION_REPEATABLE_READ:
case TransactionIsolationLevel::REPEATABLE_READ:
return 'REPEATABLE READ';
case Connection::TRANSACTION_SERIALIZABLE:
case TransactionIsolationLevel::SERIALIZABLE:
return 'SERIALIZABLE';
default:
throw new \InvalidArgumentException('Invalid isolation level:' . $level);
......@@ -3007,11 +3015,11 @@ abstract class AbstractPlatform
*
* @return int The default isolation level.
*
* @see Doctrine\DBAL\Connection\TRANSACTION_* constants.
* @see TransactionIsolationLevel
*/
public function getDefaultTransactionIsolationLevel()
{
return Connection::TRANSACTION_READ_COMMITTED;
return TransactionIsolationLevel::READ_COMMITTED;
}
/* supports*() methods */
......
......@@ -193,14 +193,14 @@ class DB2Platform extends AbstractPlatform
protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
{
switch ($unit) {
case self::DATE_INTERVAL_UNIT_WEEK:
case DateIntervalUnit::WEEK:
$interval *= 7;
$unit = self::DATE_INTERVAL_UNIT_DAY;
$unit = DateIntervalUnit::DAY;
break;
case self::DATE_INTERVAL_UNIT_QUARTER:
case DateIntervalUnit::QUARTER:
$interval *= 3;
$unit = self::DATE_INTERVAL_UNIT_MONTH;
$unit = DateIntervalUnit::MONTH;
break;
}
......
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms;
final class DateIntervalUnit
{
public const SECOND = 'SECOND';
public const MINUTE = 'MINUTE';
public const HOUR = 'HOUR';
public const DAY = 'DAY';
public const WEEK = 'WEEK';
public const MONTH = 'MONTH';
public const QUARTER = 'QUARTER';
public const YEAR = 'YEAR';
private function __construct()
{
}
}
......@@ -19,11 +19,11 @@
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\BlobType;
use Doctrine\DBAL\Types\TextType;
......@@ -1136,6 +1136,6 @@ class MySqlPlatform extends AbstractPlatform
*/
public function getDefaultTransactionIsolationLevel()
{
return Connection::TRANSACTION_REPEATABLE_READ;
return TransactionIsolationLevel::REPEATABLE_READ;
}
}
......@@ -26,6 +26,7 @@ use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\BinaryType;
/**
......@@ -106,15 +107,15 @@ class OraclePlatform extends AbstractPlatform
protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
{
switch ($unit) {
case self::DATE_INTERVAL_UNIT_MONTH:
case self::DATE_INTERVAL_UNIT_QUARTER:
case self::DATE_INTERVAL_UNIT_YEAR:
case DateIntervalUnit::MONTH:
case DateIntervalUnit::QUARTER:
case DateIntervalUnit::YEAR:
switch ($unit) {
case self::DATE_INTERVAL_UNIT_QUARTER:
case DateIntervalUnit::QUARTER:
$interval *= 3;
break;
case self::DATE_INTERVAL_UNIT_YEAR:
case DateIntervalUnit::YEAR:
$interval *= 12;
break;
}
......@@ -125,19 +126,19 @@ class OraclePlatform extends AbstractPlatform
$calculationClause = '';
switch ($unit) {
case self::DATE_INTERVAL_UNIT_SECOND:
case DateIntervalUnit::SECOND:
$calculationClause = '/24/60/60';
break;
case self::DATE_INTERVAL_UNIT_MINUTE:
case DateIntervalUnit::MINUTE:
$calculationClause = '/24/60';
break;
case self::DATE_INTERVAL_UNIT_HOUR:
case DateIntervalUnit::HOUR:
$calculationClause = '/24';
break;
case self::DATE_INTERVAL_UNIT_WEEK:
case DateIntervalUnit::WEEK:
$calculationClause = '*7';
break;
}
......@@ -244,12 +245,12 @@ class OraclePlatform extends AbstractPlatform
protected function _getTransactionIsolationLevelSQL($level)
{
switch ($level) {
case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED:
case TransactionIsolationLevel::READ_UNCOMMITTED:
return 'READ UNCOMMITTED';
case \Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED:
case TransactionIsolationLevel::READ_COMMITTED:
return 'READ COMMITTED';
case \Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ:
case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE:
case TransactionIsolationLevel::REPEATABLE_READ:
case TransactionIsolationLevel::SERIALIZABLE:
return 'SERIALIZABLE';
default:
return parent::_getTransactionIsolationLevelSQL($level);
......
......@@ -129,9 +129,9 @@ class PostgreSqlPlatform extends AbstractPlatform
*/
protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
{
if (self::DATE_INTERVAL_UNIT_QUARTER === $unit) {
if ($unit === DateIntervalUnit::QUARTER) {
$interval *= 3;
$unit = self::DATE_INTERVAL_UNIT_MONTH;
$unit = DateIntervalUnit::MONTH;
}
return "(" . $date ." " . $operator . " (" . $interval . " || ' " . $unit . "')::interval)";
......
......@@ -19,7 +19,6 @@
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Schema\Column;
......@@ -30,6 +29,7 @@ use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
/**
* The SQLAnywherePlatform provides the behavior, features and SQL dialect of the
......@@ -533,7 +533,7 @@ class SQLAnywherePlatform extends AbstractPlatform
*/
public function getDefaultTransactionIsolationLevel()
{
return Connection::TRANSACTION_READ_UNCOMMITTED;
return TransactionIsolationLevel::READ_UNCOMMITTED;
}
/**
......@@ -1103,13 +1103,13 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
* {@inheritdoc}
*/
public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false)
public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false)
{
if ( ! $char) {
switch ($pos) {
case self::TRIM_LEADING:
case TrimMode::LEADING:
return $this->getLtrimExpression($str);
case self::TRIM_TRAILING:
case TrimMode::TRAILING:
return $this->getRtrimExpression($str);
default:
return 'TRIM(' . $str . ')';
......@@ -1119,9 +1119,9 @@ class SQLAnywherePlatform extends AbstractPlatform
$pattern = "'%[^' + $char + ']%'";
switch ($pos) {
case self::TRIM_LEADING:
case TrimMode::LEADING:
return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))';
case self::TRIM_TRAILING:
case TrimMode::TRAILING:
return 'REVERSE(SUBSTR(REVERSE(' . $str . '), PATINDEX(' . $pattern . ', REVERSE(' . $str . '))))';
default:
return
......@@ -1275,13 +1275,13 @@ class SQLAnywherePlatform extends AbstractPlatform
protected function _getTransactionIsolationLevelSQL($level)
{
switch ($level) {
case Connection::TRANSACTION_READ_UNCOMMITTED:
case TransactionIsolationLevel::READ_UNCOMMITTED:
return 0;
case Connection::TRANSACTION_READ_COMMITTED:
case TransactionIsolationLevel::READ_COMMITTED:
return 1;
case Connection::TRANSACTION_REPEATABLE_READ:
case TransactionIsolationLevel::REPEATABLE_READ:
return 2;
case Connection::TRANSACTION_SERIALIZABLE:
case TransactionIsolationLevel::SERIALIZABLE:
return 3;
default:
throw new \InvalidArgumentException('Invalid isolation level:' . $level);
......
......@@ -1003,15 +1003,15 @@ class SQLServerPlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false)
public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false)
{
if ( ! $char) {
switch ($pos) {
case self::TRIM_LEADING:
case TrimMode::LEADING:
$trimFn = 'LTRIM';
break;
case self::TRIM_TRAILING:
case TrimMode::TRAILING:
$trimFn = 'RTRIM';
break;
......@@ -1033,11 +1033,11 @@ class SQLServerPlatform extends AbstractPlatform
*/
$pattern = "'%[^' + $char + ']%'";
if ($pos == self::TRIM_LEADING) {
if ($pos === TrimMode::LEADING) {
return 'stuff(' . $str . ', 1, patindex(' . $pattern . ', ' . $str . ') - 1, null)';
}
if ($pos == self::TRIM_TRAILING) {
if ($pos === TrimMode::TRAILING) {
return 'reverse(stuff(reverse(' . $str . '), 1, patindex(' . $pattern . ', reverse(' . $str . ')) - 1, null))';
}
......
......@@ -27,6 +27,7 @@ use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types;
/**
......@@ -79,16 +80,16 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*/
public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false)
public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false)
{
$trimChar = ($char != false) ? (', ' . $char) : '';
switch ($pos) {
case self::TRIM_LEADING:
case TrimMode::LEADING:
$trimFn = 'LTRIM';
break;
case self::TRIM_TRAILING:
case TrimMode::TRAILING:
$trimFn = 'RTRIM';
break;
......@@ -131,21 +132,21 @@ class SqlitePlatform extends AbstractPlatform
protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
{
switch ($unit) {
case self::DATE_INTERVAL_UNIT_SECOND:
case self::DATE_INTERVAL_UNIT_MINUTE:
case self::DATE_INTERVAL_UNIT_HOUR:
case DateIntervalUnit::SECOND:
case DateIntervalUnit::MINUTE:
case DateIntervalUnit::HOUR:
return "DATETIME(" . $date . ",'" . $operator . $interval . " " . $unit . "')";
default:
switch ($unit) {
case self::DATE_INTERVAL_UNIT_WEEK:
case DateIntervalUnit::WEEK:
$interval *= 7;
$unit = self::DATE_INTERVAL_UNIT_DAY;
$unit = DateIntervalUnit::DAY;
break;
case self::DATE_INTERVAL_UNIT_QUARTER:
case DateIntervalUnit::QUARTER:
$interval *= 3;
$unit = self::DATE_INTERVAL_UNIT_MONTH;
$unit = DateIntervalUnit::MONTH;
break;
}
......@@ -167,11 +168,11 @@ class SqlitePlatform extends AbstractPlatform
protected function _getTransactionIsolationLevelSQL($level)
{
switch ($level) {
case \Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED:
case TransactionIsolationLevel::READ_UNCOMMITTED:
return 0;
case \Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED:
case \Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ:
case \Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE:
case TransactionIsolationLevel::READ_COMMITTED:
case TransactionIsolationLevel::REPEATABLE_READ:
case TransactionIsolationLevel::SERIALIZABLE:
return 1;
default:
return parent::_getTransactionIsolationLevelSQL($level);
......
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms;
final class TrimMode
{
public const UNSPECIFIED = 0;
public const LEADING = 1;
public const TRAILING = 2;
public const BOTH = 3;
private function __construct()
{
}
}
<?php
declare(strict_types=1);
namespace Doctrine\DBAL;
final class TransactionIsolationLevel
{
/**
* Transaction isolation level READ UNCOMMITTED.
*/
public const READ_UNCOMMITTED = 1;
/**
* Transaction isolation level READ COMMITTED.
*/
public const READ_COMMITTED = 2;
/**
* Transaction isolation level REPEATABLE READ.
*/
public const REPEATABLE_READ = 3;
/**
* Transaction isolation level SERIALIZABLE.
*/
public const SERIALIZABLE = 4;
private function __construct()
{
}
}
......@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Functional;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use Doctrine\DBAL\Types\Type;
use PDO;
......@@ -459,42 +460,42 @@ class DataAccessTest extends \Doctrine\Tests\DbalFunctionalTestCase
public function getTrimExpressionData()
{
return array(
array('test_string', AbstractPlatform::TRIM_UNSPECIFIED, false, 'foo'),
array('test_string', AbstractPlatform::TRIM_LEADING, false, 'foo'),
array('test_string', AbstractPlatform::TRIM_TRAILING, false, 'foo'),
array('test_string', AbstractPlatform::TRIM_BOTH, false, 'foo'),
array('test_string', AbstractPlatform::TRIM_UNSPECIFIED, "'f'", 'oo'),
array('test_string', AbstractPlatform::TRIM_UNSPECIFIED, "'o'", 'f'),
array('test_string', AbstractPlatform::TRIM_UNSPECIFIED, "'.'", 'foo'),
array('test_string', AbstractPlatform::TRIM_LEADING, "'f'", 'oo'),
array('test_string', AbstractPlatform::TRIM_LEADING, "'o'", 'foo'),
array('test_string', AbstractPlatform::TRIM_LEADING, "'.'", 'foo'),
array('test_string', AbstractPlatform::TRIM_TRAILING, "'f'", 'foo'),
array('test_string', AbstractPlatform::TRIM_TRAILING, "'o'", 'f'),
array('test_string', AbstractPlatform::TRIM_TRAILING, "'.'", 'foo'),
array('test_string', AbstractPlatform::TRIM_BOTH, "'f'", 'oo'),
array('test_string', AbstractPlatform::TRIM_BOTH, "'o'", 'f'),
array('test_string', AbstractPlatform::TRIM_BOTH, "'.'", 'foo'),
array("' foo '", AbstractPlatform::TRIM_UNSPECIFIED, false, 'foo'),
array("' foo '", AbstractPlatform::TRIM_LEADING, false, 'foo '),
array("' foo '", AbstractPlatform::TRIM_TRAILING, false, ' foo'),
array("' foo '", AbstractPlatform::TRIM_BOTH, false, 'foo'),
array("' foo '", AbstractPlatform::TRIM_UNSPECIFIED, "'f'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_UNSPECIFIED, "'o'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_UNSPECIFIED, "'.'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_UNSPECIFIED, "' '", 'foo'),
array("' foo '", AbstractPlatform::TRIM_LEADING, "'f'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_LEADING, "'o'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_LEADING, "'.'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_LEADING, "' '", 'foo '),
array("' foo '", AbstractPlatform::TRIM_TRAILING, "'f'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_TRAILING, "'o'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_TRAILING, "'.'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_TRAILING, "' '", ' foo'),
array("' foo '", AbstractPlatform::TRIM_BOTH, "'f'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_BOTH, "'o'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_BOTH, "'.'", ' foo '),
array("' foo '", AbstractPlatform::TRIM_BOTH, "' '", 'foo'),
['test_string', TrimMode::UNSPECIFIED, false, 'foo'],
['test_string', TrimMode::LEADING, false, 'foo'],
['test_string', TrimMode::TRAILING, false, 'foo'],
['test_string', TrimMode::BOTH, false, 'foo'],
['test_string', TrimMode::UNSPECIFIED, "'f'", 'oo'],
['test_string', TrimMode::UNSPECIFIED, "'o'", 'f'],
['test_string', TrimMode::UNSPECIFIED, "'.'", 'foo'],
['test_string', TrimMode::LEADING, "'f'", 'oo'],
['test_string', TrimMode::LEADING, "'o'", 'foo'],
['test_string', TrimMode::LEADING, "'.'", 'foo'],
['test_string', TrimMode::TRAILING, "'f'", 'foo'],
['test_string', TrimMode::TRAILING, "'o'", 'f'],
['test_string', TrimMode::TRAILING, "'.'", 'foo'],
['test_string', TrimMode::BOTH, "'f'", 'oo'],
['test_string', TrimMode::BOTH, "'o'", 'f'],
['test_string', TrimMode::BOTH, "'.'", 'foo'],
["' foo '", TrimMode::UNSPECIFIED, false, 'foo'],
["' foo '", TrimMode::LEADING, false, 'foo '],
["' foo '", TrimMode::TRAILING, false, ' foo'],
["' foo '", TrimMode::BOTH, false, 'foo'],
["' foo '", TrimMode::UNSPECIFIED, "'f'", ' foo '],
["' foo '", TrimMode::UNSPECIFIED, "'o'", ' foo '],
["' foo '", TrimMode::UNSPECIFIED, "'.'", ' foo '],
["' foo '", TrimMode::UNSPECIFIED, "' '", 'foo'],
["' foo '", TrimMode::LEADING, "'f'", ' foo '],
["' foo '", TrimMode::LEADING, "'o'", ' foo '],
["' foo '", TrimMode::LEADING, "'.'", ' foo '],
["' foo '", TrimMode::LEADING, "' '", 'foo '],
["' foo '", TrimMode::TRAILING, "'f'", ' foo '],
["' foo '", TrimMode::TRAILING, "'o'", ' foo '],
["' foo '", TrimMode::TRAILING, "'.'", ' foo '],
["' foo '", TrimMode::TRAILING, "' '", ' foo'],
["' foo '", TrimMode::BOTH, "'f'", ' foo '],
["' foo '", TrimMode::BOTH, "'o'", ' foo '],
["' foo '", TrimMode::BOTH, "'.'", ' foo '],
["' foo '", TrimMode::BOTH, "' '", 'foo'],
);
}
......
......@@ -8,6 +8,7 @@ use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
{
......@@ -56,20 +57,20 @@ abstract class AbstractMySQLPlatformTestCase extends AbstractPlatformTestCase
{
self::assertEquals(
'SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED),
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED),
''
);
self::assertEquals(
'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
......@@ -6,6 +6,7 @@ use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;
abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCase
......@@ -112,19 +113,19 @@ abstract class AbstractPostgreSqlPlatformTestCase extends AbstractPlatformTestCa
{
self::assertEquals(
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED)
);
self::assertEquals(
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL READ COMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL REPEATABLE READ',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
......@@ -6,6 +6,7 @@ use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;
abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCase
......@@ -65,20 +66,20 @@ abstract class AbstractSQLServerPlatformTestCase extends AbstractPlatformTestCas
public function testGeneratesTransactionsCommands()
{
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED)
'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ COMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
'SET TRANSACTION ISOLATION LEVEL READ COMMITTED',
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
'SET TRANSACTION ISOLATION LEVEL REPEATABLE READ',
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
......@@ -3,7 +3,7 @@
namespace Doctrine\Tests\DBAL\Platforms;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\TransactionIsolationLevel;
class MySqlPlatformTest extends AbstractMySQLPlatformTestCase
{
......@@ -15,7 +15,7 @@ class MySqlPlatformTest extends AbstractMySQLPlatformTestCase
public function testHasCorrectDefaultTransactionIsolationLevel()
{
self::assertEquals(
Connection::TRANSACTION_REPEATABLE_READ,
TransactionIsolationLevel::REPEATABLE_READ,
$this->_platform->getDefaultTransactionIsolationLevel()
);
}
......
......@@ -8,6 +8,7 @@ use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Comparator;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;
class OraclePlatformTest extends AbstractPlatformTestCase
......@@ -106,19 +107,19 @@ class OraclePlatformTest extends AbstractPlatformTestCase
{
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL READ COMMITTED',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'SET TRANSACTION ISOLATION LEVEL SERIALIZABLE',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
......@@ -6,6 +6,7 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\LockMode;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\Comparator;
......@@ -13,6 +14,7 @@ use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;
class SQLAnywherePlatformTest extends AbstractPlatformTestCase
......@@ -549,11 +551,11 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
self::assertEquals('GLOBAL TEMPORARY', $this->_platform->getTemporaryTableSQL());
self::assertEquals(
'LTRIM(column)',
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING)
$this->_platform->getTrimExpression('column', TrimMode::LEADING)
);
self::assertEquals(
'RTRIM(column)',
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING)
$this->_platform->getTrimExpression('column', TrimMode::TRAILING)
);
self::assertEquals(
'TRIM(column)',
......@@ -561,15 +563,15 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
);
self::assertEquals(
'TRIM(column)',
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED)
$this->_platform->getTrimExpression('column', TrimMode::UNSPECIFIED)
);
self::assertEquals(
"SUBSTR(column, PATINDEX('%[^' + c + ']%', column))",
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_LEADING, 'c')
$this->_platform->getTrimExpression('column', TrimMode::LEADING, 'c')
);
self::assertEquals(
"REVERSE(SUBSTR(REVERSE(column), PATINDEX('%[^' + c + ']%', REVERSE(column))))",
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_TRAILING, 'c')
$this->_platform->getTrimExpression('column', TrimMode::TRAILING, 'c')
);
self::assertEquals(
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " .
......@@ -579,7 +581,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
self::assertEquals(
"REVERSE(SUBSTR(REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))), PATINDEX('%[^' + c + ']%', " .
"REVERSE(SUBSTR(column, PATINDEX('%[^' + c + ']%', column))))))",
$this->_platform->getTrimExpression('column', AbstractPlatform::TRIM_UNSPECIFIED, 'c')
$this->_platform->getTrimExpression('column', TrimMode::UNSPECIFIED, 'c')
);
}
......@@ -601,7 +603,7 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
public function testHasCorrectDefaultTransactionIsolationLevel()
{
self::assertEquals(
Connection::TRANSACTION_READ_UNCOMMITTED,
TransactionIsolationLevel::READ_UNCOMMITTED,
$this->_platform->getDefaultTransactionIsolationLevel()
);
}
......@@ -610,19 +612,19 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
{
self::assertEquals(
'SET TEMPORARY OPTION isolation_level = 0',
$this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_UNCOMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED)
);
self::assertEquals(
'SET TEMPORARY OPTION isolation_level = 1',
$this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_READ_COMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'SET TEMPORARY OPTION isolation_level = 2',
$this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_REPEATABLE_READ)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'SET TEMPORARY OPTION isolation_level = 3',
$this->_platform->getSetTransactionIsolationSQL(Connection::TRANSACTION_SERIALIZABLE)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
......@@ -7,6 +7,7 @@ use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\TransactionIsolationLevel;
use Doctrine\DBAL\Types\Type;
class SqlitePlatformTest extends AbstractPlatformTestCase
......@@ -40,19 +41,19 @@ class SqlitePlatformTest extends AbstractPlatformTestCase
{
self::assertEquals(
'PRAGMA read_uncommitted = 0',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_UNCOMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_UNCOMMITTED)
);
self::assertEquals(
'PRAGMA read_uncommitted = 1',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::READ_COMMITTED)
);
self::assertEquals(
'PRAGMA read_uncommitted = 1',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_REPEATABLE_READ)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::REPEATABLE_READ)
);
self::assertEquals(
'PRAGMA read_uncommitted = 1',
$this->_platform->getSetTransactionIsolationSQL(\Doctrine\DBAL\Connection::TRANSACTION_SERIALIZABLE)
$this->_platform->getSetTransactionIsolationSQL(TransactionIsolationLevel::SERIALIZABLE)
);
}
......
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