diff options
author | Dries Buytaert <dries@buytaert.net> | 2008-10-29 09:40:17 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2008-10-29 09:40:17 +0000 |
commit | 068febde425f4521d61f863ffaca76da65916449 (patch) | |
tree | 6ffae31bb702c5801134ffade3d98f316294810c /includes/database | |
parent | 7142e3fe78b3df18dd466b3e4cfa6abef7339040 (diff) | |
download | brdo-068febde425f4521d61f863ffaca76da65916449.tar.gz brdo-068febde425f4521d61f863ffaca76da65916449.tar.bz2 |
- Patch #327271 by hswong3i, Crell: proper use of AS keyword so it works on PostgreSQL and Oracle.
Diffstat (limited to 'includes/database')
-rw-r--r-- | includes/database/select.inc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/includes/database/select.inc b/includes/database/select.inc index a1947882a..d7579f661 100644 --- a/includes/database/select.inc +++ b/includes/database/select.inc @@ -673,6 +673,8 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab // FIELDS and EXPRESSIONS $fields = array(); foreach ($this->fields as $alias => $field) { + // Always use the AS keyword for field aliases, as some + // databases require it (e.g., PostgreSQL). $fields[] = (isset($field['table']) ? $field['table'] . '.' : '') . $field['field'] . ' AS ' . $field['alias']; } foreach ($this->expressions as $alias => $expression) { @@ -693,7 +695,9 @@ class SelectQuery extends Query implements QueryConditionInterface, QueryAlterab if (isset($table['join type'])) { $query .= $table['join type'] . ' JOIN '; } - $query .= '{' . $this->connection->escapeTable($table['table']) . '} AS ' . $table['alias']; + // Don't use the AS keyword for table aliases, as some + // databases don't support it (e.g., Oracle). + $query .= '{' . $this->connection->escapeTable($table['table']) . '} ' . $table['alias']; if (!empty($table['condition'])) { $query .= ' ON ' . $table['condition']; } |