Issues

ZF-9266: Check if Zend_Db_Select is in an empty state

Issue Type: Improvement Created: 2010-02-25T08:39:12.000+0000 Last Updated: 2012-11-20T21:37:45.000+0000 Status: Open Fix version(s): Reporter: Luiz Damim (luizvd) Assignee: None Tags: - Zend_Db_Select

Related issues: Attachments:

Description

Sometimes I need to know if a select instance is in an empty state (just initialized or fully resetted).

Since the select class is hardcoded in the Adapters, I can't implement this method for myself, so I need to do this check:

<pre class="literal">
$select = Zend_Db_Table::getDefaultAdapter()->select();

$select->from()
   ...
   ...;

$selectString = $select->__toString();
if (empty($selectString)) {
    // empty state
}

My proposal is for a method isEmpty() (or any better name), that could do this check, maybe comparing the $_parts and $_partsInit properties.

<pre class="literal">
public function isEmpty()
{
    return self::$_partsInit === $this->_parts;
}

Comments

No comments to display

Have you found an issue?

See the Overview section for more details.

Copyright

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

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

Contacts