本文整理汇总了PHP中Varien_Db_Select::reset方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Db_Select::reset方法的具体用法?PHP Varien_Db_Select::reset怎么用?PHP Varien_Db_Select::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Db_Select
的用法示例。
在下文中一共展示了Varien_Db_Select::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: exists
/**
* Add EXISTS clause
*
* @param Varien_Db_Select $select
* @param string $joinCondition
* @param bool $isExists
* @return Varien_Db_Select
*/
public function exists($select, $joinCondition, $isExists = true)
{
if ($isExists) {
$exists = 'EXISTS (%s)';
} else {
$exists = 'NOT EXISTS (%s)';
}
$select->reset(self::COLUMNS)->columns(array(new Zend_Db_Expr('1')))->where($joinCondition);
$exists = sprintf($exists, $select->assemble());
$this->where($exists);
return $this;
}
示例2: _prepareHaving
/**
* Prepare and returns having array
*
* @param Varien_Db_Select $select
* @param bool $autoReset
* @return array
* @throws Zend_Db_Exception
*/
protected function _prepareHaving(Varien_Db_Select $select, $autoReset = false)
{
$selectHavings = $select->getPart(Zend_Db_Select::HAVING);
if (!$selectHavings) {
return array();
}
$havings = array();
$columns = $select->getPart(Zend_Db_Select::COLUMNS);
foreach ($columns as $columnEntry) {
$correlationName = (string) $columnEntry[1];
$column = $columnEntry[2];
foreach ($selectHavings as $having) {
/**
* Looking for column expression in the having clause
*/
if (strpos($having, $correlationName) !== false) {
if (is_string($column)) {
/**
* Replace column expression to column alias in having clause
*/
$havings[] = str_replace($correlationName, $column, $having);
} else {
throw new Zend_Db_Exception(sprintf("Can't prepare expression without column alias: '%s'", $correlationName));
}
}
}
}
if ($autoReset) {
$select->reset(Zend_Db_Select::HAVING);
}
return $havings;
}