Skip to content

Loading…

DBAL-707: [GH-447] Fix IBM DB2 implementation / ibm_db2 driver #1930

Closed
doctrinebot opened this Issue · 2 comments

2 participants

@doctrinebot

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of deeky666:

Url: #447

Message:

This PR is a first approach towards officially supporting IBM DB2 platform in DBAL. The current implementation of the platform and schema manager are very outdated, buggy and incomplete. There is no platform test case yet and running the general DBAL test suite shows a lot of errors.
The focus of this PR is to bring back the DB2 platform and schema manager into sync mit the abstract classes so that at least the test suite runs. Furthermore this PR adds a platform test case. Along with achieving this, a lot of bugs needed to be fixed. The following changes have been made:

  • Add support for \PDO::FETCH*CLASS and \PDO::FETCH_OBJ fetch modes in ibm*db2 driver
  • Optimize table indexes introspection (cleaner list SQL statement and codebase in schema manager)
  • Fix foreign key constraints introspection (also cleaned up codebase in schema manager)
  • Introduce BLOB type column support
  • Fix TRUNCATE TABLE statement generation
  • Fix SQL snippets for current date/time/timestamp constants
  • Add date arithmetic expressions
  • Fix bit operator expressions
  • Add support for portability connection
  • Fix default value declarations
  • Fix renaming columns
  • Fix renaming tables
  • Fix autoincrement column introspection
  • Fix required table reorganization after table alteration
  • Fix DROP DATABASE statement generation
  • Remove unnecessary method overrides in the platform
  • Add platform test case

The complete test suite now runs fine on ibm_db2 driver except for TypeConversionTest::testIdempotentDataConversion:

There was 1 failure:

1) Doctrine\Tests\DBAL\Functional\TypeConversionTest::testIdempotentDataConversion with data set #13 ('decimal', 1.55, 'string')
Conversion between values should produce the same out as in value, but doesnt!
Failed asserting that '1,55' matches expected 1.55.

/home/deeky/dev/doctrine/dbal/tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php:94

I have tried to find a solution for this issue but apparently this is a driver issue as the decimal separator seems to depend on the system's locale settings. Unfortunately there is no driver option where we could set the desired decimal separator. For now it seems we have to live with it and I guess it works on english locale systems.

The pdo_ibm driver reveals more problems as it is still buggy (for years now). The driver still segfaults on decoding CLOB/BLOB resources. So every test that uses BLOBs in any way does not run. The second issue I encountered was a test where a table is referenced quoted in a SELECT statement:

There was 1 error:

1) Doctrine\Tests\DBAL\Functional\DataAccessTest::testPrepareWithQuoted
Doctrine\DBAL\DBALException: An exception occurred while executing 'SELECT test*int, test_string FROM "fetch_table" WHERE test_int = '1' AND test*string = 'foo'':

SQLSTATE[42S02]: Base table or view not found: -204 [IBM][CLI Driver][DB2/LINUXX8664] SQL0204N  "DB2INST1.fetch_table" is an undefined name.  SQLSTATE=42704
 (SQLNumResultCols[-204] at /home/deeky/db2/PDO*IBM-1.3.3/ibm*driver.c:153)

/home/deeky/dev/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php:110
/home/deeky/dev/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:50
/home/deeky/dev/doctrine/dbal/lib/Doctrine/DBAL/Statement.php:86
/home/deeky/dev/doctrine/dbal/lib/Doctrine/DBAL/Connection.php:702
/home/deeky/dev/doctrine/dbal/tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php:154

This is weird and I couldn't find out why this does not work on pdo*ibm but works on ibm*db2.
Besides those issues pdo_ibm runs fine.

This PR does not make the IBM DB2 implementation perfect yet but it is a good start which is already usable. If we decide on officially supporting this vendor, I would do further work on this.

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-447] was closed:
#447

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.5 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.