GetTableAlias() public méthode

public GetTableAlias ( $strTableName )
Exemple #1
0
 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);
     }
 }