• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/lib/entity/querychainelement.php
  • Класс: BitrixMainEntityQueryChainElement
  • Вызов: QueryChainElement::getSqlDefinition
public function getSqlDefinition()
{
	if (is_array($this->value) || $this->value instanceof ReferenceField || $this->value instanceof Base)
	{
		throw new SystemException('Unknown value');
	}

	if ($this->value instanceof ExpressionField)
	{
		$SQLBuildFrom = array();

		foreach ($this->value->getBuildFromChains() as $chain)
		{
			$SQLBuildFrom[] = $chain->getSQLDefinition();
		}

		// join
		$sql = call_user_func_array('sprintf', array_merge(array($this->value->getExpression()), $SQLBuildFrom));
	}
	else
	{
		$helper = $this->value->getEntity()->getConnection()->getSqlHelper();

		$sql = $helper->quote($this->getParameter('talias')) . '.';
		$sql .= $helper->quote($this->value->getColumnName());
	}

	return $sql;
}