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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ** uregex_open() | 240 ** uregex_open() |
241 ** uregex_matches() | 241 ** uregex_matches() |
242 ** uregex_close() | 242 ** uregex_close() |
243 */ | 243 */ |
244 static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ | 244 static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ |
245 UErrorCode status = U_ZERO_ERROR; | 245 UErrorCode status = U_ZERO_ERROR; |
246 URegularExpression *pExpr; | 246 URegularExpression *pExpr; |
247 UBool res; | 247 UBool res; |
248 const UChar *zString = sqlite3_value_text16(apArg[1]); | 248 const UChar *zString = sqlite3_value_text16(apArg[1]); |
249 | 249 |
| 250 (void)nArg; /* Unused parameter */ |
| 251 |
250 /* If the left hand side of the regexp operator is NULL, | 252 /* If the left hand side of the regexp operator is NULL, |
251 ** then the result is also NULL. | 253 ** then the result is also NULL. |
252 */ | 254 */ |
253 if( !zString ){ | 255 if( !zString ){ |
254 return; | 256 return; |
255 } | 257 } |
256 | 258 |
257 pExpr = sqlite3_get_auxdata(p, 0); | 259 pExpr = sqlite3_get_auxdata(p, 0); |
258 if( !pExpr ){ | 260 if( !pExpr ){ |
259 const UChar *zPattern = sqlite3_value_text16(apArg[0]); | 261 const UChar *zPattern = sqlite3_value_text16(apArg[0]); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 | 470 |
469 {"like", 2, SQLITE_UTF8, 0, icuLikeFunc}, | 471 {"like", 2, SQLITE_UTF8, 0, icuLikeFunc}, |
470 {"like", 3, SQLITE_UTF8, 0, icuLikeFunc}, | 472 {"like", 3, SQLITE_UTF8, 0, icuLikeFunc}, |
471 | 473 |
472 {"icu_load_collation", 2, SQLITE_UTF8, (void*)db, icuLoadCollation}, | 474 {"icu_load_collation", 2, SQLITE_UTF8, (void*)db, icuLoadCollation}, |
473 }; | 475 }; |
474 | 476 |
475 int rc = SQLITE_OK; | 477 int rc = SQLITE_OK; |
476 int i; | 478 int i; |
477 | 479 |
478 for(i=0; rc==SQLITE_OK && i<(sizeof(scalars)/sizeof(struct IcuScalar)); i++){ | 480 for(i=0; rc==SQLITE_OK && i<(int)(sizeof(scalars)/sizeof(scalars[0])); i++){ |
479 struct IcuScalar *p = &scalars[i]; | 481 struct IcuScalar *p = &scalars[i]; |
480 rc = sqlite3_create_function( | 482 rc = sqlite3_create_function( |
481 db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0 | 483 db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0 |
482 ); | 484 ); |
483 } | 485 } |
484 | 486 |
485 return rc; | 487 return rc; |
486 } | 488 } |
487 | 489 |
488 #if !SQLITE_CORE | 490 #if !SQLITE_CORE |
489 int sqlite3_extension_init( | 491 int sqlite3_extension_init( |
490 sqlite3 *db, | 492 sqlite3 *db, |
491 char **pzErrMsg, | 493 char **pzErrMsg, |
492 const sqlite3_api_routines *pApi | 494 const sqlite3_api_routines *pApi |
493 ){ | 495 ){ |
494 SQLITE_EXTENSION_INIT2(pApi) | 496 SQLITE_EXTENSION_INIT2(pApi) |
495 return sqlite3IcuInit(db); | 497 return sqlite3IcuInit(db); |
496 } | 498 } |
497 #endif | 499 #endif |
498 | 500 |
499 #endif | 501 #endif |
OLD | NEW |