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.
 
Regards,
Bill Karwin


________________________________

        From: Jack Sleight [mailto:[EMAIL PROTECTED] 
        Sent: Wednesday, September 05, 2007 1:36 PM
        To: Daniel Rossi
        Cc: Zend Framework General
        Subject: Re: [fw-general] Natural Left Join support for
Zend_Select
        
        
        I don't know why it's not included I'm afraid, perhaps someone
from the DB team could let us know? You could create a new issue in JIRA
for this to be added.
        
         

Reply via email to