Implement "NOT LIKE" SQL operator for queries.
"NOT LIKE" operator is a part of SQL92 standard supported by Kexi's database backends. Without it users forced to use constructions such as NOT (a LIKE '%foo%' OR b LIKE '%bar%'), see Kexi forum.
Equivalent condition with NOT LIKE would be more human: a NOT LIKE '%foo%' AND b NOT LIKE '%bar%'.
- Between NOT and LIKE there can be any amount of non-empty white space
- The token should be case-insensitive while parsed in SQL statements
- All properties of LIKE defined by the database backend also apply to NOT LIKE. The difference is in inverting the sense of the test. (See for example 'The LIKE and GLOB operators' section for SQLite at )
- LIKE operator uses the BinaryExpr class, NOT LIKE should too.
- KexiDB's SQL lexer (sqlscanner.l) should introduce a new token: NOT_LIKE, what is analogous to NOT_SIMILAR_TO.
- NOT_LIKE support should be implemented in sqlparser.y (see NOT_SIMILAR_TO for hints).
- Do not forget to execute make parser command in $builddir/libs/db to update generated parser and lexer whenever the .y and .l files change.
Let's perform functional tests for LIKE and NOT LIKE in one go. Positive test cases:
- "Foo" LIKE "%F%"
- "Foo" LIKE "Foo"
Negative test cases:
- "Bar" LIKE "%F%"
- NULL LIKE "x"
TODO: check case sensitivity
TODO: Test db from kexi/newapi would be used. To create the testdb.kexi database:
cd $build/calligra/kexi/tests/newapi ./kexidbtest --test tables sqlite3 testdb.kexi
First, do not forget add -DKDE4_BUILD_TESTS=ON option to cmake so the kexidbtest gets built.