summaryrefslogtreecommitdiff
path: root/includes/database/pgsql
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-01 01:43:50 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-09-01 01:43:50 +0000
commit7b2c2c7de3f7102b161d562b4a98a095278e8c87 (patch)
tree5249022c808283e0109e417adaff654da7622c87 /includes/database/pgsql
parentdc3e02fbfdc6c477e74e7b62b74df46fad3853e8 (diff)
downloadbrdo-7b2c2c7de3f7102b161d562b4a98a095278e8c87.tar.gz
brdo-7b2c2c7de3f7102b161d562b4a98a095278e8c87.tar.bz2
Temporary roll-back of #890994, per Dries's feedback.
Diffstat (limited to 'includes/database/pgsql')
-rw-r--r--includes/database/pgsql/query.inc67
1 files changed, 0 insertions, 67 deletions
diff --git a/includes/database/pgsql/query.inc b/includes/database/pgsql/query.inc
index 7642f53f7..61c821801 100644
--- a/includes/database/pgsql/query.inc
+++ b/includes/database/pgsql/query.inc
@@ -217,71 +217,4 @@ class SelectQuery_pgsql extends SelectQuery {
return $this;
}
- /**
- * Overrides SelectQuery::orderBy().
- *
- * Automatically adds columns that are ordered on as fields.
- */
- public function orderBy($field, $direction = 'ASC') {
- // Call parent function to order on this.
- $return = parent::orderBy($field, $direction);
-
- // PostgreSQL requires that when using DISTINCT or GROUP BY conditions,
- // fields/expressions that are ordered on also need to be selected.
- // This function tries to automatically add a field if it is not already
- // added or a condition applies that makes it impossible to handle that
- // automatically. In such cases, the query might fail on PostgreSQL if the
- // field or expression is not added manually.
-
- // If there is a table alias specified, split it up.
- if (strpos($field, '.') !== FALSE) {
- list($table, $table_field) = explode('.', $field);
- }
- // Figure out if the field has already been added.
- foreach ($this->fields as $existing_field) {
- if (!empty($table)) {
- // If table alias is given, check if field and table exists.
- if ($existing_field['table'] == $table && $existing_field['field'] == $table_field) {
- return $return;
- }
- }
- else {
- // If there is no table, simply check if the field exists as a field or
- // an aliased field.
- if ($existing_field['alias'] == $field) {
- return $return;
- }
- }
- }
-
- // Also check expression aliases.
- foreach ($this->expressions as $expression) {
- if ($expression['alias'] == $field) {
- return $return;
- }
- }
-
- // If a table loads all fields, it can not be added again. It would
- // result in an ambigious alias error because that field would be loaded
- // twice: Once through table_alias.* and once directly. If the field
- // actually belongs to a different table, it must be added manually.
- foreach ($this->tables as $table) {
- if (!empty($table['all_fields'])) {
- return $return;
- }
- }
-
- // If $field contains an characters which are not allowed in a field name
- // it is considered an expression, these can't be handeld automatically
- // either.
- if ($this->connection->escapeField($field) != $field) {
- return $return;
- }
-
- // This is a case that can be handled automatically, add the field.
- $this->addField(NULL, $field);
- return $return;
- }
-
-
}