zendframework/zf2 — pull request #7059 by hschletz (2014-12-19 13:58:48+00:00)
Title: Move common DB adapter platform functionality to a base class

The Zend\Db\Adapter\Platform classes are all implemented from scratch, resulting in a lot of duplicated code and making even simple changes needlessly complicated because they would need to be propagated across all platforms. This is unnecessary because most functionality is identical across multiple platforms.

One example would be a fix for #5160. The requested functionality is simple and portable, yet only implemented for some platforms. Fixing this without copying everything all over would be desirable.

I created an abstract class "AbstractSql92BasedPlatform" which implements PlatformInterface except for getName(). It is mostly identical to the old Sql92 class. All platform classes extend this abstract class and implement only platform-specific differences. This results in a lot less code. It's also more flexible - implementing a new platform would become much simpler.

The changes are fully backward compatible - all methods are still in place and behave identically. The only difference is inheritance from the new base class.

I did not change the tests, though many tests would be redundant now. However, the existing tests are simple and document the full platform interface. I also ran the integration tests without problems, except for SqlServerIntegrationTest because I don't have a test platform available.