mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°931 new MatchExpression, allow to query the DB
SVN:trunk[6016]
This commit is contained in:
@@ -47,13 +47,30 @@ abstract class Expression
|
|||||||
/**
|
/**
|
||||||
* recursive rendering
|
* recursive rendering
|
||||||
*
|
*
|
||||||
|
* @deprecated use RenderExpression
|
||||||
|
*
|
||||||
* @param array $aArgs used as input by default, or used as output if bRetrofitParams set to True
|
* @param array $aArgs used as input by default, or used as output if bRetrofitParams set to True
|
||||||
* @param bool $bRetrofitParams
|
* @param bool $bRetrofitParams
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
* @throws \MissingQueryArgument
|
* @throws \MissingQueryArgument
|
||||||
*/
|
*/
|
||||||
abstract public function Render(&$aArgs = null, $bRetrofitParams = false);
|
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
||||||
|
{
|
||||||
|
return $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* recursive rendering
|
||||||
|
*
|
||||||
|
* @param bool $bForSQL generates code for OQL if false, for SQL otherwise
|
||||||
|
* @param array $aArgs used as input by default, or used as output if bRetrofitParams set to True
|
||||||
|
* @param bool $bRetrofitParams
|
||||||
|
*
|
||||||
|
* @return array|string
|
||||||
|
* @throws \MissingQueryArgument
|
||||||
|
*/
|
||||||
|
abstract public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DBObjectSearch $oSearch
|
* @param DBObjectSearch $oSearch
|
||||||
@@ -66,7 +83,7 @@ abstract class Expression
|
|||||||
*/
|
*/
|
||||||
public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array())
|
public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array())
|
||||||
{
|
{
|
||||||
return $this->Render($aArgs);
|
return $this->RenderExpression(false, $aArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetAttDef($aClasses = array())
|
public function GetAttDef($aClasses = array())
|
||||||
@@ -104,7 +121,7 @@ abstract class Expression
|
|||||||
|
|
||||||
public function serialize()
|
public function serialize()
|
||||||
{
|
{
|
||||||
return base64_encode($this->Render());
|
return base64_encode($this->RenderExpression(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,7 +200,7 @@ abstract class Expression
|
|||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'widget' => AttributeDefinition::SEARCH_WIDGET_TYPE_RAW,
|
'widget' => AttributeDefinition::SEARCH_WIDGET_TYPE_RAW,
|
||||||
'oql' => $this->Render($aArgs, $bRetrofitParams),
|
'oql' => $this->RenderExpression(false, $aArgs, $bRetrofitParams),
|
||||||
'label' => $this->Display($oSearch, $aArgs, $oAttDef),
|
'label' => $this->Display($oSearch, $aArgs, $oAttDef),
|
||||||
'source' => get_class($this),
|
'source' => get_class($this),
|
||||||
);
|
);
|
||||||
@@ -229,7 +246,7 @@ class SQLExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSql = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
return $this->m_sSQL;
|
return $this->m_sSQL;
|
||||||
}
|
}
|
||||||
@@ -285,7 +302,30 @@ class BinaryExpression extends Expression
|
|||||||
protected $m_oRightExpr;
|
protected $m_oRightExpr;
|
||||||
protected $m_sOperator;
|
protected $m_sOperator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \Expression $oLeftExpr
|
||||||
|
* @param string $sOperator
|
||||||
|
* @param \Expression $oRightExpr
|
||||||
|
*
|
||||||
|
* @throws \CoreException
|
||||||
|
*/
|
||||||
public function __construct($oLeftExpr, $sOperator, $oRightExpr)
|
public function __construct($oLeftExpr, $sOperator, $oRightExpr)
|
||||||
|
{
|
||||||
|
$this->ValidateConstructorParams($oLeftExpr, $sOperator, $oRightExpr);
|
||||||
|
|
||||||
|
$this->m_oLeftExpr = $oLeftExpr;
|
||||||
|
$this->m_oRightExpr = $oRightExpr;
|
||||||
|
$this->m_sOperator = $sOperator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $oLeftExpr
|
||||||
|
* @param $sOperator
|
||||||
|
* @param $oRightExpr
|
||||||
|
*
|
||||||
|
* @throws \CoreException if one of the parameter is invalid
|
||||||
|
*/
|
||||||
|
protected function ValidateConstructorParams($oLeftExpr, $sOperator, $oRightExpr)
|
||||||
{
|
{
|
||||||
if (!is_object($oLeftExpr))
|
if (!is_object($oLeftExpr))
|
||||||
{
|
{
|
||||||
@@ -303,13 +343,11 @@ class BinaryExpression extends Expression
|
|||||||
{
|
{
|
||||||
throw new CoreException('Expecting an Expression object on the right hand', array('found_class' => get_class($oRightExpr)));
|
throw new CoreException('Expecting an Expression object on the right hand', array('found_class' => get_class($oRightExpr)));
|
||||||
}
|
}
|
||||||
if ( (($sOperator == "IN") || ($sOperator == "NOT IN")) && !$oRightExpr instanceof ListExpression)
|
if ((($sOperator == "IN") || ($sOperator == "NOT IN")) && !($oRightExpr instanceof ListExpression))
|
||||||
{
|
{
|
||||||
throw new CoreException("Expecting a List Expression object on the right hand for operator $sOperator", array('found_class' => get_class($oRightExpr)));
|
throw new CoreException("Expecting a List Expression object on the right hand for operator $sOperator",
|
||||||
|
array('found_class' => get_class($oRightExpr)));
|
||||||
}
|
}
|
||||||
$this->m_oLeftExpr = $oLeftExpr;
|
|
||||||
$this->m_oRightExpr = $oRightExpr;
|
|
||||||
$this->m_sOperator = $sOperator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function IsTrue()
|
public function IsTrue()
|
||||||
@@ -341,12 +379,11 @@ class BinaryExpression extends Expression
|
|||||||
return $this->m_sOperator;
|
return $this->m_sOperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
|
||||||
{
|
{
|
||||||
$sOperator = $this->GetOperator();
|
$sOperator = $this->GetOperator();
|
||||||
$sLeft = $this->GetLeftExpr()->Render($aArgs, $bRetrofitParams);
|
$sLeft = $this->GetLeftExpr()->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
$sRight = $this->GetRightExpr()->Render($aArgs, $bRetrofitParams);
|
$sRight = $this->GetRightExpr()->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
return "($sLeft $sOperator $sRight)";
|
return "($sLeft $sOperator $sRight)";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,7 +642,7 @@ class BinaryExpression extends Expression
|
|||||||
|
|
||||||
$aCriteria = self::MergeCriteria($aCriteriaLeft, $aCriteriaRight, $this->GetOperator());
|
$aCriteria = self::MergeCriteria($aCriteriaLeft, $aCriteriaRight, $this->GetOperator());
|
||||||
}
|
}
|
||||||
$aCriteria['oql'] = $this->Render($aArgs, $bRetrofitParams);
|
$aCriteria['oql'] = $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||||
$aCriteria['label'] = $this->Display($oSearch, $aArgs, $oAttDef);
|
$aCriteria['label'] = $this->Display($oSearch, $aArgs, $oAttDef);
|
||||||
|
|
||||||
if (isset($aCriteriaLeft['ref']) && isset($aCriteriaRight['ref']) && ($aCriteriaLeft['ref'] != $aCriteriaRight['ref']))
|
if (isset($aCriteriaLeft['ref']) && isset($aCriteriaRight['ref']) && ($aCriteriaLeft['ref'] != $aCriteriaRight['ref']))
|
||||||
@@ -643,6 +680,56 @@ class BinaryExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 2.6 N°931 tag fields
|
||||||
|
*/
|
||||||
|
class MatchExpression extends BinaryExpression
|
||||||
|
{
|
||||||
|
/** @var \FieldExpression */
|
||||||
|
protected $m_oLeftExpr;
|
||||||
|
/** @var \ScalarExpression */
|
||||||
|
protected $m_oRightExpr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MatchExpression constructor.
|
||||||
|
*
|
||||||
|
* @param \FieldExpression $oLeftExpr
|
||||||
|
* @param \ScalarExpression $oRightExpr
|
||||||
|
*
|
||||||
|
* @throws \CoreException
|
||||||
|
*/
|
||||||
|
public function __construct(FieldExpression $oLeftExpr, ScalarExpression $oRightExpr)
|
||||||
|
{
|
||||||
|
parent::__construct($oLeftExpr, 'MATCHES', $oRightExpr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
|
{
|
||||||
|
$sLeft = $this->GetLeftExpr()->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
|
$sRight = $this->GetRightExpr()->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
|
|
||||||
|
if ($bForSQL)
|
||||||
|
{
|
||||||
|
$sRet = "MATCH ($sLeft) AGAINST ($sRight IN NATURAL LANGUAGE MODE)";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$sRet = "$sLeft MATCHES $sRight";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function Translate($aTranslationData, $bMatchAll = true, $bMarkFieldsAsResolved = true)
|
||||||
|
{
|
||||||
|
$oLeft = $this->GetLeftExpr()->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved);
|
||||||
|
$oRight = $this->GetRightExpr()->Translate($aTranslationData, $bMatchAll, $bMarkFieldsAsResolved);
|
||||||
|
|
||||||
|
return new static($oLeft, $oRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class UnaryExpression extends Expression
|
class UnaryExpression extends Expression
|
||||||
{
|
{
|
||||||
protected $m_value;
|
protected $m_value;
|
||||||
@@ -664,7 +751,7 @@ class UnaryExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
return CMDBSource::Quote($this->m_value);
|
return CMDBSource::Quote($this->m_value);
|
||||||
}
|
}
|
||||||
@@ -772,11 +859,11 @@ class ScalarExpression extends UnaryExpression
|
|||||||
return $aCtx['date_display']->MakeValueLabel($oSearch, $this->m_value, $this->m_value);
|
return $aCtx['date_display']->MakeValueLabel($oSearch, $this->m_value, $this->m_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->Render($aArgs);
|
return $this->RenderExpression(false, $aArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
if (is_null($this->m_value))
|
if (is_null($this->m_value))
|
||||||
{
|
{
|
||||||
@@ -869,7 +956,7 @@ class ScalarExpression extends UnaryExpression
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$aCriteria['oql'] = $this->Render($aArgs, $bRetrofitParams);
|
$aCriteria['oql'] = $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||||
return $aCriteria;
|
return $aCriteria;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -977,7 +1064,7 @@ class FieldExpression extends UnaryExpression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
if (empty($this->m_sParent))
|
if (empty($this->m_sParent))
|
||||||
{
|
{
|
||||||
@@ -1323,19 +1410,18 @@ class VariableExpression extends UnaryExpression
|
|||||||
return $oAttDef->GetAsPlainText($sValue);
|
return $oAttDef->GetAsPlainText($sValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->Render($aArgs);
|
return $this->RenderExpression(false, $aArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param null $aArgs
|
* @param bool $bForSQL
|
||||||
|
* @param array $aArgs
|
||||||
* @param bool $bRetrofitParams
|
* @param bool $bRetrofitParams
|
||||||
*
|
*
|
||||||
* @return array|string
|
* @return array|string
|
||||||
* @throws \MissingQueryArgument
|
* @throws \MissingQueryArgument
|
||||||
*/
|
*/
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
if (is_null($aArgs))
|
if (is_null($aArgs))
|
||||||
{
|
{
|
||||||
@@ -1453,12 +1539,12 @@ class ListExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
$aRes = array();
|
$aRes = array();
|
||||||
foreach ($this->m_aExpressions as $oExpr)
|
foreach ($this->m_aExpressions as $oExpr)
|
||||||
{
|
{
|
||||||
$aRes[] = $oExpr->Render($aArgs, $bRetrofitParams);
|
$aRes[] = $oExpr->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
}
|
}
|
||||||
return '('.implode(', ', $aRes).')';
|
return '('.implode(', ', $aRes).')';
|
||||||
}
|
}
|
||||||
@@ -1609,12 +1695,12 @@ class FunctionExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
$aRes = array();
|
$aRes = array();
|
||||||
foreach ($this->m_aArgs as $iPos => $oExpr)
|
foreach ($this->m_aArgs as $iPos => $oExpr)
|
||||||
{
|
{
|
||||||
$aRes[] = $oExpr->Render($aArgs, $bRetrofitParams);
|
$aRes[] = $oExpr->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
}
|
}
|
||||||
return $this->m_sVerb.'('.implode(', ', $aRes).')';
|
return $this->m_sVerb.'('.implode(', ', $aRes).')';
|
||||||
}
|
}
|
||||||
@@ -1814,7 +1900,7 @@ class FunctionExpression extends Expression
|
|||||||
$aCtx['date_display'] = $this;
|
$aCtx['date_display'] = $this;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return $this->Render($aArgs);
|
return $this->RenderExpression(false, $aArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($this->m_aArgs as $oExpression)
|
foreach($this->m_aArgs as $oExpression)
|
||||||
@@ -1851,7 +1937,7 @@ class FunctionExpression extends Expression
|
|||||||
$aCriteria = array_merge($oExpression->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef), $aCriteria);
|
$aCriteria = array_merge($oExpression->GetCriterion($oSearch, $aArgs, $bRetrofitParams, $oAttDef), $aCriteria);
|
||||||
}
|
}
|
||||||
$aCriteria['has_undefined'] = true;
|
$aCriteria['has_undefined'] = true;
|
||||||
$aCriteria['oql'] = $this->Render($aArgs, $bRetrofitParams);
|
$aCriteria['oql'] = $this->RenderExpression(false, $aArgs, $bRetrofitParams);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'NOW':
|
case 'NOW':
|
||||||
@@ -1907,9 +1993,9 @@ class IntervalExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
return 'INTERVAL '.$this->m_oValue->Render($aArgs, $bRetrofitParams).' '.$this->m_sUnit;
|
return 'INTERVAL '.$this->m_oValue->RenderExpression($bForSQL, $aArgs, $bRetrofitParams).' '.$this->m_sUnit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Browse(Closure $callback)
|
public function Browse(Closure $callback)
|
||||||
@@ -1974,7 +2060,7 @@ class IntervalExpression extends Expression
|
|||||||
|
|
||||||
public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array())
|
public function Display($oSearch, &$aArgs = null, $oAttDef = null, &$aCtx = array())
|
||||||
{
|
{
|
||||||
return $this->m_oValue->Render($aArgs).' '.Dict::S('Expression:Unit:Long:'.$this->m_sUnit, $this->m_sUnit);
|
return $this->m_oValue->RenderExpression(false, $aArgs).' '.Dict::S('Expression:Unit:Long:'.$this->m_sUnit, $this->m_sUnit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1999,12 +2085,12 @@ class CharConcatExpression extends Expression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
$aRes = array();
|
$aRes = array();
|
||||||
foreach ($this->m_aExpressions as $oExpr)
|
foreach ($this->m_aExpressions as $oExpr)
|
||||||
{
|
{
|
||||||
$sCol = $oExpr->Render($aArgs, $bRetrofitParams);
|
$sCol = $oExpr->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
// Concat will be globally NULL if one single argument is null !
|
// Concat will be globally NULL if one single argument is null !
|
||||||
$aRes[] = "COALESCE($sCol, '')";
|
$aRes[] = "COALESCE($sCol, '')";
|
||||||
}
|
}
|
||||||
@@ -2111,12 +2197,12 @@ class CharConcatWSExpression extends CharConcatExpression
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recursive rendering
|
// recursive rendering
|
||||||
public function Render(&$aArgs = null, $bRetrofitParams = false)
|
public function RenderExpression($bForSQL = false, &$aArgs = null, $bRetrofitParams = false)
|
||||||
{
|
{
|
||||||
$aRes = array();
|
$aRes = array();
|
||||||
foreach ($this->m_aExpressions as $oExpr)
|
foreach ($this->m_aExpressions as $oExpr)
|
||||||
{
|
{
|
||||||
$sCol = $oExpr->Render($aArgs, $bRetrofitParams);
|
$sCol = $oExpr->RenderExpression($bForSQL, $aArgs, $bRetrofitParams);
|
||||||
// Concat will be globally NULL if one single argument is null !
|
// Concat will be globally NULL if one single argument is null !
|
||||||
$aRes[] = "COALESCE($sCol, '')";
|
$aRes[] = "COALESCE($sCol, '')";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class SQLObjectQuery extends SQLQuery
|
|||||||
$aFieldDesc = array();
|
$aFieldDesc = array();
|
||||||
foreach ($this->m_aFields as $sAlias => $oExpression)
|
foreach ($this->m_aFields as $sAlias => $oExpression)
|
||||||
{
|
{
|
||||||
$aFieldDesc[] = $oExpression->Render()." as <em>$sAlias</em>";
|
$aFieldDesc[] = $oExpression->RenderExpression(false)." as <em>$sAlias</em>";
|
||||||
}
|
}
|
||||||
$sFields = " => ".implode(', ', $aFieldDesc);
|
$sFields = " => ".implode(', ', $aFieldDesc);
|
||||||
}
|
}
|
||||||
@@ -112,7 +112,7 @@ class SQLObjectQuery extends SQLQuery
|
|||||||
$oSQLQuery = $aJoinInfo["select"];
|
$oSQLQuery = $aJoinInfo["select"];
|
||||||
if (isset($aJoinInfo["on_expression"]))
|
if (isset($aJoinInfo["on_expression"]))
|
||||||
{
|
{
|
||||||
$sOnCondition = $aJoinInfo["on_expression"]->Render();
|
$sOnCondition = $aJoinInfo["on_expression"]->RenderExpression(false);
|
||||||
|
|
||||||
echo "<li>Join '$sJoinType', ON ($sOnCondition)".$oSQLQuery->DisplayHtml()."</li>\n";
|
echo "<li>Join '$sJoinType', ON ($sOnCondition)".$oSQLQuery->DisplayHtml()."</li>\n";
|
||||||
}
|
}
|
||||||
@@ -464,7 +464,7 @@ class SQLObjectQuery extends SQLQuery
|
|||||||
case "left":
|
case "left":
|
||||||
if (isset($aJoinData["on_expression"]))
|
if (isset($aJoinData["on_expression"]))
|
||||||
{
|
{
|
||||||
$sJoinCond = $aJoinData["on_expression"]->Render();
|
$sJoinCond = $aJoinData["on_expression"]->RenderExpression(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -531,13 +531,13 @@ class SQLObjectQuery extends SQLQuery
|
|||||||
//
|
//
|
||||||
foreach($this->m_aFields as $sAlias => $oExpression)
|
foreach($this->m_aFields as $sAlias => $oExpression)
|
||||||
{
|
{
|
||||||
$oRootQuery->__aFields["`$sAlias`"] = $oExpression->Render();
|
$oRootQuery->__aFields["`$sAlias`"] = $oExpression->RenderExpression(true);
|
||||||
}
|
}
|
||||||
if ($this->m_aGroupBy)
|
if ($this->m_aGroupBy)
|
||||||
{
|
{
|
||||||
foreach($this->m_aGroupBy as $sAlias => $oExpression)
|
foreach($this->m_aGroupBy as $sAlias => $oExpression)
|
||||||
{
|
{
|
||||||
$oRootQuery->__aGroupBy["`$sAlias`"] = $oExpression->Render();
|
$oRootQuery->__aGroupBy["`$sAlias`"] = $oExpression->RenderExpression(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($this->m_bToDelete)
|
if ($this->m_bToDelete)
|
||||||
@@ -551,7 +551,7 @@ class SQLObjectQuery extends SQLQuery
|
|||||||
|
|
||||||
if (!is_null($this->m_oSelectedIdField))
|
if (!is_null($this->m_oSelectedIdField))
|
||||||
{
|
{
|
||||||
$oRootQuery->__aSelectedIdFields[] = $this->m_oSelectedIdField->Render();
|
$oRootQuery->__aSelectedIdFields[] = $this->m_oSelectedIdField->RenderExpression(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// loop on joins, to complete the list of tables/fields/conditions
|
// loop on joins, to complete the list of tables/fields/conditions
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ abstract class SQLQuery
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return $oConditionExpr->Render($aArgs);
|
return $oConditionExpr->RenderExpression(true, $aArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class SQLUnionQuery extends SQLQuery
|
|||||||
}
|
}
|
||||||
foreach($this->aSelectExpr as $sSelectAlias => $oExpr)
|
foreach($this->aSelectExpr as $sSelectAlias => $oExpr)
|
||||||
{
|
{
|
||||||
$aSelectAliases[$sSelectAlias] = $oExpr->Render()." AS `$sSelectAlias`";
|
$aSelectAliases[$sSelectAlias] = $oExpr->RenderExpression(true)." AS `$sSelectAlias`";
|
||||||
}
|
}
|
||||||
|
|
||||||
$sSelect = implode(",$sLineSep ", $aSelectAliases);
|
$sSelect = implode(",$sLineSep ", $aSelectAliases);
|
||||||
|
|||||||
Reference in New Issue
Block a user