On 07/09/2007, at 8:47 AM, Bill Karwin wrote:
Natural outer joins are not supported in Zend_Db_Select because they were thought to be an uncommon use case.

There are at least two very easy workarounds: specify the join condition in the joinLeft() method, or else skip use of Zend_Db_Select entirely, and instead write your SQL as a string and execute it with $db->query().

Zend_Db_Select was never intended to support every permutation of SQL syntax (example: UNION is not supported at all). It was intended to make it easy to construct queries procedurally for the 80% most common cases.

I agree the code for joinLeftNatural() you showed is not a big deal, but that's only one-third of the required work. There are also unit tests and documentation to write. Needs to be tested on all supported databases. Some RDBMS brands may not support natural joins, etc. The effort for these things has a way of expanding.

I don't know why Zend_Db_Select is not as friendly as it could be for extending. I can guess that because of the "80%" principle, the answer is, "you shouldn't be extending it. If you have an uncommon case, then write your SQL yourself."

We will probably not add this method to Zend_Db_Select. Feel free to enter a request, but it will be very low priority, since there are such straightforward workarounds available.

Hi bill. thats fine ill just use normal join syntax with join field statements where it applies. I have the subclass working, but it could BC break in the future so rather not go down that path.

I do however feel, that packages within an API should be able to be extended really unless they are final preventing subclassing.

Reply via email to