QQueryBuilder::AddSelectItem PHP Method

AddSelectItem() public method

public AddSelectItem ( $strTableName, $strColumnName, $strFullAlias )
    public function AddSelectItem($strTableName, $strColumnName, $strFullAlias)
    {
        $strTableAlias = $this->GetTableAlias($strTableName);
        if (!array_key_exists($strFullAlias, $this->strColumnAliasArray)) {
            $strColumnAlias = 'a' . $this->intColumnAliasCount++;
            $this->strColumnAliasArray[$strFullAlias] = $strColumnAlias;
        } else {
            $strColumnAlias = $this->strColumnAliasArray[$strFullAlias];
        }
        $this->strSelectArray[$strFullAlias] = sprintf('%s%s%s.%s%s%s AS %s%s%s', $this->strEscapeIdentifierBegin, $strTableAlias, $this->strEscapeIdentifierEnd, $this->strEscapeIdentifierBegin, $strColumnName, $this->strEscapeIdentifierEnd, $this->strEscapeIdentifierBegin, $strColumnAlias, $this->strEscapeIdentifierEnd);
    }

Usage Example

Example #1
0
 /**
  * Updates a QQueryBuilder with the SELECT fields for this EmailMessageRoute
  * @param QQueryBuilder $objBuilder the Query Builder object to update
  * @param string $strPrefix optional prefix to add to the SELECT fields
  */
 public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null)
 {
     if ($strPrefix) {
         $strTableName = $strPrefix;
         $strAliasPrefix = $strPrefix . '__';
     } else {
         $strTableName = 'email_message_route';
         $strAliasPrefix = '';
     }
     $objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
     $objBuilder->AddSelectItem($strTableName, 'email_message_id', $strAliasPrefix . 'email_message_id');
     $objBuilder->AddSelectItem($strTableName, 'group_id', $strAliasPrefix . 'group_id');
     $objBuilder->AddSelectItem($strTableName, 'communication_list_id', $strAliasPrefix . 'communication_list_id');
     $objBuilder->AddSelectItem($strTableName, 'login_id', $strAliasPrefix . 'login_id');
     $objBuilder->AddSelectItem($strTableName, 'communication_list_entry_id', $strAliasPrefix . 'communication_list_entry_id');
     $objBuilder->AddSelectItem($strTableName, 'person_id', $strAliasPrefix . 'person_id');
 }
All Usage Examples Of QQueryBuilder::AddSelectItem