Unverified Commit f82f5c5b authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3906 from morozov/backport-legacy-platform-driver-removal

Backport removal of legacy platforms and drivers from master
parents 0d9a8c5e e360ba05
......@@ -18,11 +18,6 @@ cache:
## Build matrix for lowest and highest possible targets
environment:
matrix:
- db: mssql
driver: sqlsrv
db_version: sql2008r2sp2
coverage: yes
php: 7.3
- db: mssql
driver: sqlsrv
db_version: sql2012sp1
......
......@@ -21,7 +21,7 @@ before_commands:
tools:
external_code_coverage:
timeout: 3600
runs: 28 # 23x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
runs: 26 # 21x Travis (jobs with COVERAGE=yes) + 3x AppVeyor (jobs with coverage=yes) + 2x ContinuousPHP
filter:
excluded_paths:
......
......@@ -95,22 +95,6 @@ jobs:
- stage: Test
php: 7.3
env: DB=mariadb.mysqli.docker IMAGE=mariadb:10.3 COVERAGE=yes
- stage: Test
dist: trusty
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.2 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.2"
- stage: Test
dist: trusty
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.3 COVERAGE=yes
services:
- postgresql
addons:
postgresql: "9.3"
- stage: Test
php: 7.3
env: DB=pgsql POSTGRESQL_VERSION=9.4 COVERAGE=yes
......
# Upgrade to 3.0
## BC BREAK: Removed support for PostgreSQL 9.3 and older
DBAL now requires PostgeSQL 9.4 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent PostgreSQL 9.4.
The following classes have been removed:
* `Doctrine\DBAL\Platforms\PostgreSQL94Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL94Keywords`
## BC BREAK: Removed support for MariaDB 10.0 and older
DBAL now requires MariaDB 10.1 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer MariaDB version (10.1+ is recommended).
## BC BREAK: PingableConnection and ServerInfoAwareConnection interfaces now extend Connection
All implementations of the `PingableConnection` and `ServerInfoAwareConnection` interfaces have to implement the methods defined in the `Connection` interface as well.
......@@ -8,6 +24,64 @@ All implementations of the `PingableConnection` and `ServerInfoAwareConnection`
All implementations of the `VersionAwarePlatformDriver` interface have to implement the methods defined in the `Driver` interface as well.
## BC BREAK: Removed MsSQLKeywords class
The `Doctrine\DBAL\Platforms\MsSQLKeywords` class has been removed.
Please use `Doctrine\DBAL\Platforms\SQLServerPlatform `instead.
## BC BREAK: Removed PDO DB2 driver
This PDO-based IBM DB2 driver (built on top of `pdo_ibm` extension) has already been unsupported as of 2.5, it has been now removed.
The following class has been removed:
* `Doctrine\DBAL\Driver\PDOIbm\Driver`
## BC BREAK: Removed support for SQL Anywhere 12 and older
DBAL now requires SQL Anywhere 16 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer SQL Anywhere version (16+).
`Doctrine\DBAL\Platforms\SQLAnywherePlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLAnywhereKeywords` now represent SQL Anywhere 16.
The following classes have been removed:
* `Doctrine\DBAL\Platforms\SQLAnywhere11Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere12Platform`
* `Doctrine\DBAL\Platforms\SQLAnywhere16Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere11Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere12Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLAnywhere16Keywords`
## BC BREAK: Removed support for SQL Server 2008 and older
DBAL now requires SQL Server 2012 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer SQL Server version.
`Doctrine\DBAL\Platforms\SQLServerPlatform` and `Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords` now represent SQL Server 2012.
The following classes have been removed:
* `Doctrine\DBAL\Platforms\SQLServer2005Platform`
* `Doctrine\DBAL\Platforms\SQLServer2008Platform`
* `Doctrine\DBAL\Platforms\SQLServer2012Platform`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2005Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords`
* `Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords`
The `AbstractSQLServerDriver` class and its subclasses no longer implement the `VersionAwarePlatformDriver` interface.
## BC BREAK: Removed support for PostgreSQL 9.2 and older
DBAL now requires PostgeSQL 9.3 or newer, support for unmaintained versions has been dropped.
If you are using any of the legacy versions, you have to upgrade to a newer PostgreSQL version (9.6+ is recommended).
`Doctrine\DBAL\Platforms\PostgreSqlPlatform` and `Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords` now represent PostgreSQL 9.3.
The following classes have been removed:
* `Doctrine\DBAL\Platforms\PostgreSQL91Platform`
* `Doctrine\DBAL\Platforms\PostgreSQL92Platform`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL91Keywords`
* `Doctrine\DBAL\Platforms\Keywords\PostgreSQL92Keywords`
## BC BREAK: Removed Doctrine\DBAL\Version
The `Doctrine\DBAL\Version` class is no longer available: please refrain from checking the DBAL version at runtime.
......@@ -49,6 +123,10 @@ After:
$stmt->bindValue(1, 1, ParameterType::INTEGER);
$stmt->fetchAll(FetchMode::COLUMN);
## BC BREAK: Removed Drizzle support
The Drizzle project is abandoned and is therefore not supported by Doctrine DBAL anymore.
## BC BREAK: Removed dbal:import CLI command
The `dbal:import` CLI command has been removed since it only worked with PDO-based drivers by relying on a non-documented behavior of the extension, and it was impossible to make it work with other drivers.
......
# Azure Federations
Implementing Federations inside a new Doctrine Sharding Extension. Some extensions to the DBAL and ORM core have to be done to get this working.
1. DBAL (Database Abstraction Layer)
* Add support for Database Schema Operations
* CREATE FEDERATION
* CREATE TABLE ... FEDERATED ON
* Add support to create a multi-tenant schema from any given schema
* Add API to pick a shard based on distribution key and atomic value
* Add API to ask about federations, federation members and so on.
* Add Sharding Abstraction
* If a shard is picked via distribution key and atomic value fire queries against this only
* Or query the global database.
2. ORM (Object-Relational Mapper)
* Federation Key has to be part of the clustered index of the table
* Test with a pure Multi-Tenant App with Filtering = ON (TaskList)
* Test with sharded app (Weather)
## Implementation Details
SQL Azure requires one and exactly one clustered index. It makes no difference if the primary key
or any other key is the clustered index. Sharding requires an external ID generation (no auto-increment)
such as GUIDs. GUIDs have negative properties with regard to clustered index performance, so that
typically you would add a "created" timestamp for example that holds the clustered index instead
of making the GUID a clustered index.
## Example API:
@@@ php
<?php
use Doctrine\DBAL\DriverManager;
$dbParams = array(
'dbname' => 'tcp:dbname.database.windows.net',
'sharding' => array(
'federationName' => 'Orders_Federation',
'distributionKey' => 'CustID',
'distributionType' => 'integer',
'filteringEnabled' => false,
),
// ...
);
$conn = DriverManager::getConnection($dbParams);
$shardManager = $conn->getShardManager();
// Example 1: query against root database
$sql = "SELECT * FROM Products";
$rows = $conn->executeQuery($sql);
// Example 2: query against the selected shard with CustomerId = 100
$aCustomerID = 100;
$shardManager->selectShard($aCustomerID); // Using Default federationName and distributionKey
// Query: "USE FEDERATION Orders_Federation (CustID = $aCustomerID) WITH RESET, FILTERING OFF;"
$sql = "SELECT * FROM Customers";
$rows = $conn->executeQuery($sql);
// Example 3: Reset API to root database again
$shardManager->selectGlobal();
## ID Generation
With sharding all the ids have to be generated for global uniqueness. There are three strategies for this.
1. Use GUIDs as described here http://blogs.msdn.com/b/cbiyikoglu/archive/2011/06/20/id-generation-in-federations-identity-sequences-and-guids-uniqueidentifier.aspx
2. Having a central table that is accessed with a second connection to generate sequential ids
3. Using natural keys from the domain.
The second approach has the benefit of having numerical primary keys, however also a central failure location. The third strategy can seldom be used, because the domains don't allow this. Identity columns cannot be used at all.
@@@ php
<?php
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Id\TableHiLoIdGenerator;
$dbParams = array(
'dbname' => 'dbname.database.windows.net',
// ...
);
$conn = DriverManager::getConnection($dbParams);
$idGenerator = new TableHiLoIdGenerator($conn, 'id_table_name', $multiplicator = 1);
// only once, create this table
$idGenerator->createTable();
$nextId = $idGenerator->generateId('for_table_name');
$nextOtherId = $idGenerator->generateId('for_other_table');
The connection for the table generator has to be a different one than the one used for the main app to avoid transaction clashes.
# Doctrine Shards
Doctrine Extension to support horizontal sharding in the Doctrine ORM.
## Idea
Implement sharding inside Doctrine at a level that is as unobtrusive to the developer as possible.
Problems to tackle:
1. Where to send INSERT statements?
2. How to generate primary keys?
3. How to pick shards for update, delete statements?
4. How to pick shards for select operations?
5. How to merge select queries that span multiple shards?
6. How to handle/prevent multi-shard queries that cannot be merged (GROUP BY)?
7. How to handle non-sharded data? (static metadata tables for example)
8. How to handle multiple connections?
9. Implementation on the DBAL or ORM level?
## Roadmap
Version 1: DBAL 2.3 (Multi-Tenant Apps)
1. ID Generation support (in DBAL + ORM done)
2. Multi-Tenant Support: Either pick a global metadata database or exactly one shard.
3. Fan-out queries over all shards (or a subset) by result appending
Version 2: ORM related (complex):
4. ID resolving (Pick shard for a new ID)
5. Query resolving (Pick shards a query should send to)
6. Shard resolving (Pick shards an ID could be on)
7. Transactions
8. Read Only objects
## Technical Requirements for Database Schemas
Sharded tables require the sharding-distribution key as one of their columns. This will affect your code compared to a normalized db-schema. If you have a Blog <-> BlogPost <-> PostComments entity setup sharded by `blog_id` then even the PostComment table needs this column, even if an "unsharded", normalized DB-Schema does not need this information.
## Implementation Details
Assumptions:
* For querying you either want to query ALL or just exactly one shard.
* IDs for ALL sharded tables have to be unique across all shards.
* Non-sharded data is replicated between all shards. They redundantly keep the information available. This is necessary so join queries on shards to reference data work.
* If you retrieve an object A from a shard, then all references and collections of this object reside on the same shard.
* The database schema on all shards is the same (or compatible)
### SQL Azure Federations
SQL Azure is a special case, points 1, 2, 3, 4, 7 and 8 are partly handled on the database level. This makes it a perfect test-implementation for just the subset of features in points 5-6. However there needs to be a way to configure SchemaTool to generate the correct Schema on SQL Azure.
* SELECT Operations: The most simple assumption is to always query all shards unless the user specifies otherwise explicitly.
* Queries can be merged in PHP code, this obviously does not work for DISTINCT, GROUP BY and ORDER BY queries.
### Generic Sharding
More features are necessary to implement sharding on the PHP level, independent from database support:
1. Configuration of multiple connections, one connection = one shard.
2. Primary Key Generation mechanisms (UUID, central table, sequence emulation)
## Primary Use-Cases
1. Multi-Tenant Applications
These are easier to support as you have some value to determine the shard id for the whole request very early on.
Here also queries can always be limited to a single shard.
2. Scale-Out by some attribute (Round-Robin?)
This strategy requires access to multiple shards in a single request based on the data accessed.
......@@ -71,12 +71,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
......@@ -126,8 +122,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.
......@@ -195,23 +189,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
^^^^^^
......@@ -250,20 +227,20 @@ pdo_pgsql
- ``sslmode`` (string): Determines whether or with what priority
a SSL TCP/IP connection will be negotiated with the server.
See the list of available modes:
`http://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
`https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLMODE`
- ``sslrootcert`` (string): specifies the name of a file containing
SSL certificate authority (CA) certificate(s). If the file exists,
the server's certificate will be verified to be signed by one of these
authorities.
See http://www.postgresql.org/docs/9.0/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
See https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLROOTCERT
- ``sslcert`` (string): specifies the file name of the client SSL certificate.
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCERT`
- ``sslkey`` (string): specifies the location for the secret key used for the
client certificate.
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLKEY`
- ``sslcrl`` (string): specifies the file name of the SSL certificate
revocation list (CRL).
See `https://www.postgresql.org/docs/9.1/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
See `https://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNECT-SSLCRL`
- ``application_name`` (string): Name of the application that is
connecting to database. Optional. It will be displayed at ``pg_stat_activity``.
......@@ -331,14 +308,9 @@ sqlanywhere
Depending on the used underlying platform version, you can specify
any other connection parameter that is supported by the particular
platform version via the ``driverOptions`` option.
You can find a list of supported connection parameters for each
platform version here:
- `SQL Anywhere 10.0.1 <http://dcx.sybase.com/index.html#1001/en/dbdaen10/da-conmean.html>`_
- `SQL Anywhere 11.0.0 <http://dcx.sybase.com/index.html#1100/en/dbadmin_en11/conmean.html>`_
- `SQL Anywhere 11.0.1 <http://dcx.sybase.com/index.html#1101/en/dbadmin_en11/conmean.html>`_
- `SQL Anywhere 12.0.0 <http://dcx.sybase.com/index.html#1200/en/dbadmin/da-conparm.html>`_
- `SQL Anywhere 12.0.1 <http://dcx.sybase.com/index.html#1201/en/dbadmin/da-conparm.html>`_
You can find a list of supported connection parameters for the
currently supported platform here:
- `SAP Sybase SQL Anywhere 16.0 <http://dcx.sybase.com/index.html#sa160/en/dbadmin/da-conparm.html>`_
Automatic platform version detection
......@@ -379,7 +351,7 @@ You can also pass this option if you want to disable automatic database platform
detection for a driver that natively supports it and choose the platform version
implementation explicitly.
If you are running a MariaDB database, you should prefix the ``serverVersion``
If you are running a MariaDB database, you should prefix the ``serverVersion``
with ``mariadb-`` (ex: ``mariadb-10.2.12``).
Custom Platform
......
......@@ -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
......
......@@ -50,37 +50,24 @@ Oracle
Microsoft SQL Server
^^^^^^^^^^^^^^^^^^^^
- ``SQLServerPlatform`` for version 2000 and above (deprecated).
- ``SQLServer2005Platform`` for version 2005 and above (deprecated).
- ``SQLServer2008Platform`` for version 2008 and above (deprecated).
- ``SQLServer2012Platform`` for version 2012 and above.
- ``SQLServerPlatform`` for version 2012 and above.
PostgreSQL
^^^^^^^^^^
- ``PostgreSqlPlatform`` for version 9.0 and below (deprecated).
- ``PostgreSQL91Platform`` for version 9.1 and above (deprecated).
- ``PostgreSQL92Platform`` for version 9.2 and above (deprecated).
- ``PostgreSQL94Platform`` for version 9.4 and above.
- ``PostgreSqlPlatform`` for version 9.4 and above.
- ``PostgreSQL100Platform`` for version 10.0 and above.
SAP Sybase SQL Anywhere
^^^^^^^^^^^^^^^^^^^^^^^
- ``SQLAnywherePlatform`` for version 10 and above (deprecated).
- ``SQLAnywhere11Platform`` for version 11 and above (deprecated).
- ``SQLAnywhere12Platform`` for version 12 and above (deprecated).
- ``SQLAnywhere16Platform`` for version 16 and above.
- ``SQLAnywherePlatform`` for version 16 and above.
SQLite
^^^^^^
- ``SqlitePlatform`` for all versions.
Drizzle
^^^^^^
- ``DrizzlePlatform`` for all versions (deprecated).
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.
This diff is collapsed.
This diff is collapsed.
......@@ -13,8 +13,6 @@
reference/schema-representation
reference/events
reference/security
reference/sharding
reference/sharding_azure_tutorial
reference/supporting-other-databases
reference/portability
reference/caching
......
# Sharding with SQLAzure Example
This example demonstrates Sharding with SQL Azure Federations.
## Requirements
1. Windows Azure Account
2. SQL Azure Database
3. Composer for dependencies
## Install
composer install
Change "examples/sharding/bootstrap.php" to contain Database connection.
## Order to execute Scripts
1. create_schema.php
2. view_federation_members.php
3. insert_data.php
4. split_federation.php
5. insert_data_after_split.php
6. query_filtering_off.php
7. query_filtering_on.php
<?php
// bootstrap.php
use Doctrine\DBAL\DriverManager;
use Doctrine\Shards\DBAL\SQLAzure\SQLAzureShardManager;
require_once "vendor/autoload.php";
$config = array(
'dbname' => 'SalesDB',
'host' => 'tcp:dbname.windows.net',
'user' => 'user@dbname',
'password' => 'XXX',
'sharding' => array(
'federationName' => 'Orders_Federation',
'distributionKey' => 'CustId',
'distributionType' => 'integer',
)
);
if ($config['host'] == "tcp:dbname.windows.net") {
die("You have to change the configuration to your Azure account.\n");
}
$conn = DriverManager::getConnection($config);
$shardManager = new SQLAzureShardManager($conn);
{
"require": {
"doctrine/dbal": "*",
"doctrine/shards": "0.3"
}
}
<?php
// create_schema.php
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Shards\DBAL\SQLAzure\SQLAzureSchemaSynchronizer;
require_once 'bootstrap.php';
$schema = new Schema();
$products = $schema->createTable('Products');
$products->addColumn('ProductID', 'integer');
$products->addColumn('SupplierID', 'integer');
$products->addColumn('ProductName', 'string');
$products->addColumn('Price', 'decimal', array('scale' => 2, 'precision' => 12));
$products->setPrimaryKey(array('ProductID'));
$products->addOption('azure.federated', true);
$customers = $schema->createTable('Customers');
$customers->addColumn('CustomerID', 'integer');
$customers->addColumn('CompanyName', 'string');
$customers->addColumn('FirstName', 'string');
$customers->addColumn('LastName', 'string');
$customers->setPrimaryKey(array('CustomerID'));
$customers->addOption('azure.federated', true);
$customers->addOption('azure.federatedOnColumnName', 'CustomerID');
$orders = $schema->createTable('Orders');
$orders->addColumn('CustomerID', 'integer');
$orders->addColumn('OrderID', 'integer');
$orders->addColumn('OrderDate', 'datetime');
$orders->setPrimaryKey(array('CustomerID', 'OrderID'));
$orders->addOption('azure.federated', true);
$orders->addOption('azure.federatedOnColumnName', 'CustomerID');
$orderItems = $schema->createTable('OrderItems');
$orderItems->addColumn('CustomerID', 'integer');
$orderItems->addColumn('OrderID', 'integer');
$orderItems->addColumn('ProductID', 'integer');
$orderItems->addColumn('Quantity', 'integer');
$orderItems->setPrimaryKey(array('CustomerID', 'OrderID', 'ProductID'));
$orderItems->addOption('azure.federated', true);
$orderItems->addOption('azure.federatedOnColumnName', 'CustomerID');
// Create the Schema + Federation:
$synchronizer = new SQLAzureSchemaSynchronizer($conn, $shardManager);
// Or just look at the SQL:
echo implode("\n", $synchronizer->getCreateSchema($schema));
$synchronizer->createSchema($schema);
<?php
// insert_data.php
require_once "bootstrap.php";
$shardManager->selectShard(0);
$conn->insert("Products", array(
"ProductID" => 386,
"SupplierID" => 1001,
"ProductName" => 'Titanium Extension Bracket Left Hand',
"Price" => 5.25,
));
$conn->insert("Products", array(
"ProductID" => 387,
"SupplierID" => 1001,
"ProductName" => 'Titanium Extension Bracket Right Hand',
"Price" => 5.25,
));
$conn->insert("Products", array(
"ProductID" => 388,
"SupplierID" => 1001,
"ProductName" => 'Fusion Generator Module 5 kV',
"Price" => 10.50,
));
$conn->insert("Products", array(
"ProductID" => 389,
"SupplierID" => 1001,
"ProductName" => 'Bypass Filter 400 MHz Low Pass',
"Price" => 10.50,
));
$conn->insert("Customers", array(
'CustomerID' => 10,
'CompanyName' => 'Van Nuys',
'FirstName' => 'Catherine',
'LastName' => 'Abel',
));
$conn->insert("Customers", array(
'CustomerID' => 20,
'CompanyName' => 'Abercrombie',
'FirstName' => 'Kim',
'LastName' => 'Branch',
));
$conn->insert("Customers", array(
'CustomerID' => 30,
'CompanyName' => 'Contoso',
'FirstName' => 'Frances',
'LastName' => 'Adams',
));
$conn->insert("Customers", array(
'CustomerID' => 40,
'CompanyName' => 'A. Datum Corporation',
'FirstName' => 'Mark',
'LastName' => 'Harrington',
));
$conn->insert("Customers", array(
'CustomerID' => 50,
'CompanyName' => 'Adventure Works',
'FirstName' => 'Keith',
'LastName' => 'Harris',
));
$conn->insert("Customers", array(
'CustomerID' => 60,
'CompanyName' => 'Alpine Ski House',
'FirstName' => 'Wilson',
'LastName' => 'Pais',
));
$conn->insert("Customers", array(
'CustomerID' => 70,
'CompanyName' => 'Baldwin Museum of Science',
'FirstName' => 'Roger',
'LastName' => 'Harui',
));
$conn->insert("Customers", array(
'CustomerID' => 80,
'CompanyName' => 'Blue Yonder Airlines',
'FirstName' => 'Pilar',
'LastName' => 'Pinilla',
));
$conn->insert("Customers", array(
'CustomerID' => 90,
'CompanyName' => 'City Power & Light',
'FirstName' => 'Kari',
'LastName' => 'Hensien',
));
$conn->insert("Customers", array(
'CustomerID' => 100,
'CompanyName' => 'Coho Winery',
'FirstName' => 'Peter',
'LastName' => 'Brehm',
));
$conn->executeUpdate("
DECLARE @orderId INT
DECLARE @customerId INT
SET @orderId = 10
SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Hensien' and FirstName = 'Kari'
INSERT INTO Orders (CustomerId, OrderId, OrderDate)
VALUES (@customerId, @orderId, GetDate())
INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
VALUES (@customerId, @orderId, 388, 4)
SET @orderId = 20
SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Harui' and FirstName = 'Roger'
INSERT INTO Orders (CustomerId, OrderId, OrderDate)
VALUES (@customerId, @orderId, GetDate())
INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
VALUES (@customerId, @orderId, 389, 2)
SET @orderId = 30
SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Brehm' and FirstName = 'Peter'
INSERT INTO Orders (CustomerId, OrderId, OrderDate)
VALUES (@customerId, @orderId, GetDate())
INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
VALUES (@customerId, @orderId, 387, 3)
SET @orderId = 40
SELECT @customerId = CustomerId FROM Customers WHERE LastName = 'Pais' and FirstName = 'Wilson'
INSERT INTO Orders (CustomerId, OrderId, OrderDate)
VALUES (@customerId, @orderId, GetDate())
INSERT INTO OrderItems (CustomerID, OrderID, ProductID, Quantity)
VALUES (@customerId, @orderId, 388, 1)");
<?php
// insert_data_aftersplit.php
require_once 'bootstrap.php';
$newCustomerId = 55;
$shardManager->selectShard($newCustomerId);
$conn->insert("Customers", array(
"CustomerID" => $newCustomerId,
"CompanyName" => "Microsoft",
"FirstName" => "Brian",
"LastName" => "Swan",
));
$conn->insert("Orders", array(
"CustomerID" => 55,
"OrderID" => 37,
"OrderDate" => date('Y-m-d H:i:s'),
));
$conn->insert("OrderItems", array(
"CustomerID" => 55,
"OrderID" => 37,
"ProductID" => 387,
"Quantity" => 1,
));
<?php
// query_filtering_off.php
require_once "bootstrap.php";
$shardManager->selectShard(0);
$data = $conn->fetchAll('SELECT * FROM Customers');
print_r($data);
<?php
// query_filtering_on.php
require_once "bootstrap.php";
$shardManager->setFilteringEnabled(true);
$shardManager->selectShard(55);
$data = $conn->fetchAll('SELECT * FROM Customers');
print_r($data);
<?php
// split_federation.php
require_once 'bootstrap.php';
$shardManager->splitFederation(60);
<?php
// view_federation_members.php
require_once "bootstrap.php";
$shards = $shardManager->getShards();
foreach ($shards as $shard) {
print_r($shard);
}
......@@ -6,9 +6,6 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform;
use Doctrine\DBAL\Platforms\PostgreSQL91Platform;
use Doctrine\DBAL\Platforms\PostgreSQL92Platform;
use Doctrine\DBAL\Platforms\PostgreSQL94Platform;
use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
use Doctrine\DBAL\Schema\PostgreSqlSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
......@@ -24,7 +21,7 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html
* @link http://www.postgresql.org/docs/9.4/static/errcodes-appendix.html
*/
public function convertException($message, DriverException $exception)
{
......@@ -95,18 +92,11 @@ abstract class AbstractPostgreSQLDriver implements ExceptionConverterDriver, Ver
$patchVersion = $versionParts['patch'] ?? 0;
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion;
switch (true) {
case version_compare($version, '10.0', '>='):
return new PostgreSQL100Platform();
case version_compare($version, '9.4', '>='):
return new PostgreSQL94Platform();
case version_compare($version, '9.2', '>='):
return new PostgreSQL92Platform();
case version_compare($version, '9.1', '>='):
return new PostgreSQL91Platform();
default:
return new PostgreSqlPlatform();
if (version_compare($version, '10.0', '>=')) {
return new PostgreSQL100Platform();
}
return new PostgreSqlPlatform();
}
/**
......
......@@ -5,14 +5,10 @@ namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere12Platform;
use Doctrine\DBAL\Platforms\SQLAnywhere16Platform;
use Doctrine\DBAL\Platforms\SQLAnywherePlatform;
use Doctrine\DBAL\Schema\SQLAnywhereSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use function preg_match;
use function version_compare;
/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for SAP Sybase SQL Anywhere based drivers.
......@@ -87,12 +83,6 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion;
switch (true) {
case version_compare($version, '16', '>='):
return new SQLAnywhere16Platform();
case version_compare($version, '12', '>='):
return new SQLAnywhere12Platform();
case version_compare($version, '11', '>='):
return new SQLAnywhere11Platform();
default:
return new SQLAnywherePlatform();
}
......@@ -113,7 +103,7 @@ abstract class AbstractSQLAnywhereDriver implements ExceptionConverterDriver, Ve
*/
public function getDatabasePlatform()
{
return new SQLAnywhere12Platform();
return new SQLAnywherePlatform();
}
/**
......
......@@ -3,55 +3,15 @@
namespace Doctrine\DBAL\Driver;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\SQLServer2005Platform;
use Doctrine\DBAL\Platforms\SQLServer2008Platform;
use Doctrine\DBAL\Platforms\SQLServer2012Platform;
use Doctrine\DBAL\Driver;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
use Doctrine\DBAL\Schema\SQLServerSchemaManager;
use Doctrine\DBAL\VersionAwarePlatformDriver;
use function preg_match;
use function version_compare;
/**
* Abstract base implementation of the {@link Doctrine\DBAL\Driver} interface for Microsoft SQL Server based drivers.
*/
abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
abstract class AbstractSQLServerDriver implements Driver
{
/**
* {@inheritdoc}
*/
public function createDatabasePlatformForVersion($version)
{
if (! preg_match(
'/^(?P<major>\d+)(?:\.(?P<minor>\d+)(?:\.(?P<patch>\d+)(?:\.(?P<build>\d+))?)?)?/',
$version,
$versionParts
)) {
throw DBALException::invalidPlatformVersionSpecified(
$version,
'<major_version>.<minor_version>.<patch_version>.<build_version>'
);
}
$majorVersion = $versionParts['major'];
$minorVersion = $versionParts['minor'] ?? 0;
$patchVersion = $versionParts['patch'] ?? 0;
$buildVersion = $versionParts['build'] ?? 0;
$version = $majorVersion . '.' . $minorVersion . '.' . $patchVersion . '.' . $buildVersion;
switch (true) {
case version_compare($version, '11.00.2100', '>='):
return new SQLServer2012Platform();
case version_compare($version, '10.00.1600', '>='):
return new SQLServer2008Platform();
case version_compare($version, '9.00.1399', '>='):
return new SQLServer2005Platform();
default:
return new SQLServerPlatform();
}
}
/**
* {@inheritdoc}
*/
......@@ -67,7 +27,7 @@ abstract class AbstractSQLServerDriver implements VersionAwarePlatformDriver
*/
public function getDatabasePlatform()
{
return new SQLServer2008Platform();
return new SQLServerPlatform();
}
/**
......
<?php
namespace Doctrine\DBAL\Driver\DrizzlePDOMySql;
use Doctrine\DBAL\Driver\PDOConnection;
use Doctrine\DBAL\ParameterType;
/**
* @deprecated
*/
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.
*
* @deprecated
*/
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';
}
}
<?php
namespace Doctrine\DBAL\Driver\PDOIbm;
use Doctrine\DBAL\Driver\AbstractDB2Driver;
use Doctrine\DBAL\Driver\PDOConnection;
/**
* Driver for the PDO IBM extension.
*
* @deprecated Use the driver based on the ibm_db2 extension instead.
*/
class Driver extends AbstractDB2Driver
{
/**
* {@inheritdoc}
*/
public function connect(array $params, $username = null, $password = null, array $driverOptions = [])
{
return new PDOConnection(
$this->_constructPdoDsn($params),
$username,
$password,
$driverOptions
);
}
/**
* Constructs the IBM PDO DSN.
*
* @param mixed[] $params
*
* @return string The DSN.
*/
private function _constructPdoDsn(array $params)
{
$dsn = 'ibm:';
if (isset($params['host'])) {
$dsn .= 'HOSTNAME=' . $params['host'] . ';';
}
if (isset($params['port'])) {
$dsn .= 'PORT=' . $params['port'] . ';';
}
$dsn .= 'PROTOCOL=TCPIP;';
if (isset($params['dbname'])) {
$dsn .= 'DATABASE=' . $params['dbname'] . ';';
}
return $dsn;
}
/**
* {@inheritdoc}
*
* @deprecated
*/
public function getName()
{
return 'pdo_ibm';
}
}
......@@ -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;
......@@ -51,7 +50,6 @@ final class DriverManager
'ibm_db2' => DB2Driver::class,
'pdo_sqlsrv' => PDOSQLSrvDriver::class,
'mysqli' => MySQLiDriver::class,
'drizzle_pdo_mysql' => DrizzlePDOMySQLDriver::class,
'sqlanywhere' => SQLAnywhereDriver::class,
'sqlsrv' => SQLSrvDriver::class,
];
......@@ -146,17 +144,6 @@ final class DriverManager
}
}
// URL support for PoolingShardConnection
if (isset($params['global'])) {
$params['global'] = self::parseDatabaseUrl($params['global']);
}
if (isset($params['shards'])) {
foreach ($params['shards'] as $key => $shardParams) {
$params['shards'][$key] = self::parseDatabaseUrl($shardParams);
}
}
self::_checkParams($params);
$className = $params['driverClass'] ?? self::$_driverMap[$params['driver']];
......
......@@ -74,21 +74,21 @@ class DB2Platform extends AbstractPlatform
public function initializeDoctrineTypeMappings()
{
$this->doctrineTypeMapping = [
'smallint' => 'smallint',
'bigint' => 'bigint',
'integer' => 'integer',
'time' => 'time',
'date' => 'date',
'varchar' => 'string',
'character' => 'string',
'varbinary' => 'binary',
'binary' => 'binary',
'clob' => 'text',
'blob' => 'blob',
'decimal' => 'decimal',
'double' => 'float',
'real' => 'float',
'timestamp' => 'datetime',
'bigint' => 'bigint',
'binary' => 'binary',
'blob' => 'blob',
'character' => 'string',
'clob' => 'text',
'date' => 'date',
'decimal' => 'decimal',
'double' => 'float',
'integer' => 'integer',
'real' => 'float',
'smallint' => 'smallint',
'time' => 'time',
'timestamp' => 'datetime',
'varbinary' => 'binary',
'varchar' => 'string',
];
}
......
This diff is collapsed.
......@@ -27,24 +27,6 @@ class DB2Keywords extends KeywordList
'ALIAS',
'ALL',
'ALLOCATE',
'DOCUMENT',
'DOUBLE',
'DROP',
'DSSIZE',
'DYNAMIC',
'EACH',
'LOCK',
'LOCKMAX',
'LOCKSIZE',
'LONG',
'LOOP',
'MAINTAINED',
'ROUND_CEILING',
'ROUND_DOWN',
'ROUND_FLOOR',
'ROUND_HALF_DOWN',
'ROUND_HALF_EVEN',
'ROUND_HALF_UP',
'ALLOW',
'ALTER',
'AND',
......@@ -112,6 +94,38 @@ class DB2Keywords extends KeywordList
'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',
......@@ -179,6 +193,38 @@ class DB2Keywords extends KeywordList
'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',
......@@ -246,6 +292,37 @@ class DB2Keywords extends KeywordList
'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',
......@@ -313,107 +390,30 @@ class DB2Keywords extends KeywordList
'UNIQUE',
'UNTIL',
'UPDATE',
'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',
'INTERSECT',
'PUBLIC',
'USAGE',
'INTO',
'QUERY',
'USER',
'IS',
'QUERYNO',
'USING',
'ISOBID',
'RANGE',
'VALIDPROC',
'ISOLATION',
'RANK',
'VALUE',
'ITERATE',
'READ',
'VALUES',
'JAR',
'READS',
'VARIABLE',
'JAVA',
'RECOVERY',
'VARIANT',
'JOIN',
'REFERENCES',
'VCAT',
'KEEP',
'REFERENCING',
'VERSION',
'KEY',
'REFRESH',
'VIEW',
'LABEL',
'RELEASE',
'VOLATILE',
'LANGUAGE',
'RENAME',
'VOLUMES',
'LATERAL',
'REPEAT',
'WHEN',
'LC_CTYPE',
'RESET',
'WHENEVER',
'LEAVE',
'RESIGNAL',
'WHERE',
'LEFT',
'RESTART',
'WHILE',
'LIKE',
'RESTRICT',
'WITH',
'LINKTYPE',
'RESULT',
'WITHOUT',
'LOCAL',
'RESULT_SET_LOCATOR WLM',
'LOCALDATE',
'RETURN',
'WRITE',
'LOCALE',
'RETURNS',
'XMLELEMENT',
'LOCALTIME',
'REVOKE',
'XMLEXISTS',
'LOCALTIMESTAMP RIGHT',
'XMLNAMESPACES',
'LOCATOR',
'ROLE',
'YEAR',
'LOCATORS',
'ROLLBACK',
'YEARS',
];
}
......
<?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',
];
}
}
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* MsSQL Keywordlist
*
* @deprecated Use SQLServerKeywords class instead.
*
* @link www.doctrine-project.com
*/
class MsSQLKeywords extends SQLServerKeywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'MsSQL';
}
}
......@@ -22,118 +22,118 @@ class OracleKeywords extends KeywordList
{
return [
'ACCESS',
'ELSE',
'MODIFY',
'START',
'ADD',
'EXCLUSIVE',
'NOAUDIT',
'SELECT',
'ALL',
'EXISTS',
'NOCOMPRESS',
'SESSION',
'ALTER',
'FILE',
'NOT',
'SET',
'AND',
'FLOAT',
'NOTFOUND ',
'SHARE',
'ANY',
'FOR',
'NOWAIT',
'SIZE',
'ARRAYLEN',
'FROM',
'NULL',
'SMALLINT',
'AS',
'GRANT',
'NUMBER',
'SQLBUF',
'ASC',
'GROUP',
'OF',
'SUCCESSFUL',
'AUDIT',
'HAVING',
'OFFLINE ',
'SYNONYM',
'BETWEEN',
'IDENTIFIED',
'ON',
'SYSDATE',
'BY',
'IMMEDIATE',
'ONLINE',
'TABLE',
'CHAR',
'IN',
'OPTION',
'THEN',
'CHECK',
'INCREMENT',
'OR',
'TO',
'CLUSTER',
'INDEX',
'ORDER',
'TRIGGER',
'COLUMN',
'INITIAL',
'PCTFREE',
'UID',
'COMMENT',
'INSERT',
'PRIOR',
'UNION',
'COMPRESS',
'INTEGER',
'PRIVILEGES',
'UNIQUE',
'CONNECT',
'INTERSECT',
'PUBLIC',
'UPDATE',
'CREATE',
'INTO',
'RAW',
'USER',
'CURRENT',
'IS',
'RENAME',
'VALIDATE',
'DATE',
'LEVEL',
'RESOURCE',
'VALUES',
'DECIMAL',
'LIKE',
'REVOKE',
'VARCHAR',
'DEFAULT',
'LOCK',
'ROW',
'VARCHAR2',
'DELETE',
'LONG',
'ROWID',
'VIEW',
'DESC',
'MAXEXTENTS',
'ROWLABEL',
'WHENEVER',
'DISTINCT',
'MINUS',
'ROWNUM',
'WHERE',
'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',
'RANGE',
];
}
}
......@@ -7,7 +7,7 @@ namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL 10.0 reserved keywords list.
*/
class PostgreSQL100Keywords extends PostgreSQL94Keywords
class PostgreSQL100Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
......
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL 9.1 reserved keywords list.
*/
class PostgreSQL91Keywords extends PostgreSQLKeywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL91';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.1/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return [
'ALL',
'ANALYSE',
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BINARY',
'BOTH',
'CASE',
'CAST',
'CHECK',
'COLLATE',
'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',
'LEADING',
'LEFT',
'LIKE',
'LIMIT',
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NOT',
'NOTNULL',
'NULL',
'OFFSET',
'ON',
'ONLY',
'OR',
'ORDER',
'OUTER',
'OVER',
'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',
];
}
}
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_merge;
/**
* PostgreSQL 9.2 reserved keywords list.
*/
class PostgreSQL92Keywords extends PostgreSQL91Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL92';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.2/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), ['COLLATION']);
}
}
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_diff;
use function array_merge;
/**
* PostgreSQL 9.4 reserved keywords list.
*/
class PostgreSQL94Keywords extends PostgreSQL92Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'PostgreSQL94';
}
/**
* {@inheritdoc}
*
* @link http://www.postgresql.org/docs/9.4/static/sql-keywords-appendix.html
*/
protected function getKeywords()
{
$parentKeywords = array_diff(parent::getKeywords(), ['OVER']);
return array_merge($parentKeywords, ['LATERAL']);
}
}
......@@ -3,7 +3,7 @@
namespace Doctrine\DBAL\Platforms\Keywords;
/**
* PostgreSQL Keywordlist.
* PostgreSQL keywords list.
*/
class PostgreSQLKeywords extends KeywordList
{
......@@ -26,20 +26,27 @@ class PostgreSQLKeywords extends KeywordList
'ANALYZE',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ASYMMETRIC',
'AUTHORIZATION',
'BETWEEN',
'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',
......@@ -52,6 +59,7 @@ class PostgreSQLKeywords extends KeywordList
'END',
'EXCEPT',
'FALSE',
'FETCH',
'FOR',
'FOREIGN',
'FREEZE',
......@@ -69,6 +77,7 @@ class PostgreSQLKeywords extends KeywordList
'IS',
'ISNULL',
'JOIN',
'LATERAL',
'LEADING',
'LEFT',
'LIKE',
......@@ -76,13 +85,10 @@ class PostgreSQLKeywords extends KeywordList
'LOCALTIME',
'LOCALTIMESTAMP',
'NATURAL',
'NEW',
'NOT',
'NOTNULL',
'NULL',
'OFF',
'OFFSET',
'OLD',
'ON',
'ONLY',
'OR',
......@@ -92,10 +98,13 @@ class PostgreSQLKeywords extends KeywordList
'PLACING',
'PRIMARY',
'REFERENCES',
'RETURNING',
'RIGHT',
'SELECT',
'SESSION_USER',
'SIMILAR',
'SOME',
'SYMMETRIC',
'TABLE',
'THEN',
'TO',
......@@ -105,9 +114,12 @@ class PostgreSQLKeywords extends KeywordList
'UNIQUE',
'USER',
'USING',
'VARIADIC',
'VERBOSE',
'WHEN',
'WHERE',
'WINDOW',
'WITH',
];
}
}
......@@ -28,6 +28,7 @@ class SQLAnywhereKeywords extends KeywordList
'ALTER',
'AND',
'ANY',
'ARRAY',
'AS',
'ASC',
'ATTACH',
......@@ -68,6 +69,7 @@ class SQLAnywhereKeywords extends KeywordList
'CURRENT_USER',
'CURSOR',
'DATE',
'DATETIMEOFFSET',
'DBSPACE',
'DEALLOCATE',
'DEC',
......@@ -114,7 +116,6 @@ class SQLAnywhereKeywords extends KeywordList
'IF',
'IN',
'INDEX',
'INDEX_LPAREN',
'INNER',
'INOUT',
'INSENSITIVE',
......@@ -127,20 +128,22 @@ class SQLAnywhereKeywords extends KeywordList
'INTEGRATED',
'INTERSECT',
'INTO',
'IQ',
'IS',
'ISOLATION',
'JOIN',
'JSON',
'KERBEROS',
'KEY',
'LATERAL',
'LEFT',
'LIKE',
'LIMIT',
'LOCK',
'LOGIN',
'LONG',
'MATCH',
'MEMBERSHIP',
'MERGE',
'MESSAGE',
'MODE',
'MODIFY',
......@@ -158,6 +161,8 @@ class SQLAnywhereKeywords extends KeywordList
'OFF',
'ON',
'OPEN',
'OPENSTRING',
'OPENXML',
'OPTION',
'OPTIONS',
'OR',
......@@ -194,6 +199,8 @@ class SQLAnywhereKeywords extends KeywordList
'RIGHT',
'ROLLBACK',
'ROLLUP',
'ROW',
'ROWTYPE',
'SAVE',
'SAVEPOINT',
'SCROLL',
......@@ -205,6 +212,7 @@ class SQLAnywhereKeywords extends KeywordList
'SHARE',
'SMALLINT',
'SOME',
'SPATIAL',
'SQLCODE',
'SQLSTATE',
'START',
......@@ -212,7 +220,6 @@ class SQLAnywhereKeywords extends KeywordList
'SUBTRANS',
'SUBTRANSACTION',
'SYNCHRONIZE',
'SYNTAX_ERROR',
'TABLE',
'TEMPORARY',
'THEN',
......@@ -222,6 +229,7 @@ class SQLAnywhereKeywords extends KeywordList
'TO',
'TOP',
'TRAN',
'TREAT',
'TRIGGER',
'TRUNCATE',
'TSEQUAL',
......@@ -230,6 +238,7 @@ class SQLAnywhereKeywords extends KeywordList
'UNIQUE',
'UNIQUEIDENTIFIER',
'UNKNOWN',
'UNNEST',
'UNSIGNED',
'UPDATE',
'UPDATING',
......@@ -241,6 +250,7 @@ class SQLAnywhereKeywords extends KeywordList
'VARBIT',
'VARCHAR',
'VARIABLE',
'VARRAY',
'VARYING',
'VIEW',
'WAIT',
......@@ -250,9 +260,6 @@ class SQLAnywhereKeywords extends KeywordList
'WHILE',
'WINDOW',
'WITH',
'WITH_CUBE',
'WITH_LPAREN',
'WITH_ROLLUP',
'WITHIN',
'WORK',
'WRITETEXT',
......
<?php
namespace Doctrine\DBAL\Platforms\Keywords;
use function array_merge;
/**
* Microsoft SQL Server 2012 reserved keyword dictionary.
*
* @link www.doctrine-project.com
*/
class SQLServer2012Keywords extends SQLServer2008Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'SQLServer2012';
}
/**
* {@inheritdoc}
*
* @link http://msdn.microsoft.com/en-us/library/ms189822.aspx
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), [
'SEMANTICKEYPHRASETABLE',
'SEMANTICSIMILARITYDETAILSTABLE',
'SEMANTICSIMILARITYTABLE',
'TRY_CONVERT',
'WITHIN GROUP',
]);
}
}
......@@ -121,6 +121,7 @@ class SQLServerKeywords extends KeywordList
'LIKE',
'LINENO',
'LOAD',
'MERGE',
'NATIONAL',
'NOCHECK ',
'NONCLUSTERED',
......@@ -170,6 +171,9 @@ class SQLServerKeywords extends KeywordList
'SCHEMA',
'SECURITYAUDIT',
'SELECT',
'SEMANTICKEYPHRASETABLE',
'SEMANTICSIMILARITYDETAILSTABLE',
'SEMANTICSIMILARITYTABLE',
'SESSION_USER',
'SET',
'SETUSER',
......@@ -187,6 +191,7 @@ class SQLServerKeywords extends KeywordList
'TRANSACTION',
'TRIGGER',
'TRUNCATE',
'TRY_CONVERT',
'TSEQUAL',
'UNION',
'UNIQUE',
......@@ -203,6 +208,7 @@ class SQLServerKeywords extends KeywordList
'WHERE',
'WHILE',
'WITH',
'WITHIN GROUP',
'WRITETEXT',
];
}
......
......@@ -1055,36 +1055,36 @@ SQL
protected function initializeDoctrineTypeMappings()
{
$this->doctrineTypeMapping = [
'tinyint' => 'boolean',
'smallint' => 'smallint',
'mediumint' => 'integer',
'int' => 'integer',
'integer' => 'integer',
'bigint' => 'bigint',
'tinytext' => 'text',
'mediumtext' => 'text',
'longtext' => 'text',
'text' => 'text',
'varchar' => 'string',
'string' => 'string',
'char' => 'string',
'date' => 'date',
'datetime' => 'datetime',
'timestamp' => 'datetime',
'time' => 'time',
'float' => 'float',
'double' => 'float',
'real' => 'float',
'decimal' => 'decimal',
'numeric' => 'decimal',
'year' => 'date',
'longblob' => 'blob',
'blob' => 'blob',
'mediumblob' => 'blob',
'tinyblob' => 'blob',
'binary' => 'binary',
'varbinary' => 'binary',
'set' => 'simple_array',
'bigint' => 'bigint',
'binary' => 'binary',
'blob' => 'blob',
'char' => 'string',
'date' => 'date',
'datetime' => 'datetime',
'decimal' => 'decimal',
'double' => 'float',
'float' => 'float',
'int' => 'integer',
'integer' => 'integer',
'longblob' => 'blob',
'longtext' => 'text',
'mediumblob' => 'blob',
'mediumint' => 'integer',
'mediumtext' => 'text',
'numeric' => 'decimal',
'real' => 'float',
'set' => 'simple_array',
'smallint' => 'smallint',
'string' => 'string',
'text' => 'text',
'time' => 'time',
'timestamp' => 'datetime',
'tinyblob' => 'blob',
'tinyint' => 'boolean',
'tinytext' => 'text',
'varbinary' => 'binary',
'varchar' => 'string',
'year' => 'date',
];
}
......
......@@ -1133,29 +1133,29 @@ SQL
protected function initializeDoctrineTypeMappings()
{
$this->doctrineTypeMapping = [
'integer' => 'integer',
'number' => 'integer',
'pls_integer' => 'boolean',
'binary_integer' => 'boolean',
'varchar' => 'string',
'varchar2' => 'string',
'nvarchar2' => 'string',
'char' => 'string',
'nchar' => 'string',
'date' => 'date',
'timestamp' => 'datetime',
'timestamptz' => 'datetimetz',
'float' => 'float',
'binary_float' => 'float',
'binary_double' => 'float',
'long' => 'string',
'clob' => 'text',
'nclob' => 'text',
'raw' => 'binary',
'long raw' => 'blob',
'rowid' => 'string',
'urowid' => 'string',
'blob' => 'blob',
'binary_double' => 'float',
'binary_float' => 'float',
'binary_integer' => 'boolean',
'blob' => 'blob',
'char' => 'string',
'clob' => 'text',
'date' => 'date',
'float' => 'float',
'integer' => 'integer',
'long' => 'string',
'long raw' => 'blob',
'nchar' => 'string',
'nclob' => 'text',
'number' => 'integer',
'nvarchar2' => 'string',
'pls_integer' => 'boolean',
'raw' => 'binary',
'rowid' => 'string',
'timestamp' => 'datetime',
'timestamptz' => 'datetimetz',
'urowid' => 'string',
'varchar' => 'string',
'varchar2' => 'string',
];
}
......
......@@ -9,7 +9,7 @@ use Doctrine\DBAL\Platforms\Keywords\PostgreSQL100Keywords;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 10.0 database platform.
*/
class PostgreSQL100Platform extends PostgreSQL94Platform
class PostgreSQL100Platform extends PostgreSqlPlatform
{
/**
* {@inheritdoc}
......
<?php
namespace Doctrine\DBAL\Platforms;
use function explode;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.1 database platform.
*
* @deprecated Use PostgreSQL 9.4 or newer
*/
class PostgreSQL91Platform extends PostgreSqlPlatform
{
/**
* {@inheritDoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL91Keywords::class;
}
/**
* {@inheritDoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritDoc}
*/
public function getListTableColumnsSQL($table, $database = null)
{
$sql = parent::getListTableColumnsSQL($table, $database);
$parts = explode('AS complete_type,', $sql, 2);
return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1];
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Types;
use function sprintf;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.2 database platform.
*
* @deprecated Use PostgreSQL 9.4 or newer
*/
class PostgreSQL92Platform extends PostgreSQL91Platform
{
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
return 'JSON';
}
/**
* {@inheritdoc}
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return parent::getSmallIntTypeDeclarationSQL($field);
}
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL92Keywords::class;
}
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['json'] = Types::JSON;
}
/**
* {@inheritdoc}
*/
public function getCloseActiveDatabaseConnectionsSQL($database)
{
return sprintf(
'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
$this->quoteStringLiteral($database)
);
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Types\Types;
/**
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4 database platform.
*/
class PostgreSQL94Platform extends PostgreSQL92Platform
{
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
if (! empty($field['jsonb'])) {
return 'JSONB';
}
return 'JSON';
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\PostgreSQL94Keywords::class;
}
/**
* {@inheritdoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['jsonb'] = Types::JSON;
}
}
......@@ -33,9 +33,7 @@ use function strtolower;
use function trim;
/**
* PostgreSqlPlatform.
*
* @deprecated Use PostgreSQL 9.4 or newer
* Provides the behavior, features and SQL dialect of the PostgreSQL 9.4+ database platform.
*
* @todo Rename: PostgreSQLPlatform
*/
......@@ -394,6 +392,7 @@ SQL
quote_ident(a.attname) AS field,
t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
(SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
(SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
......@@ -454,7 +453,7 @@ SQL
*/
public function getCloseActiveDatabaseConnectionsSQL($database)
{
return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = '
return 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '
. $this->quoteStringLiteral($database);
}
......@@ -975,6 +974,10 @@ SQL
*/
public function getSmallIntTypeDeclarationSQL(array $field)
{
if (! empty($field['autoincrement'])) {
return 'SMALLSERIAL';
}
return 'SMALLINT';
}
......@@ -1124,45 +1127,47 @@ SQL
protected function initializeDoctrineTypeMappings()
{
$this->doctrineTypeMapping = [
'smallint' => 'smallint',
'int2' => 'smallint',
'serial' => 'integer',
'serial4' => 'integer',
'int' => 'integer',
'int4' => 'integer',
'integer' => 'integer',
'bigserial' => 'bigint',
'serial8' => 'bigint',
'bigint' => 'bigint',
'int8' => 'bigint',
'bool' => 'boolean',
'boolean' => 'boolean',
'text' => 'text',
'tsvector' => 'text',
'varchar' => 'string',
'interval' => 'string',
'_varchar' => 'string',
'char' => 'string',
'bpchar' => 'string',
'inet' => 'string',
'date' => 'date',
'datetime' => 'datetime',
'timestamp' => 'datetime',
'timestamptz' => 'datetimetz',
'time' => 'time',
'timetz' => 'time',
'float' => 'float',
'float4' => 'float',
'float8' => 'float',
'double' => 'float',
'bigint' => 'bigint',
'bigserial' => 'bigint',
'bool' => 'boolean',
'boolean' => 'boolean',
'bpchar' => 'string',
'bytea' => 'blob',
'char' => 'string',
'date' => 'date',
'datetime' => 'datetime',
'decimal' => 'decimal',
'double' => 'float',
'double precision' => 'float',
'real' => 'float',
'decimal' => 'decimal',
'money' => 'decimal',
'numeric' => 'decimal',
'year' => 'date',
'uuid' => 'guid',
'bytea' => 'blob',
'float' => 'float',
'float4' => 'float',
'float8' => 'float',
'inet' => 'string',
'int' => 'integer',
'int2' => 'smallint',
'int4' => 'integer',
'int8' => 'bigint',
'integer' => 'integer',
'interval' => 'string',
'json' => Type::JSON,
'jsonb' => Type::JSON,
'money' => 'decimal',
'numeric' => 'decimal',
'serial' => 'integer',
'serial4' => 'integer',
'serial8' => 'bigint',
'real' => 'float',
'smallint' => 'smallint',
'text' => 'text',
'time' => 'time',
'timestamp' => 'datetime',
'timestamptz' => 'datetimetz',
'timetz' => 'time',
'tsvector' => 'text',
'uuid' => 'guid',
'varchar' => 'string',
'year' => 'date',
'_varchar' => 'string',
];
}
......@@ -1190,6 +1195,14 @@ SQL
return 0;
}
/**
* {@inheritdoc}
*/
public function hasNativeJsonType()
{
return true;
}
/**
* {@inheritDoc}
*/
......@@ -1218,6 +1231,34 @@ SQL
return parent::getDefaultValueDeclarationSQL($field);
}
/**
* {@inheritdoc}
*/
public function supportsColumnCollation()
{
return true;
}
/**
* {@inheritdoc}
*/
public function getColumnCollationDeclarationSQL($collation)
{
return 'COLLATE ' . $this->quoteSingleIdentifier($collation);
}
/**
* {@inheritdoc}
*/
public function getJsonTypeDeclarationSQL(array $field)
{
if (! empty($field['jsonb'])) {
return 'JSONB';
}
return 'JSON';
}
/**
* @param mixed[] $field
*/
......
<?php
namespace Doctrine\DBAL\Platforms;
/**
* The SQLAnywhere11Platform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 11 database platform.
*
* @deprecated Use SQLAnywhere 16 or newer
*/
class SQLAnywhere11Platform extends SQLAnywherePlatform
{
/**
* {@inheritdoc}
*/
public function getRegexpExpression()
{
return 'REGEXP';
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\SQLAnywhere11Keywords::class;
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Sequence;
/**
* The SQLAnywhere12Platform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 12 database platform.
*
* @deprecated Use SQLAnywhere 16 or newer
*/
class SQLAnywhere12Platform extends SQLAnywhere11Platform
{
/**
* {@inheritdoc}
*/
public function getCreateSequenceSQL(Sequence $sequence)
{
return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
' INCREMENT BY ' . $sequence->getAllocationSize() .
' START WITH ' . $sequence->getInitialValue() .
' MINVALUE ' . $sequence->getInitialValue();
}
/**
* {@inheritdoc}
*/
public function getAlterSequenceSQL(Sequence $sequence)
{
return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
' INCREMENT BY ' . $sequence->getAllocationSize();
}
/**
* {@inheritdoc}
*/
public function getDateTimeTzFormatString()
{
return 'Y-m-d H:i:s.uP';
}
/**
* {@inheritdoc}
*/
public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
{
return 'TIMESTAMP WITH TIME ZONE';
}
/**
* {@inheritdoc}
*/
public function getDropSequenceSQL($sequence)
{
if ($sequence instanceof Sequence) {
$sequence = $sequence->getQuotedName($this);
}
return 'DROP SEQUENCE ' . $sequence;
}
/**
* {@inheritdoc}
*/
public function getListSequencesSQL($database)
{
return 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE';
}
/**
* {@inheritdoc}
*/
public function getSequenceNextValSQL($sequenceName)
{
return 'SELECT ' . $sequenceName . '.NEXTVAL';
}
/**
* {@inheritdoc}
*/
public function supportsSequences()
{
return true;
}
/**
* {@inheritdoc}
*/
protected function getAdvancedIndexOptionsSQL(Index $index)
{
if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_not_distinct')) {
return ' WITH NULLS NOT DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
}
return parent::getAdvancedIndexOptionsSQL($index);
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\SQLAnywhere12Keywords::class;
}
/**
* {@inheritDoc}
*/
protected function initializeDoctrineTypeMappings()
{
parent::initializeDoctrineTypeMappings();
$this->doctrineTypeMapping['timestamp with time zone'] = 'datetime';
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Index;
use UnexpectedValueException;
/**
* The SQLAnywhere16Platform provides the behavior, features and SQL dialect of the
* SAP Sybase SQL Anywhere 16 database platform.
*/
class SQLAnywhere16Platform extends SQLAnywhere12Platform
{
/**
* {@inheritdoc}
*/
protected function getAdvancedIndexOptionsSQL(Index $index)
{
if ($index->hasFlag('with_nulls_distinct') && $index->hasFlag('with_nulls_not_distinct')) {
throw new UnexpectedValueException(
'An Index can either have a "with_nulls_distinct" or "with_nulls_not_distinct" flag but not both.'
);
}
if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_distinct')) {
return ' WITH NULLS DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
}
return parent::getAdvancedIndexOptionsSQL($index);
}
/**
* {@inheritdoc}
*/
protected function getReservedKeywordsClass()
{
return Keywords\SQLAnywhere16Keywords::class;
}
}
<?php
namespace Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Schema\Table;
/**
* Platform to ensure compatibility of Doctrine with SQL Azure
*
* On top of SQL Server 2008 the following functionality is added:
*
* - Create tables with the FEDERATED ON syntax.
*
* @deprecated
*/
class SQLAzurePlatform extends SQLServer2008Platform
{
/**
* {@inheritDoc}
*/
public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES)
{
$sql = parent::getCreateTableSQL($table, $createFlags);
if ($table->hasOption('azure.federatedOnColumnName')) {
$distributionName = $table->getOption('azure.federatedOnDistributionName');
$columnName = $table->getOption('azure.federatedOnColumnName');
$stmt = ' FEDERATED ON (' . $distributionName . ' = ' . $columnName . ')';
$sql[0] .= $stmt;
}
return $sql;
}
}
<?php
namespace Doctrine\DBAL\Platforms;
/**
* Platform to ensure compatibility of Doctrine with Microsoft SQL Server 2005 version and
* higher.
*
* Differences to SQL Server 2008 are:
*
* - DATETIME2 datatype does not exist, only DATETIME which has a precision of
* 3. This is not supported by PHP DateTime, so we are emulating it by
* setting .000 manually.
* - Starting with SQLServer2005 VARCHAR(MAX), VARBINARY(MAX) and
* NVARCHAR(max) replace the old TEXT, NTEXT and IMAGE types. See
* {@link http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx}
* for more information.
*
* @deprecated Use SQL Server 2012 or newer
*/
class SQLServer2005Platform extends SQLServerPlatform
{
/**
* {@inheritDoc}
*/
public function supportsLimitOffset()
{
return true;
}
/**
* {@inheritDoc}
*/
public function getClobTypeDeclarationSQL(array $field)
{
return 'VARCHAR(MAX)';
}
/**
* {@inheritdoc}
*
* Returns Microsoft SQL Server 2005 specific keywords class
*/
protected function getReservedKeywordsClass()
{
return Keywords\SQLServer2005Keywords::class;
}
}
......@@ -10,7 +10,7 @@ namespace Doctrine\DBAL\Platforms;
*
* @deprecated Use SQL Server 2012 or newer
*/
class SQLServer2008Platform extends SQLServer2005Platform
class SQLServer2008Platform extends SQLServerPlatform
{
/**
* {@inheritDoc}
......
This diff is collapsed.
......@@ -624,38 +624,38 @@ class SqlitePlatform extends AbstractPlatform
protected function initializeDoctrineTypeMappings()
{
$this->doctrineTypeMapping = [
'boolean' => 'boolean',
'tinyint' => 'boolean',
'smallint' => 'smallint',
'mediumint' => 'integer',
'int' => 'integer',
'integer' => 'integer',
'serial' => 'integer',
'bigint' => 'bigint',
'bigserial' => 'bigint',
'clob' => 'text',
'tinytext' => 'text',
'mediumtext' => 'text',
'longtext' => 'text',
'text' => 'text',
'varchar' => 'string',
'longvarchar' => 'string',
'varchar2' => 'string',
'nvarchar' => 'string',
'image' => 'string',
'ntext' => 'string',
'blob' => 'blob',
'boolean' => 'boolean',
'char' => 'string',
'clob' => 'text',
'date' => 'date',
'datetime' => 'datetime',
'timestamp' => 'datetime',
'time' => 'time',
'float' => 'float',
'decimal' => 'decimal',
'double' => 'float',
'double precision' => 'float',
'real' => 'float',
'decimal' => 'decimal',
'float' => 'float',
'image' => 'string',
'int' => 'integer',
'integer' => 'integer',
'longtext' => 'text',
'longvarchar' => 'string',
'mediumint' => 'integer',
'mediumtext' => 'text',
'ntext' => 'string',
'numeric' => 'decimal',
'blob' => 'blob',
'nvarchar' => 'string',
'real' => 'float',
'serial' => 'integer',
'smallint' => 'smallint',
'text' => 'text',
'time' => 'time',
'timestamp' => 'datetime',
'tinyint' => 'boolean',
'tinytext' => 'text',
'varchar' => 'string',
'varchar2' => 'string',
];
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment