Skip to content

Commit

Permalink
Remove AS from table aliases.
Browse files Browse the repository at this point in the history
Having AS causes issues with Oracle. While this is not a core driver,
the AS keyword is not required by any supported driver.

Refs #4830
  • Loading branch information
markstory committed Oct 8, 2014
1 parent 3dd067c commit 43339ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Database/QueryCompiler.php
Expand Up @@ -175,7 +175,7 @@ protected function _buildFromPart($parts, $query, $generator) {
$parts = $this->_stringifyExpressions($parts, $generator);
foreach ($parts as $k => $p) {
if (!is_numeric($k)) {
$p = $p . ' AS ' . $k;
$p = $p . ' ' . $k;
}
$normalized[] = $p;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase/Database/QueryTest.php
Expand Up @@ -2560,11 +2560,11 @@ public function testQuotingFromAndAlias() {

$query = new Query($this->connection);
$sql = $query->select('*')->from(['foo' => 'something'])->sql();
$this->assertQuotedQuery('FROM <something> AS <foo>$', $sql);
$this->assertQuotedQuery('FROM <something> <foo>$', $sql);

$query = new Query($this->connection);
$sql = $query->select('*')->from(['foo' => $query->newExpr('bar')])->sql();
$this->assertQuotedQuery('FROM \(bar\) AS <foo>$', $sql);
$this->assertQuotedQuery('FROM \(bar\) <foo>$', $sql);
}

/**
Expand Down

0 comments on commit 43339ed

Please sign in to comment.