Re: [zeta-dev] Issues Integrating ezcDbHandler into other code
On Aug 10, 2011, at 2:45 PM, Jerome Renard wrote: Hi Davy, On Tue, Aug 9, 2011 at 11:11 PM, Davey Shafik da...@php.net wrote: Hi, I'm having an issue with the reusability of the ezcDbHandler within my project. ezcDbHandler directly extends the internal PDO class; which when instantiated, represents the actual DB connection. This causes problems when I already have a connection. Specifically, the issue is that I wish to use ezcWorkflowDatabaseTiein, which requires an ezcDbHandler object in it's constructor. This is fine, except that in order to fulfill this requirement, I need to instantiate a /second/ connection to the DB with ezcDbHandler instead of re-using the PDO instance I already have elsewhere in my code. A solution to this is to make ezcDbHandler a facade for the PDO instance, and allow passing in an existing PDO instance instead of a DSN. The only backwards compatibility issue is that any code that currently does: [snip] You can find a readable patch for this relatively simple change here: https://gist.github.com/09c3ab355dd9d95da5ff And this is the actual patch, with the whitespace changes (I put an is_array() around the dbParams too, bumping the indent): https://gist.github.com/1bdd3fb370c0449f8aa4 What are the chances of this being integrated into Zeta? I am concerned about the BC break here as it is clearly stated in the development process that BC can not be broken once a component in Final state [1]. There is absolutely no way for you to use ezcDbHandler everywhere instead of mixing pure PDO and ezcDbHandler ? Unfortunately, our 300LOC code base already relies on a DB class that extends PDO for our own purposes. Changing this out for ezcDbHandler is not a feasible task. - Davey
Re: [zeta-dev] Issues Integrating ezcDbHandler into other code
Hi Davy, On Tue, Aug 9, 2011 at 11:11 PM, Davey Shafik da...@php.net wrote: Hi, I'm having an issue with the reusability of the ezcDbHandler within my project. ezcDbHandler directly extends the internal PDO class; which when instantiated, represents the actual DB connection. This causes problems when I already have a connection. Specifically, the issue is that I wish to use ezcWorkflowDatabaseTiein, which requires an ezcDbHandler object in it's constructor. This is fine, except that in order to fulfill this requirement, I need to instantiate a /second/ connection to the DB with ezcDbHandler instead of re-using the PDO instance I already have elsewhere in my code. A solution to this is to make ezcDbHandler a facade for the PDO instance, and allow passing in an existing PDO instance instead of a DSN. The only backwards compatibility issue is that any code that currently does: [snip] You can find a readable patch for this relatively simple change here: https://gist.github.com/09c3ab355dd9d95da5ff And this is the actual patch, with the whitespace changes (I put an is_array() around the dbParams too, bumping the indent): https://gist.github.com/1bdd3fb370c0449f8aa4 What are the chances of this being integrated into Zeta? I am concerned about the BC break here as it is clearly stated in the development process that BC can not be broken once a component in Final state [1]. There is absolutely no way for you to use ezcDbHandler everywhere instead of mixing pure PDO and ezcDbHandler ? 1. https://incubator.apache.org/zetacomponents/community/dev_process.html#version-states -- Jérôme Renard http://39web.fr | http://jrenard.info | http://twitter.com/jeromerenard
[zeta-dev] Issues Integrating ezcDbHandler into other code
Hi, I'm having an issue with the reusability of the ezcDbHandler within my project. ezcDbHandler directly extends the internal PDO class; which when instantiated, represents the actual DB connection. This causes problems when I already have a connection. Specifically, the issue is that I wish to use ezcWorkflowDatabaseTiein, which requires an ezcDbHandler object in it's constructor. This is fine, except that in order to fulfill this requirement, I need to instantiate a /second/ connection to the DB with ezcDbHandler instead of re-using the PDO instance I already have elsewhere in my code. A solution to this is to make ezcDbHandler a facade for the PDO instance, and allow passing in an existing PDO instance instead of a DSN. The only backwards compatibility issue is that any code that currently does: $db = new ezcDbHandler(...); // other stuff… if ($db instanceof PDO) { // will now be false } But it allows: $pdoInstance = new PDO(…); // other stuff $dbHandler = new ezcDbHandler(null, $pdoInstance); You can find a readable patch for this relatively simple change here: https://gist.github.com/09c3ab355dd9d95da5ff And this is the actual patch, with the whitespace changes (I put an is_array() around the dbParams too, bumping the indent): https://gist.github.com/1bdd3fb370c0449f8aa4 What are the chances of this being integrated into Zeta? - Davey