protected function _parseExpr($Expr, $Name = null, $EscapeExpr = false)
{
$Result = '';
$C = substr($Expr, 0, 1);
if ($C === '=' && $EscapeExpr === false) {
// This is a function call. Each parameter has to be parsed.
$FunctionArray = preg_split('/(\\[[^\\]]+\\])/', substr($Expr, 1), -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 0; $i < count($FunctionArray); $i++) {
$Part = $FunctionArray[$i];
if (substr($Part, 1) == '[') {
// Translate the part of the function call.
$Part = $this->_fieldExpr(substr($Part, 1, strlen($Part) - 2), $Name);
$FunctionArray[$i] = $Part;
}
}
// Combine the array back to the original function call.
$Result = join('', $FunctionArray);
} elseif ($C === '@' && $EscapeExpr === false) {
// This is a literal. Don't do anything.
$Result = substr($Expr, 1);
} else {
// This is a column reference.
if (is_null($Name)) {
$Result = $this->escapeIdentifier($Expr);
} else {
// This is a named parameter.
// Check to see if the named parameter is valid.
if (in_array(substr($Expr, 0, 1), array('=', '@'))) {
// The parameter has to be a default name.
$Result = $this->namedParameter('Param', true);
} else {
$Result = $this->namedParameter($Name, true);
}
$this->_NamedParameters[$Result] = $Expr;
}
}
return $Result;
}