本文整理汇总了PHP中QQueryBuilder::GetTableAlias方法的典型用法代码示例。如果您正苦于以下问题:PHP QQueryBuilder::GetTableAlias方法的具体用法?PHP QQueryBuilder::GetTableAlias怎么用?PHP QQueryBuilder::GetTableAlias使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QQueryBuilder
的用法示例。
在下文中一共展示了QQueryBuilder::GetTableAlias方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetColumnAlias
public function GetColumnAlias(QQueryBuilder $objBuilder, $blnExpandSelection = false, QQCondition $objJoinCondition = null)
{
// Make sure our Root Tables Match
if ($this->_RootTableName != $objBuilder->RootTableName) {
throw new QCallerException('Cannot use QQNode for "' . $this->_RootTableName . '" when querying against the "' . $objBuilder->RootTableName . '" table', 3);
}
// Pull the Begin and End Escape Identifiers from the Database Adapter
$strBegin = $objBuilder->Database->EscapeIdentifierBegin;
$strEnd = $objBuilder->Database->EscapeIdentifierEnd;
// If we are a standard QQNode at the top level column, simply return the column name
if (get_class($this) == 'QQNode' && is_null($this->objParentNode->_Type)) {
return sprintf('%s%s%s.%s%s%s', $strBegin, $objBuilder->GetTableAlias($this->objParentNode->_Name), $strEnd, $strBegin, $this->strName, $strEnd);
} else {
// Use the Helper to Iterate Through the Parent Chain and get the Parent Alias
try {
$strParentAlias = $this->objParentNode->GetColumnAliasHelper($objBuilder, $strBegin, $strEnd, $blnExpandSelection);
if ($this->strTableName) {
// Next, Join the Appropriate Table
$objBuilder->AddJoinItem($this->strTableName, $strParentAlias . '__' . $this->strName, $strParentAlias, $this->strName, $this->strPrimaryKey, $objJoinCondition);
if ($blnExpandSelection) {
call_user_func(array($this->strClassName, 'GetSelectFields'), $objBuilder, $strParentAlias . '__' . $this->strName);
}
}
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
// Finally, return the final column alias name (Parent Prefix with Current Node Name)
return sprintf('%s%s%s.%s%s%s', $strBegin, $objBuilder->GetTableAlias($strParentAlias), $strEnd, $strBegin, $this->strName, $strEnd);
}
}