QQueryBuilder::AddFromItem PHP Method

AddFromItem() public method

public AddFromItem ( $strTableName, $strAliasOverride = null )
    public function AddFromItem($strTableName, $strAliasOverride = null)
    {
        if (!$strAliasOverride) {
            $strTableAlias = $this->GetTableAlias($strTableName);
            $this->strFromArray[$strTableName] = sprintf('%s%s%s AS %s%s%s', $this->strEscapeIdentifierBegin, $strTableName, $this->strEscapeIdentifierEnd, $this->strEscapeIdentifierBegin, $strTableAlias, $this->strEscapeIdentifierEnd);
        } else {
            // If an AliasOverride was submitted, we are doing a "custom from"
            $this->strCustomFromArray[$strTableName . '+' . count($this->strCustomFromArray)] = sprintf('%s%s%s AS %s%s%s', $this->strEscapeIdentifierBegin, $strTableName, $this->strEscapeIdentifierEnd, $this->strEscapeIdentifierBegin, $strAliasOverride, $this->strEscapeIdentifierEnd);
        }
    }

Usage Example

Example #1
0
 public function UpdateQueryBuilder(QQueryBuilder $objBuilder)
 {
     $objBuilder->AddFromItem($this->strTableName, $this->strTableAlias);
 }