ZF-1328: Support Zend_Db_Select objects in quote(), quoteInto(), and quoteIdentifier()
Description
I would like to be able to interpolate a Zend_Db_Select object into a query and have it be rendered as a string, and wrapped in parentheses so it can be a subquery:
$select = $db->select()
->from( $db->select()->from('subqueryTable') );
Should produce:
SELECT *
FROM (SELECT * FROM "subqueryTable")
$db->quoteInto('WHERE foo IN ?', $db->select()->from('subqueryTable'));
Should produce:
WHERE foo IN (SELECT * FROM "subqueryTable")
So we need that the quote() method and the quoteIdentifier() method check for an object of type Zend_Db_Select, and turn it into:
new Zend_Db_Expr( '(' . $selectObject->__toString() . ')' )
That should handle both cases.
Comments
Posted by Simon Mundy (peptolab) on 2008-02-24T22:16:33.000+0000
Fixed in trunk - r8384