protected function SelectQuery_sqlsrv::replaceExpressionAliases in Drupal driver for SQL Server and SQL Azure 7.3
Same name and namespace in other branches
- 7.2 sqlsrv/select.inc \SelectQuery_sqlsrv::replaceExpressionAliases()
This function needs some work....
Parameters
mixed $statement:
Return value
mixed
1 call to SelectQuery_sqlsrv::replaceExpressionAliases()
- SelectQuery_sqlsrv::__toString in sqlsrv/
select.inc - Implements PHP magic __toString method to convert the query to a string.
File
- sqlsrv/
select.inc, line 259
Class
Code
protected function replaceExpressionAliases($statement) {
// References to expressions in cross-apply need to be updated.
// Now we need to update all references to the expression aliases
// and point them to the CROSS APPLY alias.
if (!empty($this->cross_apply_aliases)) {
$regex = str_replace('{0}', implode('|', array_keys($this->cross_apply_aliases)), self::RESERVED_REGEXP_BASE);
// Add and then remove the SELECT
// keyword. Do this to use the exact same
// regex that we have in DatabaseConnection_sqlrv.
$statement = 'SELECT ' . $statement;
$statement = preg_replace_callback($regex, array(
$this,
'replaceReservedAliases',
), $statement);
$statement = substr($statement, 7, strlen($statement) - 7);
}
return $statement;
}