ZF-1328: Support Zend_Db_Select objects in quote(), quoteInto(), and quoteIdentifier()

Issue Type: Improvement Created: 2007-04-29T13:10:50.000+0000 Last Updated: 2008-03-21T16:25:47.000+0000 Status: Resolved Fix version(s): - 1.5.0 (17/Mar/08)

Reporter: Bill Karwin (bkarwin) Assignee: Simon Mundy (peptolab) Tags: - Zend_Db_Select

Related issues: Attachments:


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:

<pre class="highlight">
$select = $db->select()
->from( $db->select()->from('subqueryTable') );

Should produce:

<pre class="highlight">
FROM (SELECT * FROM "subqueryTable")

<pre class="highlight">
$db->quoteInto('WHERE foo IN ?', $db->select()->from('subqueryTable'));

Should produce:

<pre class="highlight">
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:

<pre class="highlight">
new Zend_Db_Expr( '(' . $selectObject->__toString() . ')' )

That should handle both cases.


Posted by Simon Mundy (peptolab) on 2008-02-24T22:16:33.000+0000

Fixed in trunk - r8384

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.