Commit c127131f authored by alexpott's avatar alexpott
Browse files

Issue #2462175 by amateescu: SQLite: Fix case sensitivity in Views' string argument plugin

parent 03463697
......@@ -7,6 +7,7 @@
namespace Drupal\views\Plugin\views\argument;
use Drupal\Core\Database\Database;
use Drupal\Core\Form\FormStateInterface;
use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\display\DisplayPluginBase;
......@@ -176,7 +177,15 @@ protected function summaryQuery() {
* $this->ensureMyTable() MUST have been called prior to this.
*/
public function getFormula() {
return "SUBSTRING($this->tableAlias.$this->realField, 1, " . intval($this->options['limit']) . ")";
$formula = "SUBSTRING($this->tableAlias.$this->realField, 1, " . intval($this->options['limit']) . ")";
// Support case-insensitive substring comparisons for SQLite by using the
// 'NOCASE_UTF8' collation.
// @see Drupal\Core\Database\Driver\sqlite\Connection::open()
if (Database::getConnection()->databaseType() == 'sqlite' && $this->options['case'] != 'none') {
$formula .= ' COLLATE NOCASE_UTF8';
}
return $formula;
}
/**
......
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