1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-17 22:11:26 +02:00

Merge branch 'develop-ascraeus' into develop

* develop-ascraeus:
  [ticket/12671] Possibility to use NOT LIKE expression
  [ticket/12671] Possibility to use NOT LIKE expression
  [ticket/12671] Possibility to use NOT LIKE expression
  [ticket/12671] Possibility to use NOT LIKE expression
  [ticket/12671] Possibility to use NOT LIKE expression
This commit is contained in:
Joas Schilling
2014-08-10 13:35:37 +02:00
12 changed files with 175 additions and 3 deletions

View File

@@ -265,11 +265,11 @@ class sqlite3 extends \phpbb\db\driver\driver
/**
* {@inheritDoc}
*
* For SQLite an underscore is a not-known character...
* For SQLite an underscore is an unknown character.
*/
public function sql_like_expression($expression)
{
// Unlike LIKE, GLOB is case sensitive (unfortunatly). SQLite users need to live with it!
// Unlike LIKE, GLOB is unfortunately case sensitive.
// We only catch * and ? here, not the character map possible on file globbing.
$expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
@@ -279,6 +279,23 @@ class sqlite3 extends \phpbb\db\driver\driver
return 'GLOB \'' . $this->sql_escape($expression) . '\'';
}
/**
* {@inheritDoc}
*
* For SQLite an underscore is an unknown character.
*/
public function sql_not_like_expression($expression)
{
// Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive
// We only catch * and ? here, not the character map possible on file globbing.
$expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
$expression = str_replace(array('?', '*'), array("\?", "\*"), $expression);
$expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression);
return 'NOT GLOB \'' . $this->sql_escape($expression) . '\'';
}
/**
* return sql error array
*