Commit aa4b94fc authored by webchick's avatar webchick

#340568 by Damien Tournoud: in some versions of SQLite, SELECT DISINCT(field)...

#340568 by Damien Tournoud: in some versions of SQLite, SELECT DISINCT(field) will return '(field)' as the field name.
parent d6514fe3
......@@ -238,6 +238,15 @@ public function execute($args, $options) {
// using the same convention as MySQL and PostgreSQL.
$rename_columns = array();
foreach ($this->columnNames as $k => $column) {
// In some SQLite versions, SELECT DISTINCT(field) will return "(field)"
// instead of "field".
if (preg_match("/^\((.*)\)$/", $column, $matches)) {
$rename_columns[$column] = $matches[1];
$this->columnNames[$k] = $matches[1];
$column = $matches[1];
}
// Remove "table." prefixes.
if (preg_match("/^.*\.(.*)$/", $column, $matches)) {
$rename_columns[$column] = $matches[1];
$this->columnNames[$k] = $matches[1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment