当前位置: 首页>>代码示例>>PHP>>正文


PHP QQueryBuilder::GetTableAlias方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:qcodo,项目名称:qcodo,代码行数:31,代码来源:QQuery.class.php


注:本文中的QQueryBuilder::GetTableAlias方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。