Update website

This commit is contained in:
Guilhem Lavaux 2024-11-19 08:02:04 +01:00
parent 4413528994
commit 1d90fbf296
6865 changed files with 1091082 additions and 0 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Exception;
use function sprintf;
/**
* Provides the behavior, features and SQL dialect of the IBM DB2 11.1 (11.1 GA) database platform.
*
* @deprecated This class will be merged with {@see DB2Platform} in 4.0 because support for IBM DB2
* releases prior to 11.1 will be dropped.
*
* @see https://www.ibm.com/docs/en/db2/11.1?topic=database-whats-new-db2-version-111-ga
*/
class DB2111Platform extends DB2Platform
{
/**
* {@inheritDoc}
*
* @see https://www.ibm.com/docs/en/db2/11.1?topic=subselect-fetch-clause
*/
protected function doModifyLimitQuery($query, $limit, $offset)
{
if ($offset > 0) {
$query .= sprintf(' OFFSET %u ROWS', $offset);
}
if ($limit !== null) {
if ($limit < 0) {
throw new Exception(sprintf('Limit must be a positive integer or zero, %d given', $limit));
}
$query .= sprintf(' FETCH %s %u ROWS ONLY', $offset === 0 ? 'FIRST' : 'NEXT', $limit);
}
return $query;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,29 @@
<?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';
/** @codeCoverageIgnore */
private function __construct()
{
}
}

View file

@ -0,0 +1,430 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* DB2 Keywords.
*/
class DB2Keywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'DB2Keywords::getName() is deprecated.',
);
return 'DB2';
}
/**
* {@inheritDoc}
*/
protected function getKeywords()
{
return [
'ACTIVATE',
'ADD',
'AFTER',
'ALIAS',
'ALL',
'ALLOCATE',
'ALLOW',
'ALTER',
'AND',
'ANY',
'AS',
'ASENSITIVE',
'ASSOCIATE',
'ASUTIME',
'AT',
'ATTRIBUTES',
'AUDIT',
'AUTHORIZATION',
'AUX',
'AUXILIARY',
'BEFORE',
'BEGIN',
'BETWEEN',
'BINARY',
'BUFFERPOOL',
'BY',
'CACHE',
'CALL',
'CALLED',
'CAPTURE',
'CARDINALITY',
'CASCADED',
'CASE',
'CAST',
'CCSID',
'CHAR',
'CHARACTER',
'CHECK',
'CLONE',
'CLOSE',
'CLUSTER',
'COLLECTION',
'COLLID',
'COLUMN',
'COMMENT',
'COMMIT',
'CONCAT',
'CONDITION',
'CONNECT',
'CONNECTION',
'CONSTRAINT',
'CONTAINS',
'CONTINUE',
'COUNT',
'COUNT_BIG',
'CREATE',
'CROSS',
'CURRENT',
'CURRENT_DATE',
'CURRENT_LC_CTYPE',
'CURRENT_PATH',
'CURRENT_SCHEMA',
'CURRENT_SERVER',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_TIMEZONE',
'CURRENT_USER',
'CURSOR',
'CYCLE',
'DATA',
'DATABASE',
'DATAPARTITIONNAME',
'DATAPARTITIONNUM',
'DATE',
'DAY',
'DAYS',
'DB2GENERAL',
'DB2GENRL',
'DB2SQL',
'DBINFO',
'DBPARTITIONNAME',
'DBPARTITIONNUM',
'DEALLOCATE',
'DECLARE',
'DEFAULT',
'DEFAULTS',
'DEFINITION',
'DELETE',
'DENSE_RANK',
'DENSERANK',
'DESCRIBE',
'DESCRIPTOR',
'DETERMINISTIC',
'DIAGNOSTICS',
'DISABLE',
'DISALLOW',
'DISCONNECT',
'DISTINCT',
'DO',
'DOCUMENT',
'DOUBLE',
'DROP',
'DSSIZE',
'DYNAMIC',
'EACH',
'EDITPROC',
'ELSE',
'ELSEIF',
'ENABLE',
'ENCODING',
'ENCRYPTION',
'END',
'END-EXEC',
'ENDING',
'ERASE',
'ESCAPE',
'EVERY',
'EXCEPT',
'EXCEPTION',
'EXCLUDING',
'EXCLUSIVE',
'EXECUTE',
'EXISTS',
'EXIT',
'EXPLAIN',
'EXTERNAL',
'EXTRACT',
'FENCED',
'FETCH',
'FIELDPROC',
'FILE',
'FINAL',
'FOR',
'FOREIGN',
'FREE',
'FROM',
'FULL',
'FUNCTION',
'GENERAL',
'GENERATED',
'GET',
'GLOBAL',
'GO',
'GOTO',
'GRANT',
'GRAPHIC',
'GROUP',
'HANDLER',
'HASH',
'HASHED_VALUE',
'HAVING',
'HINT',
'HOLD',
'HOUR',
'HOURS',
'IDENTITY',
'IF',
'IMMEDIATE',
'IN',
'INCLUDING',
'INCLUSIVE',
'INCREMENT',
'INDEX',
'INDICATOR',
'INF',
'INFINITY',
'INHERIT',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INTEGRITY',
'INTERSECT',
'INTO',
'IS',
'ISOBID',
'ISOLATION',
'ITERATE',
'JAR',
'JAVA',
'JOIN',
'KEEP',
'KEY',
'LABEL',
'LANGUAGE',
'LATERAL',
'LC_CTYPE',
'LEAVE',
'LEFT',
'LIKE',
'LINKTYPE',
'LOCAL',
'LOCALDATE',
'LOCALE',
'LOCALTIME',
'LOCALTIMESTAMP RIGHT',
'LOCATOR',
'LOCATORS',
'LOCK',
'LOCKMAX',
'LOCKSIZE',
'LONG',
'LOOP',
'MAINTAINED',
'MATERIALIZED',
'MAXVALUE',
'MICROSECOND',
'MICROSECONDS',
'MINUTE',
'MINUTES',
'MINVALUE',
'MODE',
'MODIFIES',
'MONTH',
'MONTHS',
'NAN',
'NEW',
'NEW_TABLE',
'NEXTVAL',
'NO',
'NOCACHE',
'NOCYCLE',
'NODENAME',
'NODENUMBER',
'NOMAXVALUE',
'NOMINVALUE',
'NONE',
'NOORDER',
'NORMALIZED',
'NOT',
'NULL',
'NULLS',
'NUMPARTS',
'OBID',
'OF',
'OLD',
'OLD_TABLE',
'ON',
'OPEN',
'OPTIMIZATION',
'OPTIMIZE',
'OPTION',
'OR',
'ORDER',
'OUT',
'OUTER',
'OVER',
'OVERRIDING',
'PACKAGE',
'PADDED',
'PAGESIZE',
'PARAMETER',
'PART',
'PARTITION',
'PARTITIONED',
'PARTITIONING',
'PARTITIONS',
'PASSWORD',
'PATH',
'PIECESIZE',
'PLAN',
'POSITION',
'PRECISION',
'PREPARE',
'PREVVAL',
'PRIMARY',
'PRIQTY',
'PRIVILEGES',
'PROCEDURE',
'PROGRAM',
'PSID',
'PUBLIC',
'QUERY',
'QUERYNO',
'RANGE',
'RANK',
'READ',
'READS',
'RECOVERY',
'REFERENCES',
'REFERENCING',
'REFRESH',
'RELEASE',
'RENAME',
'REPEAT',
'RESET',
'RESIGNAL',
'RESTART',
'RESTRICT',
'RESULT',
'RESULT_SET_LOCATOR WLM',
'RETURN',
'RETURNS',
'REVOKE',
'ROLE',
'ROLLBACK',
'ROUND_CEILING',
'ROUND_DOWN',
'ROUND_FLOOR',
'ROUND_HALF_DOWN',
'ROUND_HALF_EVEN',
'ROUND_HALF_UP',
'ROUND_UP',
'ROUTINE',
'ROW',
'ROW_NUMBER',
'ROWNUMBER',
'ROWS',
'ROWSET',
'RRN',
'RUN',
'SAVEPOINT',
'SCHEMA',
'SCRATCHPAD',
'SCROLL',
'SEARCH',
'SECOND',
'SECONDS',
'SECQTY',
'SECURITY',
'SELECT',
'SENSITIVE',
'SEQUENCE',
'SESSION',
'SESSION_USER',
'SET',
'SIGNAL',
'SIMPLE',
'SNAN',
'SOME',
'SOURCE',
'SPECIFIC',
'SQL',
'SQLID',
'STACKED',
'STANDARD',
'START',
'STARTING',
'STATEMENT',
'STATIC',
'STATMENT',
'STAY',
'STOGROUP',
'STORES',
'STYLE',
'SUBSTRING',
'SUMMARY',
'SYNONYM',
'SYSFUN',
'SYSIBM',
'SYSPROC',
'SYSTEM',
'SYSTEM_USER',
'TABLE',
'TABLESPACE',
'THEN',
'TIME',
'TIMESTAMP',
'TO',
'TRANSACTION',
'TRIGGER',
'TRIM',
'TRUNCATE',
'TYPE',
'UNDO',
'UNION',
'UNIQUE',
'UNTIL',
'UPDATE',
'USAGE',
'USER',
'USING',
'VALIDPROC',
'VALUE',
'VALUES',
'VARIABLE',
'VARIANT',
'VCAT',
'VERSION',
'VIEW',
'VOLATILE',
'VOLUMES',
'WHEN',
'WHENEVER',
'WHERE',
'WHILE',
'WITH',
'WITHOUT',
'WRITE',
'XMLELEMENT',
'XMLEXISTS',
'XMLNAMESPACES',
'YEAR',
'YEARS',
];
}
}

View file

@ -0,0 +1,56 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_flip;
use function array_map;
use function strtoupper;
/**
* Abstract interface for a SQL reserved keyword dictionary.
*
* @psalm-consistent-constructor
*/
abstract class KeywordList
{
/** @var string[]|null */
private ?array $keywords = null;
/**
* Checks if the given word is a keyword of this dialect/vendor platform.
*
* @param string $word
*
* @return bool
*/
public function isKeyword($word)
{
if ($this->keywords === null) {
$this->initializeKeywords();
}
return isset($this->keywords[strtoupper($word)]);
}
/** @return void */
protected function initializeKeywords()
{
$this->keywords = array_flip(array_map('strtoupper', $this->getKeywords()));
}
/**
* Returns the list of keywords.
*
* @return string[]
*/
abstract protected function getKeywords();
/**
* Returns the name of this keyword list.
*
* @deprecated
*
* @return string
*/
abstract public function getName();
}

View file

@ -0,0 +1,276 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
class MariaDBKeywords extends MySQLKeywords
{
/** @deprecated */
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MariaDBKeywords::getName() is deprecated.',
);
return 'MariaDB';
}
/**
* {@inheritDoc}
*/
protected function getKeywords(): array
{
return [
'ACCESSIBLE',
'ADD',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ASENSITIVE',
'BEFORE',
'BETWEEN',
'BIGINT',
'BINARY',
'BLOB',
'BOTH',
'BY',
'CALL',
'CASCADE',
'CASE',
'CHANGE',
'CHAR',
'CHARACTER',
'CHECK',
'COLLATE',
'COLUMN',
'CONDITION',
'CONSTRAINT',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DATABASES',
'DAY_HOUR',
'DAY_MICROSECOND',
'DAY_MINUTE',
'DAY_SECOND',
'DEC',
'DECIMAL',
'DECLARE',
'DEFAULT',
'DELAYED',
'DELETE',
'DESC',
'DESCRIBE',
'DETERMINISTIC',
'DISTINCT',
'DISTINCTROW',
'DIV',
'DOUBLE',
'DROP',
'DUAL',
'EACH',
'ELSE',
'ELSEIF',
'ENCLOSED',
'ESCAPED',
'EXCEPT',
'EXISTS',
'EXIT',
'EXPLAIN',
'FALSE',
'FETCH',
'FLOAT',
'FLOAT4',
'FLOAT8',
'FOR',
'FORCE',
'FOREIGN',
'FROM',
'FULLTEXT',
'GENERATED',
'GET',
'GENERAL',
'GRANT',
'GROUP',
'HAVING',
'HIGH_PRIORITY',
'HOUR_MICROSECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'IF',
'IGNORE',
'IGNORE_SERVER_IDS',
'IN',
'INDEX',
'INFILE',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INT',
'INT1',
'INT2',
'INT3',
'INT4',
'INT8',
'INTEGER',
'INTERSECT',
'INTERVAL',
'INTO',
'IO_AFTER_GTIDS',
'IO_BEFORE_GTIDS',
'IS',
'ITERATE',
'JOIN',
'KEY',
'KEYS',
'KILL',
'LEADING',
'LEAVE',
'LEFT',
'LIKE',
'LIMIT',
'LINEAR',
'LINES',
'LOAD',
'LOCALTIME',
'LOCALTIMESTAMP',
'LOCK',
'LONG',
'LONGBLOB',
'LONGTEXT',
'LOOP',
'LOW_PRIORITY',
'MASTER_BIND',
'MASTER_HEARTBEAT_PERIOD',
'MASTER_SSL_VERIFY_SERVER_CERT',
'MATCH',
'MAXVALUE',
'MEDIUMBLOB',
'MEDIUMINT',
'MEDIUMTEXT',
'MIDDLEINT',
'MINUTE_MICROSECOND',
'MINUTE_SECOND',
'MOD',
'MODIFIES',
'NATURAL',
'NO_WRITE_TO_BINLOG',
'NOT',
'NULL',
'NUMERIC',
'OFFSET',
'ON',
'OPTIMIZE',
'OPTIMIZER_COSTS',
'OPTION',
'OPTIONALLY',
'OR',
'ORDER',
'OUT',
'OUTER',
'OUTFILE',
'OVER',
'PARTITION',
'PRECISION',
'PRIMARY',
'PROCEDURE',
'PURGE',
'RANGE',
'READ',
'READ_WRITE',
'READS',
'REAL',
'RECURSIVE',
'REFERENCES',
'REGEXP',
'RELEASE',
'RENAME',
'REPEAT',
'REPLACE',
'REQUIRE',
'RESIGNAL',
'RESTRICT',
'RETURN',
'RETURNING',
'REVOKE',
'RIGHT',
'RLIKE',
'ROWS',
'SCHEMA',
'SCHEMAS',
'SECOND_MICROSECOND',
'SELECT',
'SENSITIVE',
'SEPARATOR',
'SET',
'SHOW',
'SIGNAL',
'SLOW',
'SMALLINT',
'SPATIAL',
'SPECIFIC',
'SQL',
'SQL_BIG_RESULT',
'SQL_CALC_FOUND_ROWS',
'SQL_SMALL_RESULT',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SSL',
'STARTING',
'STORED',
'STRAIGHT_JOIN',
'TABLE',
'TERMINATED',
'THEN',
'TINYBLOB',
'TINYINT',
'TINYTEXT',
'TO',
'TRAILING',
'TRIGGER',
'TRUE',
'UNDO',
'UNION',
'UNIQUE',
'UNLOCK',
'UNSIGNED',
'UPDATE',
'USAGE',
'USE',
'USING',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'VALUES',
'VARBINARY',
'VARCHAR',
'VARCHARACTER',
'VARYING',
'VIRTUAL',
'WHEN',
'WHERE',
'WHILE',
'WINDOW',
'WITH',
'WRITE',
'XOR',
'YEAR_MONTH',
'ZEROFILL',
];
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* MariaDb reserved keywords list.
*
* @deprecated Use {@link MariaDBKeywords} instead.
*
* @link https://mariadb.com/kb/en/the-mariadb-library/reserved-words/
*/
final class MariaDb102Keywords extends MariaDBKeywords
{
/** @deprecated */
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MariaDb102Keywords::getName() is deprecated.',
);
return 'MariaDb102';
}
}

View file

@ -0,0 +1,275 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* MySQL 5.7 reserved keywords list.
*
* @deprecated Use {@link MySQLKeywords} instead.
*/
class MySQL57Keywords extends MySQLKeywords
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQL57Keywords::getName() is deprecated.',
);
return 'MySQL57';
}
/**
* {@inheritDoc}
*
* @link http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-7.html
*/
protected function getKeywords()
{
return [
'ACCESSIBLE',
'ADD',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ASENSITIVE',
'BEFORE',
'BETWEEN',
'BIGINT',
'BINARY',
'BLOB',
'BOTH',
'BY',
'CALL',
'CASCADE',
'CASE',
'CHANGE',
'CHAR',
'CHARACTER',
'CHECK',
'COLLATE',
'COLUMN',
'CONDITION',
'CONSTRAINT',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DATABASES',
'DAY_HOUR',
'DAY_MICROSECOND',
'DAY_MINUTE',
'DAY_SECOND',
'DEC',
'DECIMAL',
'DECLARE',
'DEFAULT',
'DELAYED',
'DELETE',
'DESC',
'DESCRIBE',
'DETERMINISTIC',
'DISTINCT',
'DISTINCTROW',
'DIV',
'DOUBLE',
'DROP',
'DUAL',
'EACH',
'ELSE',
'ELSEIF',
'ENCLOSED',
'ESCAPED',
'EXISTS',
'EXIT',
'EXPLAIN',
'FALSE',
'FETCH',
'FLOAT',
'FLOAT4',
'FLOAT8',
'FOR',
'FORCE',
'FOREIGN',
'FROM',
'FULLTEXT',
'GENERATED',
'GET',
'GRANT',
'GROUP',
'HAVING',
'HIGH_PRIORITY',
'HOUR_MICROSECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'IF',
'IGNORE',
'IN',
'INDEX',
'INFILE',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INT',
'INT1',
'INT2',
'INT3',
'INT4',
'INT8',
'INTEGER',
'INTERVAL',
'INTO',
'IO_AFTER_GTIDS',
'IO_BEFORE_GTIDS',
'IS',
'ITERATE',
'JOIN',
'KEY',
'KEYS',
'KILL',
'LEADING',
'LEAVE',
'LEFT',
'LIKE',
'LIMIT',
'LINEAR',
'LINES',
'LOAD',
'LOCALTIME',
'LOCALTIMESTAMP',
'LOCK',
'LONG',
'LONGBLOB',
'LONGTEXT',
'LOOP',
'LOW_PRIORITY',
'MASTER_BIND',
'MASTER_SSL_VERIFY_SERVER_CERT',
'MATCH',
'MAXVALUE',
'MEDIUMBLOB',
'MEDIUMINT',
'MEDIUMTEXT',
'MIDDLEINT',
'MINUTE_MICROSECOND',
'MINUTE_SECOND',
'MOD',
'MODIFIES',
'NATURAL',
'NO_WRITE_TO_BINLOG',
'NOT',
'NULL',
'NUMERIC',
'ON',
'OPTIMIZE',
'OPTIMIZER_COSTS',
'OPTION',
'OPTIONALLY',
'OR',
'ORDER',
'OUT',
'OUTER',
'OUTFILE',
'PARTITION',
'PRECISION',
'PRIMARY',
'PROCEDURE',
'PURGE',
'RANGE',
'READ',
'READ_WRITE',
'READS',
'REAL',
'REFERENCES',
'REGEXP',
'RELEASE',
'RENAME',
'REPEAT',
'REPLACE',
'REQUIRE',
'RESIGNAL',
'RESTRICT',
'RETURN',
'REVOKE',
'RIGHT',
'RLIKE',
'SCHEMA',
'SCHEMAS',
'SECOND_MICROSECOND',
'SELECT',
'SENSITIVE',
'SEPARATOR',
'SET',
'SHOW',
'SIGNAL',
'SMALLINT',
'SPATIAL',
'SPECIFIC',
'SQL',
'SQL_BIG_RESULT',
'SQL_CALC_FOUND_ROWS',
'SQL_SMALL_RESULT',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SSL',
'STARTING',
'STORED',
'STRAIGHT_JOIN',
'TABLE',
'TERMINATED',
'THEN',
'TINYBLOB',
'TINYINT',
'TINYTEXT',
'TO',
'TRAILING',
'TRIGGER',
'TRUE',
'UNDO',
'UNION',
'UNIQUE',
'UNLOCK',
'UNSIGNED',
'UPDATE',
'USAGE',
'USE',
'USING',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'VALUES',
'VARBINARY',
'VARCHAR',
'VARCHARACTER',
'VARYING',
'VIRTUAL',
'WHEN',
'WHERE',
'WHILE',
'WITH',
'WRITE',
'XOR',
'YEAR_MONTH',
'ZEROFILL',
];
}
}

View file

@ -0,0 +1,75 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
use function array_merge;
/**
* MySQL 8.0 reserved keywords list.
*/
class MySQL80Keywords extends MySQL57Keywords
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQL80Keywords::getName() is deprecated.',
);
return 'MySQL80';
}
/**
* {@inheritDoc}
*
* @link https://dev.mysql.com/doc/refman/8.0/en/keywords.html
*/
protected function getKeywords()
{
$keywords = parent::getKeywords();
$keywords = array_merge($keywords, [
'ADMIN',
'ARRAY',
'CUBE',
'CUME_DIST',
'DENSE_RANK',
'EMPTY',
'EXCEPT',
'FIRST_VALUE',
'FUNCTION',
'GROUPING',
'GROUPS',
'JSON_TABLE',
'LAG',
'LAST_VALUE',
'LATERAL',
'LEAD',
'MEMBER',
'NTH_VALUE',
'NTILE',
'OF',
'OVER',
'PERCENT_RANK',
'PERSIST',
'PERSIST_ONLY',
'RANK',
'RECURSIVE',
'ROW',
'ROWS',
'ROW_NUMBER',
'SYSTEM',
'WINDOW',
]);
return $keywords;
}
}

View file

@ -0,0 +1,64 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
use function array_diff;
use function array_merge;
/**
* MySQL 8.4 reserved keywords list.
*/
class MySQL84Keywords extends MySQL80Keywords
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQL84Keywords::getName() is deprecated.',
);
return 'MySQL84';
}
/**
* {@inheritDoc}
*
* @link https://dev.mysql.com/doc/refman/8.4/en/keywords.html
*/
protected function getKeywords()
{
$keywords = parent::getKeywords();
// Removed Keywords and Reserved Words
$keywords = array_diff($keywords, [
'MASTER_BIND',
'MASTER_SSL_VERIFY_SERVER_CERT',
]);
// New Keywords and Reserved Words
$keywords = array_merge($keywords, [
'AUTO',
'BERNOULLI',
'GTIDS',
'LOG',
'MANUAL',
'PARALLEL',
'PARSE_TREE',
'QUALIFY',
'S3',
'TABLESAMPLE',
]);
return $keywords;
}
}

View file

@ -0,0 +1,275 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* MySQL Keywordlist.
*/
class MySQLKeywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'MySQLKeywords::getName() is deprecated.',
);
return 'MySQL';
}
/**
* {@inheritDoc}
*/
protected function getKeywords()
{
return [
'ACCESSIBLE',
'ADD',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ASENSITIVE',
'BEFORE',
'BETWEEN',
'BIGINT',
'BINARY',
'BLOB',
'BOTH',
'BY',
'CALL',
'CASCADE',
'CASE',
'CHANGE',
'CHAR',
'CHARACTER',
'CHECK',
'COLLATE',
'COLUMN',
'CONDITION',
'CONNECTION',
'CONSTRAINT',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DATABASES',
'DAY_HOUR',
'DAY_MICROSECOND',
'DAY_MINUTE',
'DAY_SECOND',
'DEC',
'DECIMAL',
'DECLARE',
'DEFAULT',
'DELAYED',
'DELETE',
'DESC',
'DESCRIBE',
'DETERMINISTIC',
'DISTINCT',
'DISTINCTROW',
'DIV',
'DOUBLE',
'DROP',
'DUAL',
'EACH',
'ELSE',
'ELSEIF',
'ENCLOSED',
'ESCAPED',
'EXISTS',
'EXIT',
'EXPLAIN',
'FALSE',
'FETCH',
'FLOAT',
'FLOAT4',
'FLOAT8',
'FOR',
'FORCE',
'FOREIGN',
'FROM',
'FULLTEXT',
'GENERAL',
'GOTO',
'GRANT',
'GROUP',
'HAVING',
'HIGH_PRIORITY',
'HOUR_MICROSECOND',
'HOUR_MINUTE',
'HOUR_SECOND',
'IF',
'IGNORE',
'IGNORE_SERVER_IDS',
'IN',
'INDEX',
'INFILE',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INT',
'INT1',
'INT2',
'INT3',
'INT4',
'INT8',
'INTEGER',
'INTERVAL',
'INTO',
'IS',
'ITERATE',
'JOIN',
'KEY',
'KEYS',
'KILL',
'LABEL',
'LEADING',
'LEAVE',
'LEFT',
'LIKE',
'LIMIT',
'LINEAR',
'LINES',
'LOAD',
'LOCALTIME',
'LOCALTIMESTAMP',
'LOCK',
'LONG',
'LONGBLOB',
'LONGTEXT',
'LOOP',
'LOW_PRIORITY',
'MASTER_HEARTBEAT_PERIOD',
'MASTER_SSL_VERIFY_SERVER_CERT',
'MATCH',
'MAXVALUE',
'MEDIUMBLOB',
'MEDIUMINT',
'MEDIUMTEXT',
'MIDDLEINT',
'MINUTE_MICROSECOND',
'MINUTE_SECOND',
'MOD',
'MODIFIES',
'NATURAL',
'NO_WRITE_TO_BINLOG',
'NOT',
'NULL',
'NUMERIC',
'ON',
'OPTIMIZE',
'OPTION',
'OPTIONALLY',
'OR',
'ORDER',
'OUT',
'OUTER',
'OUTFILE',
'PARTITION',
'PRECISION',
'PRIMARY',
'PROCEDURE',
'PURGE',
'RAID0',
'RANGE',
'READ',
'READ_WRITE',
'READS',
'REAL',
'RECURSIVE',
'REFERENCES',
'REGEXP',
'RELEASE',
'RENAME',
'REPEAT',
'REPLACE',
'REQUIRE',
'RESIGNAL',
'RESTRICT',
'RETURN',
'REVOKE',
'RIGHT',
'RLIKE',
'ROWS',
'SCHEMA',
'SCHEMAS',
'SECOND_MICROSECOND',
'SELECT',
'SENSITIVE',
'SEPARATOR',
'SET',
'SHOW',
'SIGNAL',
'SLOW',
'SMALLINT',
'SONAME',
'SPATIAL',
'SPECIFIC',
'SQL',
'SQL_BIG_RESULT',
'SQL_CALC_FOUND_ROWS',
'SQL_SMALL_RESULT',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SSL',
'STARTING',
'STRAIGHT_JOIN',
'TABLE',
'TERMINATED',
'THEN',
'TINYBLOB',
'TINYINT',
'TINYTEXT',
'TO',
'TRAILING',
'TRIGGER',
'TRUE',
'UNDO',
'UNION',
'UNIQUE',
'UNLOCK',
'UNSIGNED',
'UPDATE',
'USAGE',
'USE',
'USING',
'UTC_DATE',
'UTC_TIME',
'UTC_TIMESTAMP',
'VALUES',
'VARBINARY',
'VARCHAR',
'VARCHARACTER',
'VARYING',
'WHEN',
'WHERE',
'WHILE',
'WITH',
'WRITE',
'X509',
'XOR',
'YEAR_MONTH',
'ZEROFILL',
];
}
}

View file

@ -0,0 +1,149 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* Oracle Keywordlist.
*/
class OracleKeywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'OracleKeywords::getName() is deprecated.',
);
return 'Oracle';
}
/**
* {@inheritDoc}
*/
protected function getKeywords()
{
return [
'ACCESS',
'ADD',
'ALL',
'ALTER',
'AND',
'ANY',
'ARRAYLEN',
'AS',
'ASC',
'AUDIT',
'BETWEEN',
'BY',
'CHAR',
'CHECK',
'CLUSTER',
'COLUMN',
'COMMENT',
'COMPRESS',
'CONNECT',
'CREATE',
'CURRENT',
'DATE',
'DECIMAL',
'DEFAULT',
'DELETE',
'DESC',
'DISTINCT',
'DROP',
'ELSE',
'EXCLUSIVE',
'EXISTS',
'FILE',
'FLOAT',
'FOR',
'FROM',
'GRANT',
'GROUP',
'HAVING',
'IDENTIFIED',
'IMMEDIATE',
'IN',
'INCREMENT',
'INDEX',
'INITIAL',
'INSERT',
'INTEGER',
'INTERSECT',
'INTO',
'IS',
'LEVEL',
'LIKE',
'LOCK',
'LONG',
'MAXEXTENTS',
'MINUS',
'MODE',
'MODIFY',
'NOAUDIT',
'NOCOMPRESS',
'NOT',
'NOTFOUND',
'NOWAIT',
'NULL',
'NUMBER',
'OF',
'OFFLINE',
'ON',
'ONLINE',
'OPTION',
'OR',
'ORDER',
'PCTFREE',
'PRIOR',
'PRIVILEGES',
'PUBLIC',
'RANGE',
'RAW',
'RENAME',
'RESOURCE',
'REVOKE',
'ROW',
'ROWID',
'ROWLABEL',
'ROWNUM',
'ROWS',
'SELECT',
'SESSION',
'SET',
'SHARE',
'SIZE',
'SMALLINT',
'SQLBUF',
'START',
'SUCCESSFUL',
'SYNONYM',
'SYSDATE',
'TABLE',
'THEN',
'TO',
'TRIGGER',
'UID',
'UNION',
'UNIQUE',
'UPDATE',
'USER',
'VALIDATE',
'VALUES',
'VARCHAR',
'VARCHAR2',
'VIEW',
'WHENEVER',
'WHERE',
'WITH',
];
}
}

View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* PostgreSQL 10.0 reserved keywords list.
*
* @deprecated Use {@link PostgreSQLKeywords} instead.
*/
class PostgreSQL100Keywords extends PostgreSQL94Keywords
{
/** @deprecated */
public function getName(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'PostgreSQL100Keywords::getName() is deprecated.',
);
return 'PostgreSQL100';
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL 9.4 reserved keywords list.
*
* @deprecated Use {@see PostgreSQLKeywords} instead.
*/
class PostgreSQL94Keywords extends PostgreSQLKeywords
{
}

View file

@ -0,0 +1,135 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* Reserved keywords list corresponding to the PostgreSQL database platform of the oldest supported version.
*/
class PostgreSQLKeywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'PostgreSQLKeywords::getName() is deprecated.',
);
return 'PostgreSQL';
}
/**
* {@inheritDoc}
*/
protected function getKeywords()
{
return [
'ALL',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BINARY',
'BOTH',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLLATION',
'COLUMN',
'CONCURRENTLY',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_CATALOG',
'CURRENT_DATE',
'CURRENT_ROLE',
'CURRENT_SCHEMA',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'DEFAULT',
'DEFERRABLE',
'DESC',
'DISTINCT',
'DO',
'ELSE',
'END',
'EXCEPT',
'FALSE',
'FETCH',
'FOR',
'FOREIGN',
'FREEZE',
'FROM',
'FULL',
'GRANT',
'GROUP',
'HAVING',
'ILIKE',
'IN',
'INITIALLY',
'INNER',
'INTERSECT',
'INTO',
'IS',
'ISNULL',
'JOIN',
'LATERAL',
'LEADING',
'LEFT',
'LIKE',
'LIMIT',
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NOT',
'NOTNULL',
'NULL',
'OFFSET',
'ON',
'ONLY',
'OR',
'ORDER',
'OUTER',
'OVERLAPS',
'PLACING',
'PRIMARY',
'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT',
'SESSION_USER',
'SIMILAR',
'SOME',
'SYMMETRIC',
'TABLE',
'THEN',
'TO',
'TRAILING',
'TRUE',
'UNION',
'UNIQUE',
'USER',
'USING',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WINDOW',
'WITH',
];
}
}

View file

@ -0,0 +1,130 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\Visitor\Visitor;
use Doctrine\Deprecations\Deprecation;
use function count;
use function implode;
use function str_replace;
/** @deprecated Use database documentation instead. */
class ReservedKeywordsValidator implements Visitor
{
/** @var KeywordList[] */
private array $keywordLists;
/** @var string[] */
private array $violations = [];
/** @param KeywordList[] $keywordLists */
public function __construct(array $keywordLists)
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5431',
'ReservedKeywordsValidator is deprecated. Use database documentation instead.',
);
$this->keywordLists = $keywordLists;
}
/** @return string[] */
public function getViolations()
{
return $this->violations;
}
/**
* @param string $word
*
* @return string[]
*/
private function isReservedWord($word): array
{
if ($word[0] === '`') {
$word = str_replace('`', '', $word);
}
$keywordLists = [];
foreach ($this->keywordLists as $keywordList) {
if (! $keywordList->isKeyword($word)) {
continue;
}
$keywordLists[] = $keywordList->getName();
}
return $keywordLists;
}
/**
* @param string $asset
* @param string[] $violatedPlatforms
*/
private function addViolation($asset, $violatedPlatforms): void
{
if (count($violatedPlatforms) === 0) {
return;
}
$this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
}
/**
* {@inheritDoc}
*/
public function acceptColumn(Table $table, Column $column)
{
$this->addViolation(
'Table ' . $table->getName() . ' column ' . $column->getName(),
$this->isReservedWord($column->getName()),
);
}
/**
* {@inheritDoc}
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
}
/**
* {@inheritDoc}
*/
public function acceptIndex(Table $table, Index $index)
{
}
/**
* {@inheritDoc}
*/
public function acceptSchema(Schema $schema)
{
}
/**
* {@inheritDoc}
*/
public function acceptSequence(Sequence $sequence)
{
}
/**
* {@inheritDoc}
*/
public function acceptTable(Table $table)
{
$this->addViolation(
'Table ' . $table->getName(),
$this->isReservedWord($table->getName()),
);
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* Microsoft SQL Server 2012 reserved keyword dictionary.
*
* @deprecated Use {@see SQLServerKeywords} instead.
*/
class SQLServer2012Keywords extends SQLServerKeywords
{
}

View file

@ -0,0 +1,224 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* Microsoft SQL Server 2012 reserved keyword dictionary.
* Reserved keywords list corresponding to the Microsoft SQL Server database platform of the oldest supported version.
*/
class SQLServerKeywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'SQLServerKeywords::getName() is deprecated.',
);
return 'SQLServer';
}
/**
* {@inheritDoc}
*
* @link http://msdn.microsoft.com/en-us/library/aa238507%28v=sql.80%29.aspx
*/
protected function getKeywords()
{
return [
'ADD',
'ALL',
'ALTER',
'AND',
'ANY',
'AS',
'ASC',
'AUTHORIZATION',
'BACKUP',
'BEGIN',
'BETWEEN',
'BREAK',
'BROWSE',
'BULK',
'BY',
'CASCADE',
'CASE',
'CHECK',
'CHECKPOINT',
'CLOSE',
'CLUSTERED',
'COALESCE',
'COLLATE',
'COLUMN',
'COMMIT',
'COMPUTE',
'CONSTRAINT',
'CONTAINS',
'CONTAINSTABLE',
'CONTINUE',
'CONVERT',
'CREATE',
'CROSS',
'CURRENT',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_USER',
'CURSOR',
'DATABASE',
'DBCC',
'DEALLOCATE',
'DECLARE',
'DEFAULT',
'DELETE',
'DENY',
'DESC',
'DISK',
'DISTINCT',
'DISTRIBUTED',
'DOUBLE',
'DROP',
'DUMP',
'ELSE',
'END',
'ERRLVL',
'ESCAPE',
'EXCEPT',
'EXEC',
'EXECUTE',
'EXISTS',
'EXIT',
'EXTERNAL',
'FETCH',
'FILE',
'FILLFACTOR',
'FOR',
'FOREIGN',
'FREETEXT',
'FREETEXTTABLE',
'FROM',
'FULL',
'FUNCTION',
'GOTO',
'GRANT',
'GROUP',
'HAVING',
'HOLDLOCK',
'IDENTITY',
'IDENTITY_INSERT',
'IDENTITYCOL',
'IF',
'IN',
'INDEX',
'INNER',
'INSERT',
'INTERSECT',
'INTO',
'IS',
'JOIN',
'KEY',
'KILL',
'LEFT',
'LIKE',
'LINENO',
'LOAD',
'MERGE',
'NATIONAL',
'NOCHECK ',
'NONCLUSTERED',
'NOT',
'NULL',
'NULLIF',
'OF',
'OFF',
'OFFSETS',
'ON',
'OPEN',
'OPENDATASOURCE',
'OPENQUERY',
'OPENROWSET',
'OPENXML',
'OPTION',
'OR',
'ORDER',
'OUTER',
'OVER',
'PERCENT',
'PIVOT',
'PLAN',
'PRECISION',
'PRIMARY',
'PRINT',
'PROC',
'PROCEDURE',
'PUBLIC',
'RAISERROR',
'READ',
'READTEXT',
'RECONFIGURE',
'REFERENCES',
'REPLICATION',
'RESTORE',
'RESTRICT',
'RETURN',
'REVERT',
'REVOKE',
'RIGHT',
'ROLLBACK',
'ROWCOUNT',
'ROWGUIDCOL',
'RULE',
'SAVE',
'SCHEMA',
'SECURITYAUDIT',
'SELECT',
'SEMANTICKEYPHRASETABLE',
'SEMANTICSIMILARITYDETAILSTABLE',
'SEMANTICSIMILARITYTABLE',
'SESSION_USER',
'SET',
'SETUSER',
'SHUTDOWN',
'SOME',
'STATISTICS',
'SYSTEM_USER',
'TABLE',
'TABLESAMPLE',
'TEXTSIZE',
'THEN',
'TO',
'TOP',
'TRAN',
'TRANSACTION',
'TRIGGER',
'TRUNCATE',
'TRY_CONVERT',
'TSEQUAL',
'UNION',
'UNIQUE',
'UNPIVOT',
'UPDATE',
'UPDATETEXT',
'USE',
'USER',
'VALUES',
'VARYING',
'VIEW',
'WAITFOR',
'WHEN',
'WHERE',
'WHILE',
'WITH',
'WITHIN GROUP',
'WRITETEXT',
];
}
}

View file

@ -0,0 +1,157 @@
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use Doctrine\Deprecations\Deprecation;
/**
* SQLite Keywordlist.
*/
class SQLiteKeywords extends KeywordList
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function getName()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5433',
'SQLiteKeywords::getName() is deprecated.',
);
return 'SQLite';
}
/**
* {@inheritDoc}
*/
protected function getKeywords()
{
return [
'ABORT',
'ACTION',
'ADD',
'AFTER',
'ALL',
'ALTER',
'ANALYZE',
'AND',
'AS',
'ASC',
'ATTACH',
'AUTOINCREMENT',
'BEFORE',
'BEGIN',
'BETWEEN',
'BY',
'CASCADE',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'COLUMN',
'COMMIT',
'CONFLICT',
'CONSTRAINT',
'CREATE',
'CROSS',
'CURRENT_DATE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'DATABASE',
'DEFAULT',
'DEFERRABLE',
'DEFERRED',
'DELETE',
'DESC',
'DETACH',
'DISTINCT',
'DROP',
'EACH',
'ELSE',
'END',
'ESCAPE',
'EXCEPT',
'EXCLUSIVE',
'EXISTS',
'EXPLAIN',
'FAIL',
'FOR',
'FOREIGN',
'FROM',
'FULL',
'GLOB',
'GROUP',
'HAVING',
'IF',
'IGNORE',
'IMMEDIATE',
'IN',
'INDEX',
'INDEXED',
'INITIALLY',
'INNER',
'INSERT',
'INSTEAD',
'INTERSECT',
'INTO',
'IS',
'ISNULL',
'JOIN',
'KEY',
'LEFT',
'LIKE',
'LIMIT',
'MATCH',
'NATURAL',
'NO',
'NOT',
'NOTNULL',
'NULL',
'OF',
'OFFSET',
'ON',
'OR',
'ORDER',
'OUTER',
'PLAN',
'PRAGMA',
'PRIMARY',
'QUERY',
'RAISE',
'REFERENCES',
'REGEXP',
'REINDEX',
'RELEASE',
'RENAME',
'REPLACE',
'RESTRICT',
'RIGHT',
'ROLLBACK',
'ROW',
'SAVEPOINT',
'SELECT',
'SET',
'TABLE',
'TEMP',
'TEMPORARY',
'THEN',
'TO',
'TRANSACTION',
'TRIGGER',
'UNION',
'UNIQUE',
'UPDATE',
'USING',
'VACUUM',
'VALUES',
'VIEW',
'VIRTUAL',
'WHEN',
'WHERE',
];
}
}

View file

@ -0,0 +1,55 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Types;
use Doctrine\Deprecations\Deprecation;
/**
* Provides the behavior, features and SQL dialect of the MariaDB database platform of the oldest supported version.
*/
class MariaDBPlatform extends MySQLPlatform
{
/**
* {@inheritDoc}
*
* Hop over the {@see AbstractMySQLPlatform} implementation until 4.0.x
* where {@see MariaDBPlatform} no longer extends {@see MySQLPlatform}.
*
* @internal The method should be only used from within the {@see AbstractPlatform} class hierarchy.
*/
public function getDefaultValueDeclarationSQL($column)
{
return AbstractPlatform::getDefaultValueDeclarationSQL($column);
}
/**
* {@inheritDoc}
*
* @link https://mariadb.com/kb/en/library/json-data-type/
*/
public function getJsonTypeDeclarationSQL(array $column): string
{
return 'LONGTEXT';
}
/** @deprecated Implement {@see createReservedKeywordsList()} instead. */
protected function getReservedKeywordsClass(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4510',
'MariaDb1027Platform::getReservedKeywordsClass() is deprecated,'
. ' use MariaDb1027Platform::createReservedKeywordsList() instead.',
);
return Keywords\MariaDb102Keywords::class;
}
protected function initializeDoctrineTypeMappings(): void
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = Types::JSON;
}
}

View file

@ -0,0 +1,47 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\SQL\Builder\SelectSQLBuilder;
use function implode;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.10 database platform.
*/
class MariaDb1010Platform extends MariaDb1060Platform
{
public function createSelectSQLBuilder(): SelectSQLBuilder
{
return AbstractPlatform::createSelectSQLBuilder();
}
public function fetchTableOptionsByTable(bool $includeTableName): string
{
// MariaDB-10.10.1 added FULL_COLLATION_NAME to the information_schema.COLLATION_CHARACTER_SET_APPLICABILITY.
// A base collation like uca1400_ai_ci can refer to multiple character sets. The value in the
// information_schema.TABLES.TABLE_COLLATION corresponds to the full collation name.
$sql = <<<'SQL'
SELECT t.TABLE_NAME,
t.ENGINE,
t.AUTO_INCREMENT,
t.TABLE_COMMENT,
t.CREATE_OPTIONS,
t.TABLE_COLLATION,
ccsa.CHARACTER_SET_NAME
FROM information_schema.TABLES t
INNER JOIN information_schema.COLLATION_CHARACTER_SET_APPLICABILITY ccsa
ON ccsa.FULL_COLLATION_NAME = t.TABLE_COLLATION
SQL;
$conditions = ['t.TABLE_SCHEMA = ?'];
if ($includeTableName) {
$conditions[] = 't.TABLE_NAME = ?';
}
$conditions[] = "t.TABLE_TYPE = 'BASE TABLE'";
return $sql . ' WHERE ' . implode(' AND ', $conditions);
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace Doctrine\DBAL\Platforms;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.2 database platform.
*
* @deprecated This class will be merged with {@see MariaDBPlatform} in 4.0 because support for MariaDB
* releases prior to 10.4.3 will be dropped.
*/
class MariaDb1027Platform extends MariaDBPlatform
{
}

View file

@ -0,0 +1,131 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\JsonType;
use Doctrine\Deprecations\Deprecation;
use function sprintf;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.4 database platform.
*
* Extend deprecated MariaDb1027Platform to ensure correct functions used in MySQLSchemaManager which
* tests for MariaDb1027Platform not MariaDBPlatform.
*
* @deprecated This class will be merged with {@see MariaDBPlatform} in 4.0 because support for MariaDB
* releases prior to 10.4.3 will be dropped.
*/
class MariaDb1043Platform extends MariaDb1027Platform
{
/**
* Use JSON rather than LONGTEXT for json columns. Since it is not a true native type, do not override
* hasNativeJsonType() so the DC2Type comment will still be set.
*
* {@inheritDoc}
*/
public function getJsonTypeDeclarationSQL(array $column): string
{
return 'JSON';
}
/**
* {@inheritDoc}
*
* From version 10.4.3, MariaDb aliases JSON to LONGTEXT and adds a constraint CHECK (json_valid). Reverse
* this process when introspecting tables.
*
* @see https://mariadb.com/kb/en/information-schema-check_constraints-table/
* @see https://mariadb.com/kb/en/json-data-type/
* @see https://jira.mariadb.org/browse/MDEV-13916
*/
public function getListTableColumnsSQL($table, $database = null): string
{
// @todo 4.0 - call getColumnTypeSQLSnippet() instead
[$columnTypeSQL, $joinCheckConstraintSQL] = $this->getColumnTypeSQLSnippets('c', $database);
return sprintf(
<<<SQL
SELECT c.COLUMN_NAME AS Field,
$columnTypeSQL AS Type,
c.IS_NULLABLE AS `Null`,
c.COLUMN_KEY AS `Key`,
c.COLUMN_DEFAULT AS `Default`,
c.EXTRA AS Extra,
c.COLUMN_COMMENT AS Comment,
c.CHARACTER_SET_NAME AS CharacterSet,
c.COLLATION_NAME AS Collation
FROM information_schema.COLUMNS c
$joinCheckConstraintSQL
WHERE c.TABLE_SCHEMA = %s
AND c.TABLE_NAME = %s
ORDER BY ORDINAL_POSITION ASC;
SQL
,
$this->getDatabaseNameSQL($database),
$this->quoteStringLiteral($table),
);
}
/**
* Generate SQL snippets to reverse the aliasing of JSON to LONGTEXT.
*
* MariaDb aliases columns specified as JSON to LONGTEXT and sets a CHECK constraint to ensure the column
* is valid json. This function generates the SQL snippets which reverse this aliasing i.e. report a column
* as JSON where it was originally specified as such instead of LONGTEXT.
*
* The CHECK constraints are stored in information_schema.CHECK_CONSTRAINTS so query that table.
*/
public function getColumnTypeSQLSnippet(string $tableAlias = 'c', ?string $databaseName = null): string
{
if ($this->getJsonTypeDeclarationSQL([]) !== 'JSON') {
return parent::getColumnTypeSQLSnippet($tableAlias, $databaseName);
}
if ($databaseName === null) {
Deprecation::trigger(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/6215',
'Not passing a database name to methods "getColumnTypeSQLSnippet()", '
. '"getColumnTypeSQLSnippets()", and "getListTableColumnsSQL()" of "%s" is deprecated.',
self::class,
);
}
$subQueryAlias = 'i_' . $tableAlias;
$databaseName = $this->getDatabaseNameSQL($databaseName);
// The check for `CONSTRAINT_SCHEMA = $databaseName` is mandatory here to prevent performance issues
return <<<SQL
IF(
$tableAlias.COLUMN_TYPE = 'longtext'
AND EXISTS(
SELECT * from information_schema.CHECK_CONSTRAINTS $subQueryAlias
WHERE $subQueryAlias.CONSTRAINT_SCHEMA = $databaseName
AND $subQueryAlias.TABLE_NAME = $tableAlias.TABLE_NAME
AND $subQueryAlias.CHECK_CLAUSE = CONCAT(
'json_valid(`',
$tableAlias.COLUMN_NAME,
'`)'
)
),
'json',
$tableAlias.COLUMN_TYPE
)
SQL;
}
/** {@inheritDoc} */
public function getColumnDeclarationSQL($name, array $column)
{
// MariaDb forces column collation to utf8mb4_bin where the column was declared as JSON so ignore
// collation and character set for json columns as attempting to set them can cause an error.
if ($this->getJsonTypeDeclarationSQL([]) === 'JSON' && ($column['type'] ?? null) instanceof JsonType) {
unset($column['collation']);
unset($column['charset']);
}
return parent::getColumnDeclarationSQL($name, $column);
}
}

View file

@ -0,0 +1,36 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.5 database platform.
*/
class MariaDb1052Platform extends MariaDb1043Platform
{
/**
* {@inheritDoc}
*/
protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{
return [];
}
/**
* {@inheritDoc}
*/
protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{
return [];
}
/**
* {@inheritDoc}
*/
protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
{
return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)];
}
}

View file

@ -0,0 +1,16 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\SQL\Builder\SelectSQLBuilder;
/**
* Provides the behavior, features and SQL dialect of the MariaDB 10.6 database platform.
*/
class MariaDb1060Platform extends MariaDb1052Platform
{
public function createSelectSQLBuilder(): SelectSQLBuilder
{
return AbstractPlatform::createSelectSQLBuilder();
}
}

View file

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\MySQL;
/** @internal */
interface CollationMetadataProvider
{
public function getCollationCharset(string $collation): ?string;
}

View file

@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
use function array_key_exists;
/** @internal */
final class CachingCollationMetadataProvider implements CollationMetadataProvider
{
/** @var CollationMetadataProvider */
private $collationMetadataProvider;
/** @var array<string,?string> */
private $cache = [];
public function __construct(CollationMetadataProvider $collationMetadataProvider)
{
$this->collationMetadataProvider = $collationMetadataProvider;
}
public function getCollationCharset(string $collation): ?string
{
if (array_key_exists($collation, $this->cache)) {
return $this->cache[$collation];
}
return $this->cache[$collation] = $this->collationMetadataProvider->getCollationCharset($collation);
}
}

View file

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\MySQL\CollationMetadataProvider;
/** @internal */
final class ConnectionCollationMetadataProvider implements CollationMetadataProvider
{
/** @var Connection */
private $connection;
public function __construct(Connection $connection)
{
$this->connection = $connection;
}
/** @throws Exception */
public function getCollationCharset(string $collation): ?string
{
$charset = $this->connection->fetchOne(
<<<'SQL'
SELECT CHARACTER_SET_NAME
FROM information_schema.COLLATIONS
WHERE COLLATION_NAME = ?;
SQL
,
[$collation],
);
if ($charset !== false) {
return $charset;
}
return null;
}
}

View file

@ -0,0 +1,94 @@
<?php
namespace Doctrine\DBAL\Platforms\MySQL;
use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Schema\Comparator as BaseComparator;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use function array_diff_assoc;
use function array_intersect_key;
/**
* Compares schemas in the context of MySQL platform.
*
* In MySQL, unless specified explicitly, the column's character set and collation are inherited from its containing
* table. So during comparison, an omitted value and the value that matches the default value of table in the
* desired schema must be considered equal.
*/
class Comparator extends BaseComparator
{
/** @var CollationMetadataProvider */
private $collationMetadataProvider;
/** @internal The comparator can be only instantiated by a schema manager. */
public function __construct(AbstractMySQLPlatform $platform, CollationMetadataProvider $collationMetadataProvider)
{
parent::__construct($platform);
$this->collationMetadataProvider = $collationMetadataProvider;
}
public function compareTables(Table $fromTable, Table $toTable): TableDiff
{
return parent::compareTables(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
/**
* {@inheritDoc}
*/
public function diffTable(Table $fromTable, Table $toTable)
{
return parent::diffTable(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
private function normalizeColumns(Table $table): Table
{
$tableOptions = array_intersect_key($table->getOptions(), [
'charset' => null,
'collation' => null,
]);
$table = clone $table;
foreach ($table->getColumns() as $column) {
$originalOptions = $column->getPlatformOptions();
$normalizedOptions = $this->normalizeOptions($originalOptions);
$overrideOptions = array_diff_assoc($normalizedOptions, $tableOptions);
if ($overrideOptions === $originalOptions) {
continue;
}
$column->setPlatformOptions($overrideOptions);
}
return $table;
}
/**
* @param array<string,string> $options
*
* @return array<string,string>
*/
private function normalizeOptions(array $options): array
{
if (isset($options['collation']) && ! isset($options['charset'])) {
$charset = $this->collationMetadataProvider->getCollationCharset($options['collation']);
if ($charset !== null) {
$options['charset'] = $charset;
}
}
return $options;
}
}

View file

@ -0,0 +1,99 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\TableDiff;
use Doctrine\DBAL\SQL\Parser;
use Doctrine\DBAL\Types\Types;
use Doctrine\Deprecations\Deprecation;
/**
* Provides the behavior, features and SQL dialect of the MySQL 5.7 database platform.
*
* @deprecated This class will be merged with {@see MySQLPlatform} in 4.0 because support for MySQL
* releases prior to 5.7 will be dropped.
*/
class MySQL57Platform extends MySQLPlatform
{
/**
* {@inheritDoc}
*
* @deprecated
*/
public function hasNativeJsonType()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/pull/5509',
'%s is deprecated.',
__METHOD__,
);
return true;
}
/**
* {@inheritDoc}
*/
public function getJsonTypeDeclarationSQL(array $column)
{
return 'JSON';
}
public function createSQLParser(): Parser
{
return new Parser(true);
}
/**
* {@inheritDoc}
*/
protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{
return [];
}
/**
* {@inheritDoc}
*/
protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
{
return [];
}
/**
* {@inheritDoc}
*/
protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
{
return ['ALTER TABLE ' . $tableName . ' RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)];
}
/**
* {@inheritDoc}
*
* @deprecated Implement {@see createReservedKeywordsList()} instead.
*/
protected function getReservedKeywordsClass()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4510',
'MySQL57Platform::getReservedKeywordsClass() is deprecated,'
. ' use MySQL57Platform::createReservedKeywordsList() instead.',
);
return Keywords\MySQL57Keywords::class;
}
/**
* {@inheritDoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = Types::JSON;
}
}

View file

@ -0,0 +1,34 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\SQL\Builder\SelectSQLBuilder;
use Doctrine\Deprecations\Deprecation;
/**
* Provides the behavior, features and SQL dialect of the MySQL 8.0 database platform.
*/
class MySQL80Platform extends MySQL57Platform
{
/**
* {@inheritDoc}
*
* @deprecated Implement {@see createReservedKeywordsList()} instead.
*/
protected function getReservedKeywordsClass()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4510',
'MySQL80Platform::getReservedKeywordsClass() is deprecated,'
. ' use MySQL80Platform::createReservedKeywordsList() instead.',
);
return Keywords\MySQL80Keywords::class;
}
public function createSelectSQLBuilder(): SelectSQLBuilder
{
return AbstractPlatform::createSelectSQLBuilder();
}
}

View file

@ -0,0 +1,28 @@
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\Deprecations\Deprecation;
/**
* Provides the behavior, features and SQL dialect of the MySQL 8.4 database platform.
*/
class MySQL84Platform extends MySQL80Platform
{
/**
* {@inheritDoc}
*
* @deprecated Implement {@see createReservedKeywordsList()} instead.
*/
protected function getReservedKeywordsClass()
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4510',
'MySQL84Platform::getReservedKeywordsClass() is deprecated,'
. ' use MySQL84Platform::createReservedKeywordsList() instead.',
);
return Keywords\MySQL84Keywords::class;
}
}

View file

@ -0,0 +1,11 @@
<?php
namespace Doctrine\DBAL\Platforms;
/**
* Provides the behavior, features and SQL dialect of the Oracle MySQL database platform
* of the oldest supported version.
*/
class MySQLPlatform extends AbstractMySQLPlatform
{
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
use Doctrine\DBAL\SQL\Builder\SelectSQLBuilder;
use Doctrine\Deprecations\Deprecation;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform.
*
* @deprecated This class will be merged with {@see PostgreSQLPlatform} in 4.0 because support for Postgres
* releases prior to 10.0 will be dropped.
*/
class PostgreSQL100Platform extends PostgreSQL94Platform
{
/** @deprecated Implement {@see createReservedKeywordsList()} instead. */
protected function getReservedKeywordsClass(): string
{
Deprecation::triggerIfCalledFromOutside(
'doctrine/dbal',
'https://github.com/doctrine/dbal/issues/4510',
'PostgreSQL100Platform::getReservedKeywordsClass() is deprecated,'
. ' use PostgreSQL100Platform::createReservedKeywordsList() instead.',
);
return PostgreSQL100Keywords::class;
}
public function createSelectSQLBuilder(): SelectSQLBuilder
{
return AbstractPlatform::createSelectSQLBuilder();
}
}

View file

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 12.0 database platform.
*/
class PostgreSQL120Platform extends PostgreSQL100Platform
{
public function getDefaultColumnValueSQLSnippet(): string
{
// in case of GENERATED ALWAYS AS (foobar) STORED column (added in PostgreSQL 12.0)
// PostgreSQL's pg_get_expr(adbin, adrelid) will return the 'foobar' part
// which is not the 'default' value of the column but its 'definition'
// so in that case we force it to NULL as DBAL will use that column only for the
// 'default' value
return <<<'SQL'
SELECT
CASE
WHEN a.attgenerated = 's' THEN NULL
ELSE pg_get_expr(adbin, adrelid)
END
FROM pg_attrdef
WHERE c.oid = pg_attrdef.adrelid
AND pg_attrdef.adnum=a.attnum
SQL;
}
}

View file

@ -0,0 +1,12 @@
<?php
namespace Doctrine\DBAL\Platforms;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
*
* @deprecated Use {@see PostgreSQLPlatform} instead.
*/
class PostgreSQL94Platform extends PostgreSQLPlatform
{
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,63 @@
<?php
namespace Doctrine\DBAL\Platforms\SQLServer;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\Comparator as BaseComparator;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
/**
* Compares schemas in the context of SQL Server platform.
*
* @link https://docs.microsoft.com/en-us/sql/t-sql/statements/collations?view=sql-server-ver15
*/
class Comparator extends BaseComparator
{
private string $databaseCollation;
/** @internal The comparator can be only instantiated by a schema manager. */
public function __construct(SQLServerPlatform $platform, string $databaseCollation)
{
parent::__construct($platform);
$this->databaseCollation = $databaseCollation;
}
public function compareTables(Table $fromTable, Table $toTable): TableDiff
{
return parent::compareTables(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
/**
* {@inheritDoc}
*/
public function diffTable(Table $fromTable, Table $toTable)
{
return parent::diffTable(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
private function normalizeColumns(Table $table): Table
{
$table = clone $table;
foreach ($table->getColumns() as $column) {
$options = $column->getPlatformOptions();
if (! isset($options['collation']) || $options['collation'] !== $this->databaseCollation) {
continue;
}
unset($options['collation']);
$column->setPlatformOptions($options);
}
return $table;
}
}

View file

@ -0,0 +1,86 @@
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Platforms\SQLServer\SQL\Builder;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Query\ForUpdate\ConflictResolutionMode;
use Doctrine\DBAL\Query\SelectQuery;
use Doctrine\DBAL\SQL\Builder\SelectSQLBuilder;
use function count;
use function implode;
final class SQLServerSelectSQLBuilder implements SelectSQLBuilder
{
private SQLServerPlatform $platform;
/** @internal The SQL builder should be instantiated only by database platforms. */
public function __construct(SQLServerPlatform $platform)
{
$this->platform = $platform;
}
public function buildSQL(SelectQuery $query): string
{
$parts = ['SELECT'];
if ($query->isDistinct()) {
$parts[] = 'DISTINCT';
}
$parts[] = implode(', ', $query->getColumns());
$from = $query->getFrom();
if (count($from) > 0) {
$parts[] = 'FROM ' . implode(', ', $from);
}
$forUpdate = $query->getForUpdate();
if ($forUpdate !== null) {
$with = ['UPDLOCK', 'ROWLOCK'];
if ($forUpdate->getConflictResolutionMode() === ConflictResolutionMode::SKIP_LOCKED) {
$with[] = 'READPAST';
}
$parts[] = 'WITH (' . implode(', ', $with) . ')';
}
$where = $query->getWhere();
if ($where !== null) {
$parts[] = 'WHERE ' . $where;
}
$groupBy = $query->getGroupBy();
if (count($groupBy) > 0) {
$parts[] = 'GROUP BY ' . implode(', ', $groupBy);
}
$having = $query->getHaving();
if ($having !== null) {
$parts[] = 'HAVING ' . $having;
}
$orderBy = $query->getOrderBy();
if (count($orderBy) > 0) {
$parts[] = 'ORDER BY ' . implode(', ', $orderBy);
}
$sql = implode(' ', $parts);
$limit = $query->getLimit();
if ($limit->isDefined()) {
$sql = $this->platform->modifyLimitQuery($sql, $limit->getMaxResults(), $limit->getFirstResult());
}
return $sql;
}
}

View file

@ -0,0 +1,13 @@
<?php
namespace Doctrine\DBAL\Platforms;
/**
* Provides the behavior, features and SQL dialect of the Microsoft SQL Server database platform
* of the oldest supported version.
*
* @deprecated Use {@see SQLServerPlatform} instead.
*/
class SQLServer2012Platform extends SQLServerPlatform
{
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,61 @@
<?php
namespace Doctrine\DBAL\Platforms\SQLite;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Comparator as BaseComparator;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\TableDiff;
use function strcasecmp;
/**
* Compares schemas in the context of SQLite platform.
*
* BINARY is the default column collation and should be ignored if specified explicitly.
*/
class Comparator extends BaseComparator
{
/** @internal The comparator can be only instantiated by a schema manager. */
public function __construct(SqlitePlatform $platform)
{
parent::__construct($platform);
}
public function compareTables(Table $fromTable, Table $toTable): TableDiff
{
return parent::compareTables(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
/**
* {@inheritDoc}
*/
public function diffTable(Table $fromTable, Table $toTable)
{
return parent::diffTable(
$this->normalizeColumns($fromTable),
$this->normalizeColumns($toTable),
);
}
private function normalizeColumns(Table $table): Table
{
$table = clone $table;
foreach ($table->getColumns() as $column) {
$options = $column->getPlatformOptions();
if (! isset($options['collation']) || strcasecmp($options['collation'], 'binary') !== 0) {
continue;
}
unset($options['collation']);
$column->setPlatformOptions($options);
}
return $table;
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,21 @@
<?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;
/** @codeCoverageIgnore */
private function __construct()
{
}
}