| Versionen | |
|---|---|
| drupal7 | public DatabaseConnection_sqlite::distinctField($table, $field, $query) |
@todo Remove this as soon as db_rewrite_sql() has been exterminated.
includes/
<?php
public function distinctField($table, $field, $query) {
$field_to_select = 'DISTINCT(' . $table . '.' . $field . ')';
// (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
return preg_replace('/(SELECT.*)(?:' . $table . '\.|\s)(?<!DISTINCT\()(?<!DISTINCT\(' . $table . '\.)' . $field . '(.*FROM )/AUsi', '\1 ' . $field_to_select . '\2', $query);
}
?>
Kommentare
Kommentar hinzufügen