Unverified Commit 857631f6 authored by Benjamin Morel's avatar Benjamin Morel Committed by Sergei Morozov

Drop Drizzle support

parent cb6710c9
......@@ -73,12 +73,8 @@ full driver name::
pdo-mysql://localhost:4486/foo?charset=UTF-8
If you wanted to use the ``drizzle_pdo__mysql`` driver instead::
drizzle-pdo-mysql://localhost:4486/foo?charset=UTF-8
In the last two examples above, mind the dashes instead of the
underscores in the URL schemes.
In the example above, mind the dashes instead of the
underscores in the URL scheme.
For connecting to an SQLite database, the authority portion of the
URL is obviously irrelevant and thus can be omitted. The path part
......@@ -128,8 +124,6 @@ interfaces to use. It can be configured in one of three ways:
- ``pdo_mysql``: A MySQL driver that uses the pdo_mysql PDO
extension.
- ``drizzle_pdo_mysql``: A Drizzle driver that uses pdo_mysql PDO
extension.
- ``mysqli``: A MySQL driver that uses the mysqli extension.
- ``pdo_sqlite``: An SQLite driver that uses the pdo_sqlite PDO
extension.
......@@ -197,23 +191,6 @@ pdo_mysql
- ``charset`` (string): The charset used when connecting to the
database.
drizzle_pdo_mysql
^^^^^^^^^^^^^^^^^
**Requires** drizzle plugin ``mysql_protocol`` or ``mysql_unix_socket_protocol`` to be enabled.
On Ubuntu this can be done by editing ``/etc/drizzle/conf.d/mysql-protocol.cnf``
or ``/etc/drizzle/conf.d/mysql-unix-socket-protocol.cnf`` and restarting the drizzled daemon.
- ``user`` (string): Username to use when connecting to the
database. Only needed if authentication is configured for drizzled.
- ``password`` (string): Password to use when connecting to the
database. Only needed if authentication is configured for drizzled.
- ``host`` (string): Hostname of the database to connect to.
- ``port`` (integer): Port of the database to connect to.
- ``dbname`` (string): Name of the database/schema to connect to.
- ``unix_socket`` (string): Name of the socket used to connect to
the database.
mysqli
^^^^^^
......
......@@ -21,7 +21,6 @@ The following database vendors are currently supported:
- PostgreSQL
- SAP Sybase SQL Anywhere
- SQLite
- Drizzle
The Doctrine 2 database layer can be used independently of the
object-relational mapper. In order to use the DBAL all you need is
......
......@@ -76,11 +76,6 @@ SQLite
- ``SqlitePlatform`` for all versions.
Drizzle
^^^^^^
- ``DrizzlePlatform`` for all versions.
It is highly encouraged to use the platform class that matches your
database vendor and version best. Otherwise it is not guaranteed
that the compatibility in terms of SQL dialect and feature support
......
......@@ -116,10 +116,10 @@ The following options are not completely portable but are supported by most of t
vendors:
- **unsigned** (boolean): Whether a ``smallint``, ``integer`` or ``bigint`` Doctrine
type column should allow unsigned values only. Supported by MySQL, SQL Anywhere
and Drizzle. Defaults to ``false``.
type column should allow unsigned values only. Supported by MySQL and SQL Anywhere.
Defaults to ``false``.
- **comment** (integer|string): The column comment. Supported by MySQL, PostgreSQL,
Oracle, SQL Server, SQL Anywhere and Drizzle. Defaults to ``null``.
Oracle, SQL Server and SQL Anywhere. Defaults to ``null``.
Vendor specific options
^^^^^^^^^^^^^^^^^^^^^^^
......@@ -134,8 +134,8 @@ The following options are completely vendor specific and absolutely not portable
supported by some vendors but not portable:
- **charset** (string): The character set to use for the column. Currently only supported
on MySQL and Drizzle.
on MySQL.
- **collation** (string): The collation to use for the column. Supported by MySQL, PostgreSQL,
Sqlite, SQL Server and Drizzle.
Sqlite and SQL Server.
- **check** (string): The check constraint clause to add to the column.
Defaults to ``null``.
This diff is collapsed.
<?php
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\ParameterType;
class Connection extends PDOConnection
{
/**
* {@inheritdoc}
*/
public function quote($value, $type = ParameterType::STRING)
{
if ($type === ParameterType::BOOLEAN) {
return $value ? 'true' : 'false';
}
return parent::quote($value, $type);
}
}
<?php
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Platforms\DrizzlePlatform;
use Doctrine\DBAL\Schema\DrizzleSchemaManager;
/**
* Drizzle driver using PDO MySql.
*/
class Driver extends \Doctrine\DBAL\Driver\PDOMySql\Driver
{
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
return new Connection(
$this->constructPdoDsn($params),
$username,
$password,
$driverOptions
);
}
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion($version)
{
return $this->getDatabasePlatform();
}
/**
* {@inheritdoc}
*/
public function getDatabasePlatform()
{
return new DrizzlePlatform();
}
/**
* {@inheritdoc}
*/
public function getSchemaManager(\Doctrine\DBAL\Connection $conn)
{
return new DrizzleSchemaManager($conn);
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'drizzle_pdo_mysql';
}
}
......@@ -3,7 +3,6 @@
namespace Doctrine\DBAL;
use Doctrine\Common\EventManager;
use Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver as DrizzlePDOMySQLDriver;
use Doctrine\DBAL\Driver\IBMDB2\DB2Driver;
use Doctrine\DBAL\Driver\Mysqli\Driver as MySQLiDriver;
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver;
......@@ -44,17 +43,16 @@ final class DriverManager
* @var string[]
*/
private static $_driverMap = [
'pdo_mysql' => PDOMySQLDriver::class,
'pdo_sqlite' => PDOSQLiteDriver::class,
'pdo_pgsql' => PDOPgSQLDriver::class,
'pdo_oci' => PDOOCIDriver::class,
'oci8' => OCI8Driver::class,
'ibm_db2' => DB2Driver::class,
'pdo_sqlsrv' => PDOSQLSrvDriver::class,
'mysqli' => MySQLiDriver::class,
'drizzle_pdo_mysql' => DrizzlePDOMySQLDriver::class,
'sqlanywhere' => SQLAnywhereDriver::class,
'sqlsrv' => SQLSrvDriver::class,
'pdo_mysql' => PDOMySQLDriver::class,
'pdo_sqlite' => PDOSQLiteDriver::class,
'pdo_pgsql' => PDOPgSQLDriver::class,
'pdo_oci' => PDOOCIDriver::class,
'oci8' => OCI8Driver::class,
'ibm_db2' => DB2Driver::class,
'pdo_sqlsrv' => PDOSQLSrvDriver::class,
'mysqli' => MySQLiDriver::class,
'sqlanywhere' => SQLAnywhereDriver::class,
'sqlsrv' => SQLSrvDriver::class,
];
/**
......@@ -100,7 +98,6 @@ final class DriverManager
* sqlanywhere
* sqlsrv
* ibm_db2 (unstable)
* drizzle_pdo_mysql
*
* OR 'driverClass' that contains the full class name (with namespace) of the
* driver class to instantiate.
......
This diff is collapsed.
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* Drizzle Keywordlist.
*/
class DrizzleKeywords extends KeywordList
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'drizzle';
}
/**
* {@inheritdoc}
*/
protected function getKeywords()
{
return [
'ABS',
'ALL',
'ALLOCATE',
'ALTER',
'AND',
'ANY',
'ARE',
'ARRAY',
'AS',
'ASENSITIVE',
'ASYMMETRIC',
'AT',
'ATOMIC',
'AUTHORIZATION',
'AVG',
'BEGIN',
'BETWEEN',
'BIGINT',
'BINARY',
'BLOB',
'BOOLEAN',
'BOTH',
'BY',
'CALL',
'CALLED',
'CARDINALITY',
'CASCADED',
'CASE',
'CAST',
'CEIL',
'CEILING',
'CHAR',
'CHARACTER',
'CHARACTER_LENGTH',
'CHAR_LENGTH',
'CHECK',
'CLOB',
'CLOSE',
'COALESCE',
'COLLATE',
'COLLECT',
'COLUMN',
'COMMIT',
'CONDITION',
'CONNECT',
'CONSTRAINT',
'CONVERT',
'CORR',
'CORRESPONDING',
'COUNT',
'COVAR_POP',
'COVAR_SAMP',
'CREATE',
'CROSS',
'CUBE',
'CUME_DIST',
'CURRENT',
'CURRENT_DATE',
'CURRENT_DEFAULT_TRANSFORM_GROUP',
'CURRENT_PATH',
'CURRENT_ROLE',
'CURRENT_TIME',
'CURRENT_TIMESTAMP',
'CURRENT_TRANSFORM_GROUP_FOR_TYPE',
'CURRENT_USER',
'CURSOR',
'CYCLE',
'DATE',
'DAY',
'DEALLOCATE',
'DEC',
'DECIMAL',
'DECLARE',
'DEFAULT',
'DELETE',
'DENSE_RANK',
'DEREF',
'DESCRIBE',
'DETERMINISTIC',
'DISCONNECT',
'DISTINCT',
'DOUBLE',
'DROP',
'DYNAMIC',
'EACH',
'ELEMENT',
'ELSE',
'END',
'ESCAPE',
'EVERY',
'EXCEPT',
'EXEC',
'EXECUTE',
'EXISTS',
'EXP',
'EXTERNAL',
'EXTRACT',
'FALSE',
'FETCH',
'FILTER',
'FLOAT',
'FLOOR',
'FOR',
'FOREIGN',
'FREE',
'FROM',
'FULL',
'FUNCTION',
'FUSION',
'GET',
'GLOBAL',
'GRANT',
'GROUP',
'GROUPING',
'HAVING',
'HOLD',
'HOUR',
'IDENTITY',
'IN',
'INDICATOR',
'INNER',
'INOUT',
'INSENSITIVE',
'INSERT',
'INT',
'INTEGER',
'INTERSECT',
'INTERSECTION',
'INTERVAL',
'INTO',
'IS',
'JOIN',
'LANGUAGE',
'LARGE',
'LATERAL',
'LEADING',
'LEFT',
'LIKE',
'LN',
'LOCAL',
'LOCALTIME',
'LOCALTIMESTAMP',
'LOWER',
'MATCH',
'MAX',
'MEMBER',
'MERGE',
'METHOD',
'MIN',
'MINUTE',
'MOD',
'MODIFIES',
'MODULE',
'MONTH',
'MULTISET',
'NATIONAL',
'NATURAL',
'NCHAR',
'NCLOB',
'NEW',
'NO',
'NONE',
'NORMALIZE',
'NOT',
'NULL_SYM',
'NULLIF',
'NUMERIC',
'OCTET_LENGTH',
'OF',
'OLD',
'ON',
'ONLY',
'OPEN',
'OR',
'ORDER',
'OUT',
'OUTER',
'OVER',
'OVERLAPS',
'OVERLAY',
'PARAMETER',
'PARTITION',
'PERCENTILE_CONT',
'PERCENTILE_DISC',
'PERCENT_RANK',
'POSITION',
'POWER',
'PRECISION',
'PREPARE',
'PRIMARY',
'PROCEDURE',
'RANGE',
'RANK',
'READS',
'REAL',
'RECURSIVE',
'REF',
'REFERENCES',
'REFERENCING',
'REGR_AVGX',
'REGR_AVGY',
'REGR_COUNT',
'REGR_INTERCEPT',
'REGR_R2',
'REGR_SLOPE',
'REGR_SXX',
'REGR_SXY',
'REGR_SYY',
'RELEASE',
'RESULT',
'RETURN',
'RETURNS',
'REVOKE',
'RIGHT',
'ROLLBACK',
'ROLLUP',
'ROW',
'ROWS',
'ROW_NUMBER',
'SAVEPOINT',
'SCOPE',
'SCROLL',
'SEARCH',
'SECOND',
'SELECT',
'SENSITIVE',
'SESSION_USER',
'SET',
'SIMILAR',
'SMALLINT',
'SOME',
'SPECIFIC',
'SPECIFICTYPE',
'SQL',
'SQLEXCEPTION',
'SQLSTATE',
'SQLWARNING',
'SQRT',
'START',
'STATIC',
'STDDEV_POP',
'STDDEV_SAMP',
'SUBMULTISET',
'SUBSTRING',
'SUM',
'SYMMETRIC',
'SYSTEM',
'SYSTEM_USER',
'TABLE',
'TABLESAMPLE',
'THEN',
'TIME',
'TIMESTAMP',
'TIMEZONE_HOUR',
'TIMEZONE_MINUTE',
'TO',
'TRAILING',
'TRANSLATE',
'TRANSLATION',
'TREAT',
'TRIGGER',
'TRIM',
'TRUE',
'UESCAPE',
'UNION',
'UNIQUE',
'UNKNOWN',
'UNNEST',
'UPDATE',
'UPPER',
'USER',
'USING',
'VALUE',
'VALUES',
'VARCHAR',
'VARYING',
'VAR_POP',
'VAR_SAMP',
'WHEN',
'WHENEVER',
'WHERE',
'WIDTH_BUCKET',
'WINDOW',
'WITH',
'WITHIN',
'WITHOUT',
'XML',
'XMLAGG',
'XMLATTRIBUTES',
'XMLBINARY',
'XMLCOMMENT',
'XMLCONCAT',
'XMLELEMENT',
'XMLFOREST',
'XMLNAMESPACES',
'XMLPARSE',
'XMLPI',
'XMLROOT',
'XMLSERIALIZE',
'YEAR',
];
}
}
......@@ -26,7 +26,6 @@ class Connection extends \Doctrine\DBAL\Connection
public const PORTABILITY_POSTGRESQL = 13;
public const PORTABILITY_SQLITE = 13;
public const PORTABILITY_OTHERVENDORS = 12;
public const PORTABILITY_DRIZZLE = 13;
public const PORTABILITY_SQLANYWHERE = 13;
public const PORTABILITY_SQLSRV = 13;
......@@ -51,8 +50,6 @@ class Connection extends \Doctrine\DBAL\Connection
$params['portability'] &= self::PORTABILITY_POSTGRESQL;
} elseif ($this->getDatabasePlatform()->getName() === 'sqlite') {
$params['portability'] &= self::PORTABILITY_SQLITE;
} elseif ($this->getDatabasePlatform()->getName() === 'drizzle') {
$params['portability'] &= self::PORTABILITY_DRIZZLE;
} elseif ($this->getDatabasePlatform()->getName() === 'sqlanywhere') {
$params['portability'] &= self::PORTABILITY_SQLANYWHERE;
} elseif ($this->getDatabasePlatform()->getName() === 'db2') {
......
<?php
namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\Types\Type;
use function explode;
use function strtolower;
use function trim;
/**
* Schema manager for the Drizzle RDBMS.
*/
class DrizzleSchemaManager extends AbstractSchemaManager
{
/**
* {@inheritdoc}
*/
protected function _getPortableTableColumnDefinition($tableColumn)
{
$dbType = strtolower($tableColumn['DATA_TYPE']);
$type = $this->_platform->getDoctrineTypeMapping($dbType);
$type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
$tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
$options = [
'notnull' => ! (bool) $tableColumn['IS_NULLABLE'],
'length' => (int) $tableColumn['CHARACTER_MAXIMUM_LENGTH'],
'default' => $tableColumn['COLUMN_DEFAULT'] ?? null,
'autoincrement' => (bool) $tableColumn['IS_AUTO_INCREMENT'],
'scale' => (int) $tableColumn['NUMERIC_SCALE'],
'precision' => (int) $tableColumn['NUMERIC_PRECISION'],
'comment' => isset($tableColumn['COLUMN_COMMENT']) && $tableColumn['COLUMN_COMMENT'] !== ''
? $tableColumn['COLUMN_COMMENT']
: null,
];
$column = new Column($tableColumn['COLUMN_NAME'], Type::getType($type), $options);
if (! empty($tableColumn['COLLATION_NAME'])) {
$column->setPlatformOption('collation', $tableColumn['COLLATION_NAME']);
}
return $column;
}
/**
* {@inheritdoc}
*/
protected function _getPortableDatabaseDefinition($database)
{
return $database['SCHEMA_NAME'];
}
/**
* {@inheritdoc}
*/
protected function _getPortableTableDefinition($table)
{
return $table['TABLE_NAME'];
}
/**
* {@inheritdoc}
*/
public function _getPortableTableForeignKeyDefinition($tableForeignKey)
{
$columns = [];
foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) {
$columns[] = trim($value, ' `');
}
$refColumns = [];
foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) {
$refColumns[] = trim($value, ' `');
}
return new ForeignKeyConstraint(
$columns,
$tableForeignKey['REFERENCED_TABLE_NAME'],
$refColumns,
$tableForeignKey['CONSTRAINT_NAME'],
[
'onUpdate' => $tableForeignKey['UPDATE_RULE'],
'onDelete' => $tableForeignKey['DELETE_RULE'],
]
);
}
/**
* {@inheritdoc}
*/
protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
{
$indexes = [];
foreach ($tableIndexes as $k) {
$k['primary'] = (bool) $k['primary'];
$indexes[] = $k;
}
return parent::_getPortableTableIndexesList($indexes, $tableName);
}
}
<?php
namespace Doctrine\Tests\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver as DriverInterface;
use Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DrizzlePlatform;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\DrizzleSchemaManager;
use Doctrine\Tests\DBAL\Driver\PDOMySql\DriverTest as PDOMySQLDriverTest;
class DriverTest extends PDOMySQLDriverTest
{
public function testReturnsName() : void
{
self::assertSame('drizzle_pdo_mysql', $this->driver->getName());
}
public function testThrowsExceptionOnCreatingDatabasePlatformsForInvalidVersion() : void
{
$this->markTestSkipped('This test does not work on Drizzle as it is not version aware.');
}
protected function createDriver() : DriverInterface
{
return new Driver();
}
protected function createPlatform() : AbstractPlatform
{
return new DrizzlePlatform();
}
protected function createSchemaManager(Connection $connection) : AbstractSchemaManager
{
return new DrizzleSchemaManager($connection);
}
/**
* @return mixed[][]
*/
protected function getDatabasePlatformsForVersions() : array
{
return [
['foo', DrizzlePlatform::class],
['bar', DrizzlePlatform::class],
['baz', DrizzlePlatform::class],
];
}
}
......@@ -6,7 +6,6 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Connections\MasterSlaveConnection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Driver\DrizzlePDOMySql\Driver as DrizzlePDOMySqlDriver;
use Doctrine\DBAL\Driver\PDOMySql\Driver as PDOMySQLDriver;
use Doctrine\DBAL\Driver\PDOSqlite\Driver as PDOSqliteDriver;
use Doctrine\DBAL\Driver\SQLSrv\Driver as SQLSrvDriver;
......@@ -355,17 +354,17 @@ class DriverManagerTest extends DbalTestCase
],
],
'simple URL with fallthrough scheme containing underscores fails' => [
'drizzle_pdo_mysql://foo:bar@localhost/baz',
'pdo_mysql://foo:bar@localhost/baz',
false,
],
'simple URL with fallthrough scheme containing dashes works' => [
'drizzle-pdo-mysql://foo:bar@localhost/baz',
'pdo-mysql://foo:bar@localhost/baz',
[
'user' => 'foo',
'password' => 'bar',
'host' => 'localhost',
'dbname' => 'baz',
'driver' => DrizzlePDOMySqlDriver::class,
'driver' => PDOMySQLDriver::class,
],
],
'simple URL with percent encoding' => [
......
......@@ -6,7 +6,6 @@ use Doctrine\DBAL\Driver\ExceptionConverterDriver;
use Doctrine\DBAL\Driver\ServerInfoAwareConnection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\DrizzlePlatform;
use Doctrine\DBAL\Platforms\MySqlPlatform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
......@@ -357,10 +356,6 @@ EOT
$this->markTestSkipped('Only skipped if platform is not sqlite');
}
if ($platform instanceof DrizzlePlatform) {
$this->markTestSkipped('Drizzle does not always support authentication');
}
if ($platform instanceof PostgreSqlPlatform && isset($params['password'])) {
$this->markTestSkipped('Does not work on Travis');
}
......
<?php
namespace Doctrine\Tests\DBAL\Functional\Schema;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\BinaryType;
class DrizzleSchemaManagerTest extends SchemaManagerFunctionalTestCase
{
public function testListTableWithBinary() : void
{
$tableName = 'test_binary_table';
$table = new Table($tableName);
$table->addColumn('id', 'integer');
$table->addColumn('column_varbinary', 'binary', []);
$table->addColumn('column_binary', 'binary', ['fixed' => true]);
$table->setPrimaryKey(['id']);
$this->schemaManager->createTable($table);
$table = $this->schemaManager->listTableDetails($tableName);
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_varbinary')->getType());
self::assertFalse($table->getColumn('column_varbinary')->getFixed());
self::assertInstanceOf(BinaryType::class, $table->getColumn('column_binary')->getType());
self::assertFalse($table->getColumn('column_binary')->getFixed());
}
public function testColumnCollation() : void
{
$table = new Table('test_collation');
$table->addOption('collate', $collation = 'utf8_unicode_ci');
$table->addColumn('id', 'integer');
$table->addColumn('text', 'text');
$table->addColumn('foo', 'text')->setPlatformOption('collation', 'utf8_swedish_ci');
$table->addColumn('bar', 'text')->setPlatformOption('collation', 'utf8_general_ci');
$this->schemaManager->dropAndCreateTable($table);
$columns = $this->schemaManager->listTableColumns('test_collation');
self::assertArrayNotHasKey('collation', $columns['id']->getPlatformOptions());
self::assertEquals('utf8_unicode_ci', $columns['text']->getPlatformOption('collation'));
self::assertEquals('utf8_swedish_ci', $columns['foo']->getPlatformOption('collation'));
self::assertEquals('utf8_general_ci', $columns['bar']->getPlatformOption('collation'));
}
}
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