Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SQL Server keyword dictionaries and MsSQL leftovers #272

Merged
merged 4 commits into from
Mar 12, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/en/reference/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ interfaces to use. It can be configured in one of three ways:

- ``driver``: The built-in driver implementation to use. The
following drivers are currently available:

- ``pdo_mysql``: A MySQL driver that uses the pdo\_mysql PDO
extension.
- ``pdo_sqlite``: An SQLite driver that uses the pdo\_sqlite PDO
Expand All @@ -47,7 +47,7 @@ interfaces to use. It can be configured in one of three ways:
- ``pdo_oci``: An Oracle driver that uses the pdo\_oci PDO
extension.
**Note that this driver caused problems in our tests. Prefer the oci8 driver if possible.**
- ``pdo_sqlsrv``: An MSSQL driver that uses pdo\_sqlsrv PDO
- ``pdo_sqlsrv``: A Microsoft SQL Server driver that uses pdo\_sqlsrv PDO
- ``oci8``: An Oracle driver that uses the oci8 PHP extension.

- ``driverClass``: Specifies a custom driver implementation if no
Expand Down
2 changes: 1 addition & 1 deletion docs/en/reference/portability.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Portability
There are often cases when you need to write an application or library that is portable
across multiple different database vendors. The Doctrine ORM is one example of such
a library. It is an abstraction layer over all the currently supported vendors (MySQL, Oracle,
PostgreSQL, SQLite and MSSQL). If you want to use the DBAL to write a portable application
PostgreSQL, SQLite and Microsoft SQL Server). If you want to use the DBAL to write a portable application
or library you have to follow lots of rules to make all the different vendors work the
same.

Expand Down
211 changes: 2 additions & 209 deletions lib/Doctrine/DBAL/Platforms/Keywords/MsSQLKeywords.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
* @author Benjamin Eberlei <kontakt@beberlei.de>
* @author David Coallier <davidc@php.net>
* @author Steve Müller <st.mueller@dzh-online.de>
* @deprecated Use SQLServerKeywords class instead.
*/
class MsSQLKeywords extends KeywordList
class MsSQLKeywords extends SQLServerKeywords
{
/**
* {@inheritdoc}
Expand All @@ -39,212 +40,4 @@ public function getName()
{
return 'MsSQL';
}

/**
* {@inheritdoc}
*/
protected function getKeywords()
{
return array(
'ADD',
'CURRENT_TIMESTAMP',
'GROUP',
'OPENQUERY',
'SERIALIZABLE',
'ALL',
'CURRENT_USER',
'HAVING',
'OPENROWSET',
'SESSION_USER',
'ALTER',
'CURSOR',
'HOLDLOCK',
'OPTION',
'SET',
'AND',
'DATABASE',
'IDENTITY',
'OR',
'SETUSER',
'ANY',
'DBCC',
'IDENTITYCOL',
'ORDER',
'SHUTDOWN',
'AS',
'DEALLOCATE',
'IDENTITY_INSERT',
'OUTER',
'SOME',
'ASC',
'DECLARE',
'IF',
'OVER',
'STATISTICS',
'AUTHORIZATION',
'DEFAULT',
'IN',
'PERCENT',
'SUM',
'AVG',
'DELETE',
'INDEX',
'PERM',
'SYSTEM_USER',
'BACKUP',
'DENY',
'INNER',
'PERMANENT',
'TABLE',
'BEGIN',
'DESC',
'INSERT',
'PIPE',
'TAPE',
'BETWEEN',
'DISK',
'INTERSECT',
'PLAN',
'TEMP',
'BREAK',
'DISTINCT',
'INTO',
'PRECISION',
'TEMPORARY',
'BROWSE',
'DISTRIBUTED',
'IS',
'PREPARE',
'TEXTSIZE',
'BULK',
'DOUBLE',
'ISOLATION',
'PRIMARY',
'THEN',
'BY',
'DROP',
'JOIN',
'PRINT',
'TO',
'CASCADE',
'DUMMY',
'KEY',
'PRIVILEGES',
'TOP',
'CASE',
'DUMP',
'KILL',
'PROC',
'TRAN',
'CHECK',
'ELSE',
'LEFT',
'PROCEDURE',
'TRANSACTION',
'CHECKPOINT',
'END',
'LEVEL',
'PROCESSEXIT',
'TRIGGER',
'CLOSE',
'ERRLVL',
'LIKE',
'PUBLIC',
'TRUNCATE',
'CLUSTERED',
'ERROREXIT',
'LINENO',
'RAISERROR',
'TSEQUAL',
'COALESCE',
'ESCAPE',
'LOAD',
'READ',
'UNCOMMITTED',
'COLUMN',
'EXCEPT',
'MAX',
'READTEXT',
'UNION',
'COMMIT',
'EXEC',
'MIN',
'RECONFIGURE',
'UNIQUE',
'COMMITTED',
'EXECUTE',
'MIRROREXIT',
'REFERENCES',
'UPDATE',
'COMPUTE',
'EXISTS',
'NATIONAL',
'REPEATABLE',
'UPDATETEXT',
'CONFIRM',
'EXIT',
'NOCHECK',
'REPLICATION',
'USE',
'CONSTRAINT',
'FETCH',
'NONCLUSTERED',
'RESTORE',
'USER',
'CONTAINS',
'FILE',
'NOT',
'RESTRICT',
'VALUES',
'CONTAINSTABLE',
'FILLFACTOR',
'NULL',
'RETURN',
'VARYING',
'CONTINUE',
'FLOPPY',
'NULLIF',
'REVOKE',
'VIEW',
'CONTROLROW',
'FOR',
'OF',
'RIGHT',
'WAITFOR',
'CONVERT',
'FOREIGN',
'OFF',
'ROLLBACK',
'WHEN',
'COUNT',
'FREETEXT',
'OFFSETS',
'ROWCOUNT',
'WHERE',
'CREATE',
'FREETEXTTABLE',
'ON',
'ROWGUIDCOL',
'WHILE',
'CROSS',
'FROM',
'ONCE',
'RULE',
'WITH',
'CURRENT',
'FULL',
'ONLY',
'SAVE',
'WORK',
'CURRENT_DATE',
'GOTO',
'OPEN',
'SCHEMA',
'WRITETEXT',
'CURRENT_TIME',
'GRANT',
'OPENDATASOURCE',
'SELECT'
);
}
}
56 changes: 56 additions & 0 deletions lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2005Keywords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\DBAL\Platforms\Keywords;

/**
* Microsoft SQL Server 2005 reserved keyword dictionary.
*
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @link www.doctrine-project.com
* @since 2.3
* @author Steve Müller <st.mueller@dzh-online.de>
*/
class SQLServer2005Keywords extends SQLServerKeywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'SQLServer2005';
}

/**
* {@inheritdoc}
*
* @link http://msdn.microsoft.com/en-US/library/ms189822%28v=sql.90%29.aspx
*/
protected function getKeywords()
{
return array_merge(array_diff(parent::getKeywords(), array('DUMMY')), array(
'EXTERNAL',
'PIVOT',
'REVERT',
'SECURITYAUDIT',
'TABLESAMPLE',
'UNPIVOT'
));
}
}
51 changes: 51 additions & 0 deletions lib/Doctrine/DBAL/Platforms/Keywords/SQLServer2008Keywords.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/

namespace Doctrine\DBAL\Platforms\Keywords;

/**
* Microsoft SQL Server 2008 reserved keyword dictionary.
*
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @link www.doctrine-project.com
* @since 2.3
* @author Steve Müller <st.mueller@dzh-online.de>
*/
class SQLServer2008Keywords extends SQLServer2005Keywords
{
/**
* {@inheritdoc}
*/
public function getName()
{
return 'SQLServer2008';
}

/**
* {@inheritdoc}
*
* @link http://msdn.microsoft.com/en-us/library/ms189822%28v=sql.100%29.aspx
*/
protected function getKeywords()
{
return array_merge(parent::getKeywords(), array(
'MERGE'
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
namespace Doctrine\DBAL\Platforms\Keywords;

/**
* SQL Server 2012 reserved keywords list.
* Microsoft SQL Server 2012 reserved keyword dictionary.
*
* @license BSD http://www.opensource.org/licenses/bsd-license.php
* @link www.doctrine-project.com
* @since 2.3
* @author Steve Müller <st.mueller@dzh-online.de>
*/
class SQLServer2012Keywords extends MsSQLKeywords
class SQLServer2012Keywords extends SQLServer2008Keywords
{
/**
* {@inheritdoc}
Expand All @@ -39,6 +39,8 @@ public function getName()

/**
* {@inheritdoc}
*
* @link http://msdn.microsoft.com/en-us/library/ms189822.aspx
*/
protected function getKeywords()
{
Expand All @@ -47,8 +49,7 @@ protected function getKeywords()
'SEMANTICSIMILARITYDETAILSTABLE',
'SEMANTICSIMILARITYTABLE',
'TRY_CONVERT',
'WITHIN',
'SEQUENCE'
'WITHIN GROUP'
));
}
}
Loading