You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently experienced a problem with a custom CGridView filter that allows to filter email addresses using partial matching. The filter wasn't working when an underscore character ('_') was present in the filter condition. After investigating a bit, I found out that SQLite doesn't support C-style escaping (cf. https://www.sqlite.org/lang_expr.html) which is used by Yii's DBAL by default (e.g. by CDbCriteria.addSearchCondition or by CDbCommandBuilder.createSearchCondition). In SQLite, you need to extend the LIKE expression by an ESCAPE clause (cf. http://stackoverflow.com/a/7323498).
There's a custom CDbCommandBuilder implementation for SQLite which could be easily adapted / extended, but not for CDbCriteria. Any idea how we could solve this there?
The text was updated successfully, but these errors were encountered:
ckristo
changed the title
C-like escapes in SQLite
C-style escapes in SQLite
May 21, 2015
Hi,
I recently experienced a problem with a custom CGridView filter that allows to filter email addresses using partial matching. The filter wasn't working when an underscore character ('
_
') was present in the filter condition. After investigating a bit, I found out that SQLite doesn't support C-style escaping (cf. https://www.sqlite.org/lang_expr.html) which is used by Yii's DBAL by default (e.g. by CDbCriteria.addSearchCondition or by CDbCommandBuilder.createSearchCondition). In SQLite, you need to extend theLIKE
expression by anESCAPE
clause (cf. http://stackoverflow.com/a/7323498).There's a custom
CDbCommandBuilder
implementation for SQLite which could be easily adapted / extended, but not forCDbCriteria
. Any idea how we could solve this there?The text was updated successfully, but these errors were encountered: