supporting-other-databases.rst 1.77 KB
Newer Older
1 2 3 4 5 6 7
Supporting Other Databases
==========================

To support a database which is not currently shipped with Doctrine
you have to implement the following interfaces and abstract
classes:

b0nd0's avatar
b0nd0 committed
8
-  ``\Doctrine\DBAL\Driver\Connection``
9
-  ``\Doctrine\DBAL\Driver\Statement``
b0nd0's avatar
b0nd0 committed
10
-  ``\Doctrine\DBAL\Driver``
11 12 13 14
-  ``\Doctrine\DBAL\Platforms\AbstractPlatform``
-  ``\Doctrine\DBAL\Schema\AbstractSchemaManager``

For an already supported platform but unsupported driver you only
b0nd0's avatar
b0nd0 committed
15
need to implement the first three interfaces, since the SQL
16 17 18 19 20 21 22 23 24 25 26 27
Generation and Schema Management is already supported by the
respective platform and schema instances. You can also make use of
several Abstract Unittests in the ``\Doctrine\Tests\DBAL`` package
to check if your platform behaves like all the others which is
necessary for SchemaTool support, namely:

-  ``\Doctrine\Tests\DBAL\Platforms\AbstractPlatformTestCase``
-  ``\Doctrine\Tests\DBAL\Functional\Schema\AbstractSchemaManagerTestCase``

We would be very happy if any support for new databases would be
contributed back to Doctrine to make it an even better product.

28 29 30 31 32
Implementation Steps in Detail
------------------------------

1. Add your driver shortcut to class-name `Doctrine\DBAL\DriverManager`.
2. Make a copy of tests/dbproperties.xml.dev and adjust the values to your driver shortcut and testdatabase.
b0nd0's avatar
b0nd0 committed
33
3. Create three new classes implementing ``\Doctrine\DBAL\Driver\Connection``, ``\Doctrine\DBAL\Driver\Statement``
34
   and ``Doctrine\DBAL\Driver``. You can take a look at the ``Doctrine\DBAL\Driver\OCI8`` driver.
Phil Davis's avatar
Phil Davis committed
35 36
4. You can run the testsuite of your new database driver by calling "phpunit -c .". You can set your own settings in the phpunit.xml file.
5. Start implementing AbstractPlatform and AbstractSchemaManager. Other implementations should serve as good examples.