Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the SQLITE_CASE_SENSITIVE_LIKE compile-time option. (CVS 2539) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
b72bff81f9937378417a0af0610d8558 |
User & Date: | drh 2005-07-08 13:53:22.000 |
Context
2005-07-08
| ||
14:14 | Add the EP_OptOnly flag on expressions for WHERE clause terms that are added by the optimizer but should not be coded. (CVS 2540) (check-in: f4a66ed04d user: drh tags: trunk) | |
13:53 | Add the SQLITE_CASE_SENSITIVE_LIKE compile-time option. (CVS 2539) (check-in: b72bff81f9 user: drh tags: trunk) | |
13:08 | Replace OP_List with OP_Fifo. This is the first step toward allowing recursive delete triggers and later foreign keys with cascading deletes. (CVS 2538) (check-in: 94c120bb78 user: drh tags: trunk) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: func.c,v 1.101 2005/07/08 13:53:22 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> #include <math.h> #include <stdlib.h> #include <assert.h> #include "vdbeInt.h" |
︙ | ︙ | |||
305 306 307 308 309 310 311 | struct compareInfo { u8 matchAll; u8 matchOne; u8 matchSet; u8 noCase; }; static const struct compareInfo globInfo = { '*', '?', '[', 0 }; | > > > | > > > > > | 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | struct compareInfo { u8 matchAll; u8 matchOne; u8 matchSet; u8 noCase; }; static const struct compareInfo globInfo = { '*', '?', '[', 0 }; #ifndef SQLITE_CASE_SENSITIVE_LIKE /* The correct SQL-92 behavior is for the LIKE operator to ignore ** case. Thus 'a' LIKE 'A' would be true. */ static const struct compareInfo likeInfo = { '%', '_', 0, 1 }; #else /* If SQLITE_CASE_SENSITIVE_LIKE is defined, then the LIKE operator ** is case sensitive causing 'a' LIKE 'A' to be false */ static const struct compareInfo likeInfo = { '%', '_', 0, 0 }; #endif /* ** X is a pointer to the first byte of a UTF-8 character. Increment ** X so that it points to the next character. This only works right ** if X points to a well-formed UTF-8 string. */ #define sqliteNextChar(X) while( (0xc0&*++(X))==0x80 ){} |
︙ | ︙ |
Changes to test/expr.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing expressions. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements regression tests for SQLite library. The # focus of this file is testing expressions. # # $Id: expr.test,v 1.44 2005/07/08 13:53:22 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # Create a table to work with. # execsql {CREATE TABLE test1(i1 int, i2 int, r1 real, r2 real, t1 text, t2 text)} |
︙ | ︙ | |||
202 203 204 205 206 207 208 | test_expr epxr-3.39 {t1='abc', t2=NULL} {coalesce(t1>=t2,99)} 99 test_expr epxr-3.40 {t1='abc', t2=NULL} {coalesce(t2>=t1,99)} 99 test_expr epxr-3.41 {t1='abc', t2=NULL} {coalesce(t1==t2,99)} 99 test_expr epxr-3.42 {t1='abc', t2=NULL} {coalesce(t2==t1,99)} 99 test_expr epxr-3.43 {t1='abc', t2=NULL} {coalesce(t1!=t2,99)} 99 test_expr epxr-3.44 {t1='abc', t2=NULL} {coalesce(t2!=t1,99)} 99 | < > > > > > > > | > | > | | > | > | > | > > | | | | > > > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > | > > | > > | > > | | > > | > > | > > | | > > | > > | > > | > > | > > | | | 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | test_expr epxr-3.39 {t1='abc', t2=NULL} {coalesce(t1>=t2,99)} 99 test_expr epxr-3.40 {t1='abc', t2=NULL} {coalesce(t2>=t1,99)} 99 test_expr epxr-3.41 {t1='abc', t2=NULL} {coalesce(t1==t2,99)} 99 test_expr epxr-3.42 {t1='abc', t2=NULL} {coalesce(t2==t1,99)} 99 test_expr epxr-3.43 {t1='abc', t2=NULL} {coalesce(t1!=t2,99)} 99 test_expr epxr-3.44 {t1='abc', t2=NULL} {coalesce(t2!=t1,99)} 99 test_expr expr-4.1 {t1='abc', t2='Abc'} {t1<t2} 0 test_expr expr-4.2 {t1='abc', t2='Abc'} {t1>t2} 1 test_expr expr-4.3 {t1='abc', t2='Bbc'} {t1<t2} 0 test_expr expr-4.4 {t1='abc', t2='Bbc'} {t1>t2} 1 test_expr expr-4.5 {t1='0', t2='0.0'} {t1==t2} 0 test_expr expr-4.6 {t1='0.000', t2='0.0'} {t1==t2} 0 test_expr expr-4.7 {t1=' 0.000', t2=' 0.0'} {t1==t2} 0 test_expr expr-4.8 {t1='0.0', t2='abc'} {t1<t2} 1 test_expr expr-4.9 {t1='0.0', t2='abc'} {t1==t2} 0 test_expr expr-4.10 {r1='0.0', r2='abc'} {r1>r2} 0 test_expr expr-4.11 {r1='abc', r2='Abc'} {r1<r2} 0 test_expr expr-4.12 {r1='abc', r2='Abc'} {r1>r2} 1 test_expr expr-4.13 {r1='abc', r2='Bbc'} {r1<r2} 0 test_expr expr-4.14 {r1='abc', r2='Bbc'} {r1>r2} 1 test_expr expr-4.15 {r1='0', r2='0.0'} {r1==r2} 1 test_expr expr-4.16 {r1='0.000', r2='0.0'} {r1==r2} 1 test_expr expr-4.17 {r1=' 0.000', r2=' 0.0'} {r1==r2} 0 test_expr expr-4.18 {r1='0.0', r2='abc'} {r1<r2} 1 test_expr expr-4.19 {r1='0.0', r2='abc'} {r1==r2} 0 test_expr expr-4.20 {r1='0.0', r2='abc'} {r1>r2} 0 # CSL is true if LIKE is case sensitive and false if not. # NCSL is the opposite. Use these variables as the result # on operations where case makes a difference. set CSL $sqlite_options(casesensitivelike) set NCSL [expr {!$CSL}] test_expr expr-5.1 {t1='abc', t2='xyz'} {t1 LIKE t2} 0 test_expr expr-5.2a {t1='abc', t2='abc'} {t1 LIKE t2} 1 test_expr expr-5.2b {t1='abc', t2='ABC'} {t1 LIKE t2} $NCSL test_expr expr-5.3a {t1='abc', t2='a_c'} {t1 LIKE t2} 1 test_expr expr-5.3b {t1='abc', t2='A_C'} {t1 LIKE t2} $NCSL test_expr expr-5.4 {t1='abc', t2='abc_'} {t1 LIKE t2} 0 test_expr expr-5.5a {t1='abc', t2='a%c'} {t1 LIKE t2} 1 test_expr expr-5.5b {t1='abc', t2='A%C'} {t1 LIKE t2} $NCSL test_expr expr-5.5c {t1='abdc', t2='a%c'} {t1 LIKE t2} 1 test_expr expr-5.5d {t1='ac', t2='a%c'} {t1 LIKE t2} 1 test_expr expr-5.5e {t1='ac', t2='A%C'} {t1 LIKE t2} $NCSL test_expr expr-5.6a {t1='abxyzzyc', t2='a%c'} {t1 LIKE t2} 1 test_expr expr-5.6b {t1='abxyzzyc', t2='A%C'} {t1 LIKE t2} $NCSL test_expr expr-5.7a {t1='abxyzzy', t2='a%c'} {t1 LIKE t2} 0 test_expr expr-5.7b {t1='abxyzzy', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.8a {t1='abxyzzycx', t2='a%c'} {t1 LIKE t2} 0 test_expr expr-5.8b {t1='abxyzzycy', t2='a%cx'} {t1 LIKE t2} 0 test_expr expr-5.8c {t1='abxyzzycx', t2='A%C'} {t1 LIKE t2} 0 test_expr expr-5.8d {t1='abxyzzycy', t2='A%CX'} {t1 LIKE t2} 0 test_expr expr-5.9a {t1='abc', t2='a%_c'} {t1 LIKE t2} 1 test_expr expr-5.9b {t1='ac', t2='a%_c'} {t1 LIKE t2} 0 test_expr expr-5.9c {t1='abc', t2='A%_C'} {t1 LIKE t2} $NCSL test_expr expr-5.9d {t1='ac', t2='A%_C'} {t1 LIKE t2} 0 test_expr expr-5.10a {t1='abxyzzyc', t2='a%_c'} {t1 LIKE t2} 1 test_expr expr-5.10b {t1='abxyzzyc', t2='A%_C'} {t1 LIKE t2} $NCSL test_expr expr-5.11 {t1='abc', t2='xyz'} {t1 NOT LIKE t2} 1 test_expr expr-5.12a {t1='abc', t2='abc'} {t1 NOT LIKE t2} 0 test_expr expr-5.12b {t1='abc', t2='ABC'} {t1 NOT LIKE t2} $CSL # The following tests only work on versions of TCL that support Unicode # if {"\u1234"!="u1234"} { test_expr expr-5.13a "t1='a\u0080c', t2='a_c'" {t1 LIKE t2} 1 test_expr expr-5.13b "t1='a\u0080c', t2='A_C'" {t1 LIKE t2} $NCSL test_expr expr-5.14a "t1='a\u07FFc', t2='a_c'" {t1 LIKE t2} 1 test_expr expr-5.14b "t1='a\u07FFc', t2='A_C'" {t1 LIKE t2} $NCSL test_expr expr-5.15a "t1='a\u0800c', t2='a_c'" {t1 LIKE t2} 1 test_expr expr-5.15b "t1='a\u0800c', t2='A_C'" {t1 LIKE t2} $NCSL test_expr expr-5.16a "t1='a\uFFFFc', t2='a_c'" {t1 LIKE t2} 1 test_expr expr-5.16b "t1='a\uFFFFc', t2='A_C'" {t1 LIKE t2} $NCSL test_expr expr-5.17 "t1='a\u0080', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.18 "t1='a\u07FF', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.19 "t1='a\u0800', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.20 "t1='a\uFFFF', t2='A__'" {t1 LIKE t2} 0 test_expr expr-5.21a "t1='ax\uABCD', t2='a_\uABCD'" {t1 LIKE t2} 1 test_expr expr-5.21b "t1='ax\uABCD', t2='A_\uABCD'" {t1 LIKE t2} $NCSL test_expr expr-5.22a "t1='ax\u1234', t2='a%\u1234'" {t1 LIKE t2} 1 test_expr expr-5.22b "t1='ax\u1234', t2='A%\u1234'" {t1 LIKE t2} $NCSL test_expr expr-5.23a "t1='ax\uFEDC', t2='a_%'" {t1 LIKE t2} 1 test_expr expr-5.23b "t1='ax\uFEDC', t2='A_%'" {t1 LIKE t2} $NCSL test_expr expr-5.24a "t1='ax\uFEDCy\uFEDC', t2='a%\uFEDC'" {t1 LIKE t2} 1 test_expr expr-5.24b "t1='ax\uFEDCy\uFEDC', t2='A%\uFEDC'" {t1 LIKE t2} $NCSL } test_expr expr-5.54 {t1='abc', t2=NULL} {t1 LIKE t2} {{}} test_expr expr-5.55 {t1='abc', t2=NULL} {t1 NOT LIKE t2} {{}} test_expr expr-5.56 {t1='abc', t2=NULL} {t2 LIKE t1} {{}} test_expr expr-5.57 {t1='abc', t2=NULL} {t2 NOT LIKE t1} {{}} # LIKE expressions that use ESCAPE characters. test_expr expr-5.58a {t1='abc', t2='a_c'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.58b {t1='abc', t2='A_C'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.59a {t1='a_c', t2='a7_c'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.59b {t1='a_c', t2='A7_C'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.60a {t1='abc', t2='a7_c'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.60b {t1='abc', t2='A7_C'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.61a {t1='a7Xc', t2='a7_c'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.61b {t1='a7Xc', t2='A7_C'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.62a {t1='abcde', t2='a%e'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.62b {t1='abcde', t2='A%E'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.63a {t1='abcde', t2='a7%e'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.63b {t1='abcde', t2='A7%E'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.64a {t1='a7cde', t2='a7%e'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.64b {t1='a7cde', t2='A7%E'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.65a {t1='a7cde', t2='a77%e'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.65b {t1='a7cde', t2='A77%E'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.66a {t1='abc7', t2='a%77'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.66b {t1='abc7', t2='A%77'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.67a {t1='abc_', t2='a%7_'} {t1 LIKE t2 ESCAPE '7'} 1 test_expr expr-5.67b {t1='abc_', t2='A%7_'} {t1 LIKE t2 ESCAPE '7'} $NCSL test_expr expr-5.68a {t1='abc7', t2='a%7_'} {t1 LIKE t2 ESCAPE '7'} 0 test_expr expr-5.68b {t1='abc7', t2='A%7_'} {t1 LIKE t2 ESCAPE '7'} 0 # These are the same test as the block above, but using a multi-byte # character as the escape character. if {"\u1234"!="u1234"} { test_expr expr-5.69a "t1='abc', t2='a_c'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.69b "t1='abc', t2='A_C'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.70a "t1='a_c', t2='a\u1234_c'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.70b "t1='a_c', t2='A\u1234_C'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.71a "t1='abc', t2='a\u1234_c'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.71b "t1='abc', t2='A\u1234_C'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.72a "t1='a\u1234Xc', t2='a\u1234_c'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.72b "t1='a\u1234Xc', t2='A\u1234_C'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.73a "t1='abcde', t2='a%e'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.73b "t1='abcde', t2='A%E'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.74a "t1='abcde', t2='a\u1234%e'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.74b "t1='abcde', t2='A\u1234%E'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.75a "t1='a\u1234cde', t2='a\u1234%e'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.75b "t1='a\u1234cde', t2='A\u1234%E'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.76a "t1='a\u1234cde', t2='a\u1234\u1234%e'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.76b "t1='a\u1234cde', t2='A\u1234\u1234%E'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.77a "t1='abc\u1234', t2='a%\u1234\u1234'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.77b "t1='abc\u1234', t2='A%\u1234\u1234'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.78a "t1='abc_', t2='a%\u1234_'" \ "t1 LIKE t2 ESCAPE '\u1234'" 1 test_expr expr-5.78b "t1='abc_', t2='A%\u1234_'" \ "t1 LIKE t2 ESCAPE '\u1234'" $NCSL test_expr expr-5.79a "t1='abc\u1234', t2='a%\u1234_'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 test_expr expr-5.79b "t1='abc\u1234', t2='A%\u1234_'" \ "t1 LIKE t2 ESCAPE '\u1234'" 0 } test_expr expr-6.1 {t1='abc', t2='xyz'} {t1 GLOB t2} 0 test_expr expr-6.2 {t1='abc', t2='ABC'} {t1 GLOB t2} 0 test_expr expr-6.3 {t1='abc', t2='A?C'} {t1 GLOB t2} 0 test_expr expr-6.4 {t1='abc', t2='a?c'} {t1 GLOB t2} 1 |
︙ | ︙ |