doctrine/dbal — pull request #293 by deeky666 (2013-03-28 13:45:33+00:00)
Title: Add SAP SQL Anywhere database vendor

This PR adds the driver and DBAL for SAP SQL Anywhere databases. It distinguishes between versions 10 and below (base SQLAnywherePlatform), 11 (SQLAnywhere11Platform) and 12 (SQLAnywherer12Platform), similar to Microsoft SQL Server.
Most of the functional tests pass but there are some exceptions:

* DataAccessTest::testFetchAllWithTypes

Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'2010-01-01 10:10:10'
+'2010-01-01 10:10:10.000'

The test is not aware of the datetime format string of the platform, which differs in SQL Anywhere. Therefore it fails. In SQL Anywhere a datetime is stored with second fractions by default.
IMO I have two options here. Changing the default timestamp format for data output in the driver on every connection so that it fits Y-m-d H:i:s and changing the date format strings in the platforms or modifying the test to be aware of the platform specific datetime format.

* MasterSlaveConnectionTest::testKeepSlaveBeginTransactionStaysOnMaster
The test simply hangs up here and I don't exactly know why. When I change the value for insert in line 95 to some other value than 30 it perfectly works. Any help would be appreciated here.

* ModifyLimitQueryTest::testModifyLimitQueryGroupBy

Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
-- 0 => 1
-- 1 => 2
++ 0 => 2
++ 1 => 1
)

The test does not tell the SELECT statement to order the result, thus the result is not deterministic and returns the results in wrong order.
IMO the test should be fixed so that the result is ordered correctly. Then the test will pass for SQL Anywhere.

* TemporaryTableTest

Exception: [Doctrine\DBAL\DBALException] An exception occurred while executing 'CREATE GLOBAL TEMPORARY TABLE temporary (id INT NOT NULL)':
SQLSTATE [42W04] [-131] Syntaxfehler bei 'temporary' in Zeile 1
With queries:
SQL: 'DROP TABLE temporary' Params:
SQL: 'CREATE GLOBAL TEMPORARY TABLE temporary (id INT NOT NULL)' Params:
SQL: 'DROP TABLE nontemporary' Params:

The tests use the unquoted keyword "temporary" reserved by SQL Anywhere for the temporary table name to create.
I cannot quote the name of the temporary table in the platform as the method getTemporaryTableName expects a string and not an instance of Doctrine\DBAL\Schema\Table as parameter.
Either the tests should use a non reserved keyword as temporary table name or the temporary table name has to be quoted in the platform (but I don't know exactly how).

* TemporaryTableTest::testDropTemporaryTableNotAutoCommitTransaction

In an event of an error this result has one row, because of an implicit commit.
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
Array (
++ 0 => Array (...)
)

The test fails because of an implicit commit during the transaction (drop temporary table) which inserts the first value. I couldn't find a solution for this problem. Seems to be the same problem as reported in [DDC-1337](http://www.doctrine-project.org/jira/browse/DDC-1337).

* WriteTest::testLastInsertIdNoSequenceGiven

Failed asserting that 14 is false.

I don't exactly know why the test expects the lastInsertId to be false here. Using the same connection for 14 inserts into a newly created autoincrement table should result in lastInsertId = 14 IMO. Is this a bug in the test? How do other vendors behave here?

I hope this addition is appreciated and any feedback/help on the above issues would be welcomed.