Lines Matching +full:escape +full:- +full:string +full:- +full:regexp
17 ** language. The code for the "sqlite3" command-line shell is also in a
21 ** 2019.09.02-Complete codec logic for encryption and decryption.
39 ** ("International Components for Unicode", an open-source library
43 ** * An implementation of the SQL regexp() function (and hence REGEXP
52 ** provide case-independent matching.
56 #include <string.h>
87 # define SQLITE_EXTENSION_INIT1 /*no-op*/
89 # define SQLITE_EXTENSION_INIT3 /*no-op*/
131 sqlite3_result_error(pCtx, zBuf, -1); in icuFunctionError()
153 ** a multi-byte UTF8 character. It is copied here from SQLite source
170 c = icuUtf8Trans1[c-0xc0]; \
184 ** Compare two UTF-8 strings for equality where the first string is
190 const uint8_t *zString, /* The UTF-8 string to compare against */ in icuLikeCompare()
191 const UChar32 uEsc /* The escape character */ in icuLikeCompare()
207 ** 1. uPattern is an unescaped match-all character "%", in icuLikeCompare()
208 ** 2. uPattern is an unescaped match-one character "_", in icuLikeCompare()
209 ** 3. uPattern is an unescaped escape character, or in icuLikeCompare()
218 ** test string. in icuLikeCompare()
265 ** the build-in LIKE operator. The first argument to the function is the
266 ** pattern and the second argument is the string. So, the SQL statements:
270 ** is implemented as like(B, A). If there is an escape character E,
272 ** A LIKE B ESCAPE E
289 sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); in icuLikeFunc()
295 /* The escape character string must consist of a single UTF-8 character. in icuLikeFunc()
305 "ESCAPE expression must be a single character", -1); in icuLikeFunc()
316 ** Function to delete compiled regexp objects. Registered as
325 ** Implementation of SQLite REGEXP operator. This scalar function takes
327 ** the second is a string to match against that pattern. If either
329 ** is 1 if the string matches the pattern, or 0 otherwise.
331 ** SQLite maps the regexp() function to the regexp() operator such
334 ** zString REGEXP zPattern
335 ** regexp(zPattern, zString)
337 ** Uses the following ICU regexp APIs:
351 /* If the left hand side of the regexp operator is NULL, in icuRegexpFunc()
364 pExpr = uregex_open(zPattern, -1, 0, 0, &status); in icuRegexpFunc()
377 uregex_setText(pExpr, zString, -1, &status); in icuRegexpFunc()
402 ** Implementations of scalar functions for case mapping - upper() and
403 ** lower(). Function upper() converts its input to upper-case (ABC).
404 ** Function lower() converts to lower-case (abc).
413 ** upper('ABC') -> 'abc'
414 ** lower('abc') -> 'ABC'
418 ** of the locale to use. Passing an empty string ("") or SQL NULL value
422 ** lower('I', 'en_us') -> 'i'
423 ** lower('I', 'tr_tr') -> '\u131' (small dotless i)
425 ** http://www.icu-project.org/userguide/posix.html#case_mappings
428 const UChar *zInput; /* Pointer to input string */ in icuCaseFunc16()
430 int nInput; /* Size of utf-16 input string in bytes */ in icuCaseFunc16()
507 case UCOL_LESS: return -1; in icuCollationColl()
522 ** SELECT icu_load_collation(<locale>, <collation-name>);
524 ** Where <locale> is a string containing an ICU locale identifier (i.e.
525 ** "en_AU", "tr_TR" etc.) and <collation-name> is the name of the
535 const char *zLocale; /* Locale identifier - (eg. "jp_JP") */ in icuLoadCollation()
561 sqlite3_result_error(p, "Error registering collation function", -1); in icuLoadCollation()
579 {"regexp", 2, SQLITE_ANY|SQLITEICU_EXTRAFLAGS, 0, icuRegexpFunc}, in sqlite3IcuInit()
602 db, p->zName, p->nArg, p->enc, in sqlite3IcuInit()
603 p->iContext ? (void*)db : (void*)0, in sqlite3IcuInit()
604 p->xFunc, 0, 0 in sqlite3IcuInit()
647 /* #include <string.h> */
666 UBreakIterator *pIter; /* ICU break-iterator object */
668 UChar *aChar; /* Copy of input using utf-16 encoding */
669 int *aOffset; /* Offsets of each character in utf-8 input */
698 p->zLocale = (char *)&p[1]; in icuCreate()
699 memcpy(p->zLocale, argv[0], n); in icuCreate()
717 ** Prepare to begin tokenizing a particular string. The input
718 ** string to be tokenized is pInput[0..nBytes-1]. A cursor
719 ** used to incrementally tokenize this string is returned in
724 const char *zInput, /* Input string */ in icuOpen()
757 pCsr->aChar = (UChar *)&pCsr[1]; in icuOpen()
758 pCsr->aOffset = (int *)&pCsr->aChar[(nChar+3)&~3]; in icuOpen()
760 pCsr->aOffset[iOut] = iInput; in icuOpen()
765 U16_APPEND(pCsr->aChar, iOut, nChar, c, isError); in icuOpen()
770 pCsr->aOffset[iOut] = iInput; in icuOpen()
779 pCsr->pIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status); in icuOpen()
784 pCsr->nChar = iOut; in icuOpen()
786 ubrk_first(pCsr->pIter); in icuOpen()
796 ubrk_close(pCsr->pIter); in icuClose()
797 sqlite3_free(pCsr->zBuffer); in icuClose()
822 iStart = ubrk_current(pCsr->pIter); in icuNext()
823 iEnd = ubrk_next(pCsr->pIter); in icuNext()
830 U16_NEXT(pCsr->aChar, iWhite, pCsr->nChar, c); in icuNext()
843 char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte); in icuNext()
847 pCsr->zBuffer = zNew; in icuNext()
848 pCsr->nBuffer = nByte; in icuNext()
852 pCsr->zBuffer, pCsr->nBuffer, &nByte, /* Output vars */ in icuNext()
853 &pCsr->aChar[iStart], iEnd-iStart, /* Input vars */ in icuNext()
856 } while( nByte>pCsr->nBuffer ); in icuNext()
858 *ppToken = pCsr->zBuffer; in icuNext()
860 *piStartOffset = pCsr->aOffset[iStart]; in icuNext()
861 *piEndOffset = pCsr->aOffset[iEnd]; in icuNext()
862 *piPosition = pCsr->iToken++; in icuNext()