本文整理匯總了PHP中Zend_Db_Expr::assemble方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Db_Expr::assemble方法的具體用法?PHP Zend_Db_Expr::assemble怎麽用?PHP Zend_Db_Expr::assemble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Db_Expr
的用法示例。
在下文中一共展示了Zend_Db_Expr::assemble方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _quoteIdentifierAs
/**
* Quote an identifier and an optional alias.
*
* @param string|array|Zend_Db_Expr $ident The identifier or expression.
* @param string $alias An optional alias.
* @param boolean $auto If true, heed the AUTO_QUOTE_IDENTIFIERS config option.
* @param string $as The string to add between the identifier/expression and the alias.
* @return string The quoted identifier and alias.
*/
protected function _quoteIdentifierAs($ident, $alias = null, $auto = false, $as = ' AS ')
{
if ($ident instanceof Zend_Db_Expr) {
$quoted = $ident->__toString();
} elseif ($ident instanceof Zend_Db_Select) {
$quoted = '(' . $ident->assemble() . ')';
} else {
if (is_string($ident)) {
$ident = explode('.', $ident);
}
if (is_array($ident)) {
$segments = array();
foreach ($ident as $segment) {
if ($segment instanceof Zend_Db_Expr) {
$segments[] = $segment->__toString();
} else {
$segments[] = $this->_quoteIdentifier($segment, $auto);
}
}
if ($alias !== null && end($ident) == $alias) {
$alias = null;
}
$quoted = implode('.', $segments);
} else {
$quoted = $this->_quoteIdentifier($ident, $auto);
}
}
if ($alias !== null) {
$quoted .= $as . $this->_quoteIdentifier($alias, $auto);
}
return $quoted;
}