Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Bungled checkin. Ignore. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | mistake |
Files: | files | file ages | folders |
SHA3-256: |
9b6e9a6e45f3da3ac76b40f1c56d6aa0 |
User & Date: | drh 2018-12-05 23:25:44.057 |
Original Comment: | Simplify the sqlite3_normalized_sql() implementation so that it asssumes well-formed SQL inputs in this sense: double-quoted names are always taken to be valid identifiers and never string literals. |
Context
2018-12-05
| ||
23:25 | Bungled checkin. Ignore. (Closed-Leaf check-in: 9b6e9a6e45 user: drh tags: mistake) | |
21:55 | Fix an imbalanced lock problem in sqlite3Normalize() introduced by the simplification in [94ea6379178e3ff6a]. (check-in: f69624373e user: drh tags: trunk) | |
Changes
Changes to src/prepare.c.
︙ | |||
712 713 714 715 716 717 718 719 720 721 722 723 724 725 | 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 | + | #ifdef SQLITE_ENABLE_NORMALIZE /* ** Checks if the specified token is a table, column, or function name, ** based on the databases associated with the statement being prepared. ** If the function fails, zero is returned and pRc is filled with the ** error code. */ #if 0 static int shouldTreatAsIdentifier( sqlite3 *db, /* Database handle. */ const char *zToken, /* Pointer to start of token to be checked */ int nToken, /* Length of token to be checked */ int *pRc /* Pointer to error code upon failure */ ){ int bFound = 0; /* Non-zero if token is an identifier name. */ |
︙ | |||
793 794 795 796 797 798 799 800 801 802 803 804 805 806 | 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 | + | done2: sqlite3BtreeLeaveAll(db); sqlite3_mutex_leave(db->mutex); done1: if( zId!=zSpace ) sqlite3DbFree(db, zId); return bFound; } #endif /* ** Attempt to estimate the final output buffer size needed for the fully ** normalized version of the specified SQL string. This should take into ** account any potential expansion that could occur (e.g. via IN clauses ** being expanded, etc). This size returned is the total number of bytes ** including the NUL terminator. |
︙ | |||
968 969 970 971 972 973 974 | 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 | - + + + | break; } } if( j>0 && sqlite3IsIdChar(z[j-1]) && sqlite3IsIdChar(zSql[i]) ){ z[j++] = ' '; } if( tokenType==TK_ID ){ |
︙ |
Changes to test/normalize.test.
︙ | |||
203 204 205 206 207 208 209 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | - + | {SELECT a FROM t1 WHERE x IN (1,2,3) AND hex8('abc');} 0x2 {0 {SELECT a FROM t1 WHERE x IN(?,?,?)AND hex8(?);}} 430 {SELECT "a" FROM t1 WHERE "x" IN ("1","2",'3');} 0x2 |
︙ |