OLD | NEW |
1 /* | 1 /* |
2 ** 2007 May 6 | 2 ** 2007 May 6 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 int iPattern = 0; /* Current byte index in zPattern */ | 76 int iPattern = 0; /* Current byte index in zPattern */ |
77 int iString = 0; /* Current byte index in zString */ | 77 int iString = 0; /* Current byte index in zString */ |
78 | 78 |
79 int prevEscape = 0; /* True if the previous character was uEsc */ | 79 int prevEscape = 0; /* True if the previous character was uEsc */ |
80 | 80 |
81 while( zPattern[iPattern]!=0 ){ | 81 while( zPattern[iPattern]!=0 ){ |
82 | 82 |
83 /* Read (and consume) the next character from the input pattern. */ | 83 /* Read (and consume) the next character from the input pattern. */ |
84 UChar32 uPattern; | 84 UChar32 uPattern; |
85 U8_NEXT_UNSAFE(zPattern, iPattern, uPattern); | 85 U8_NEXT_UNSAFE(zPattern, iPattern, uPattern); |
86 assert(uPattern!=0); | |
87 | 86 |
88 /* There are now 4 possibilities: | 87 /* There are now 4 possibilities: |
89 ** | 88 ** |
90 ** 1. uPattern is an unescaped match-all character "%", | 89 ** 1. uPattern is an unescaped match-all character "%", |
91 ** 2. uPattern is an unescaped match-one character "_", | 90 ** 2. uPattern is an unescaped match-one character "_", |
92 ** 3. uPattern is an unescaped escape character, or | 91 ** 3. uPattern is an unescaped escape character, or |
93 ** 4. uPattern is to be handled as an ordinary character | 92 ** 4. uPattern is to be handled as an ordinary character |
94 */ | 93 */ |
95 if( !prevEscape && uPattern==MATCH_ALL ){ | 94 if( !prevEscape && uPattern==MATCH_ALL ){ |
96 /* Case 1. */ | 95 /* Case 1. */ |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 sqlite3_value **apArg | 414 sqlite3_value **apArg |
416 ){ | 415 ){ |
417 sqlite3 *db = (sqlite3 *)sqlite3_user_data(p); | 416 sqlite3 *db = (sqlite3 *)sqlite3_user_data(p); |
418 UErrorCode status = U_ZERO_ERROR; | 417 UErrorCode status = U_ZERO_ERROR; |
419 const char *zLocale; /* Locale identifier - (eg. "jp_JP") */ | 418 const char *zLocale; /* Locale identifier - (eg. "jp_JP") */ |
420 const char *zName; /* SQL Collation sequence name (eg. "japanese") */ | 419 const char *zName; /* SQL Collation sequence name (eg. "japanese") */ |
421 UCollator *pUCollator; /* ICU library collation object */ | 420 UCollator *pUCollator; /* ICU library collation object */ |
422 int rc; /* Return code from sqlite3_create_collation_x() */ | 421 int rc; /* Return code from sqlite3_create_collation_x() */ |
423 | 422 |
424 assert(nArg==2); | 423 assert(nArg==2); |
| 424 (void)nArg; /* Unused parameter */ |
425 zLocale = (const char *)sqlite3_value_text(apArg[0]); | 425 zLocale = (const char *)sqlite3_value_text(apArg[0]); |
426 zName = (const char *)sqlite3_value_text(apArg[1]); | 426 zName = (const char *)sqlite3_value_text(apArg[1]); |
427 | 427 |
428 if( !zLocale || !zName ){ | 428 if( !zLocale || !zName ){ |
429 return; | 429 return; |
430 } | 430 } |
431 | 431 |
432 pUCollator = ucol_open(zLocale, &status); | 432 pUCollator = ucol_open(zLocale, &status); |
433 if( !U_SUCCESS(status) ){ | 433 if( !U_SUCCESS(status) ){ |
434 icuFunctionError(p, "ucol_open", status); | 434 icuFunctionError(p, "ucol_open", status); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 sqlite3 *db, | 495 sqlite3 *db, |
496 char **pzErrMsg, | 496 char **pzErrMsg, |
497 const sqlite3_api_routines *pApi | 497 const sqlite3_api_routines *pApi |
498 ){ | 498 ){ |
499 SQLITE_EXTENSION_INIT2(pApi) | 499 SQLITE_EXTENSION_INIT2(pApi) |
500 return sqlite3IcuInit(db); | 500 return sqlite3IcuInit(db); |
501 } | 501 } |
502 #endif | 502 #endif |
503 | 503 |
504 #endif | 504 #endif |
OLD | NEW |