OLD | NEW |
1 /* | 1 /* |
2 ** 2008 June 13 | 2 ** 2008 June 13 |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 ** The following 256 byte lookup table is used to support SQLites built-in | 63 ** The following 256 byte lookup table is used to support SQLites built-in |
64 ** equivalents to the following standard library functions: | 64 ** equivalents to the following standard library functions: |
65 ** | 65 ** |
66 ** isspace() 0x01 | 66 ** isspace() 0x01 |
67 ** isalpha() 0x02 | 67 ** isalpha() 0x02 |
68 ** isdigit() 0x04 | 68 ** isdigit() 0x04 |
69 ** isalnum() 0x06 | 69 ** isalnum() 0x06 |
70 ** isxdigit() 0x08 | 70 ** isxdigit() 0x08 |
71 ** toupper() 0x20 | 71 ** toupper() 0x20 |
72 ** SQLite identifier character 0x40 | 72 ** SQLite identifier character 0x40 |
| 73 ** Quote character 0x80 |
73 ** | 74 ** |
74 ** Bit 0x20 is set if the mapped character requires translation to upper | 75 ** Bit 0x20 is set if the mapped character requires translation to upper |
75 ** case. i.e. if the character is a lower-case ASCII character. | 76 ** case. i.e. if the character is a lower-case ASCII character. |
76 ** If x is a lower-case ASCII character, then its upper-case equivalent | 77 ** If x is a lower-case ASCII character, then its upper-case equivalent |
77 ** is (x - 0x20). Therefore toupper() can be implemented as: | 78 ** is (x - 0x20). Therefore toupper() can be implemented as: |
78 ** | 79 ** |
79 ** (x & ~(map[x]&0x20)) | 80 ** (x & ~(map[x]&0x20)) |
80 ** | 81 ** |
81 ** Standard function tolower() is implemented using the sqlite3UpperToLower[] | 82 ** The equivalent of tolower() is implemented using the sqlite3UpperToLower[] |
82 ** array. tolower() is used more often than toupper() by SQLite. | 83 ** array. tolower() is used more often than toupper() by SQLite. |
83 ** | 84 ** |
84 ** Bit 0x40 is set if the character non-alphanumeric and can be used in an | 85 ** Bit 0x40 is set if the character is non-alphanumeric and can be used in an |
85 ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any | 86 ** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any |
86 ** non-ASCII UTF character. Hence the test for whether or not a character is | 87 ** non-ASCII UTF character. Hence the test for whether or not a character is |
87 ** part of an identifier is 0x46. | 88 ** part of an identifier is 0x46. |
88 ** | |
89 ** SQLite's versions are identical to the standard versions assuming a | |
90 ** locale of "C". They are implemented as macros in sqliteInt.h. | |
91 */ | 89 */ |
92 #ifdef SQLITE_ASCII | 90 #ifdef SQLITE_ASCII |
93 const unsigned char sqlite3CtypeMap[256] = { | 91 const unsigned char sqlite3CtypeMap[256] = { |
94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ | 92 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ |
95 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ | 93 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ |
96 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ | 94 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ |
97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ | 95 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ |
98 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, /* 20..27 !"#$%&' */ | 96 0x01, 0x00, 0x80, 0x00, 0x40, 0x00, 0x00, 0x80, /* 20..27 !"#$%&' */ |
99 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ | 97 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ |
100 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, /* 30..37 01234567 */ | 98 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, /* 30..37 01234567 */ |
101 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ | 99 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ |
102 | 100 |
103 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ | 101 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ |
104 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ | 102 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ |
105 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ | 103 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ |
106 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, /* 58..5f XYZ[\]^_ */ | 104 0x02, 0x02, 0x02, 0x80, 0x00, 0x00, 0x00, 0x40, /* 58..5f XYZ[\]^_ */ |
107 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ | 105 0x80, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ |
108 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ | 106 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ |
109 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ | 107 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ |
110 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ | 108 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ |
111 | 109 |
112 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 80..87 ........ */ | 110 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 80..87 ........ */ |
113 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 88..8f ........ */ | 111 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 88..8f ........ */ |
114 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 90..97 ........ */ | 112 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 90..97 ........ */ |
115 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 98..9f ........ */ | 113 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 98..9f ........ */ |
116 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a0..a7 ........ */ | 114 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a0..a7 ........ */ |
117 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a8..af ........ */ | 115 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a8..af ........ */ |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 | 150 # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 |
153 #endif | 151 #endif |
154 | 152 |
155 /* The minimum PMA size is set to this value multiplied by the database | 153 /* The minimum PMA size is set to this value multiplied by the database |
156 ** page size in bytes. | 154 ** page size in bytes. |
157 */ | 155 */ |
158 #ifndef SQLITE_SORTER_PMASZ | 156 #ifndef SQLITE_SORTER_PMASZ |
159 # define SQLITE_SORTER_PMASZ 250 | 157 # define SQLITE_SORTER_PMASZ 250 |
160 #endif | 158 #endif |
161 | 159 |
| 160 /* Statement journals spill to disk when their size exceeds the following |
| 161 ** threshold (in bytes). 0 means that statement journals are created and |
| 162 ** written to disk immediately (the default behavior for SQLite versions |
| 163 ** before 3.12.0). -1 means always keep the entire statement journal in |
| 164 ** memory. (The statement journal is also always held entirely in memory |
| 165 ** if journal_mode=MEMORY or if temp_store=MEMORY, regardless of this |
| 166 ** setting.) |
| 167 */ |
| 168 #ifndef SQLITE_STMTJRNL_SPILL |
| 169 # define SQLITE_STMTJRNL_SPILL (64*1024) |
| 170 #endif |
| 171 |
| 172 /* |
| 173 ** The default lookaside-configuration, the format "SZ,N". SZ is the |
| 174 ** number of bytes in each lookaside slot (should be a multiple of 8) |
| 175 ** and N is the number of slots. The lookaside-configuration can be |
| 176 ** changed as start-time using sqlite3_config(SQLITE_CONFIG_LOOKASIDE) |
| 177 ** or at run-time for an individual database connection using |
| 178 ** sqlite3_db_config(db, SQLITE_DBCONFIG_LOOKASIDE); |
| 179 */ |
| 180 #ifndef SQLITE_DEFAULT_LOOKASIDE |
| 181 # define SQLITE_DEFAULT_LOOKASIDE 1200,100 |
| 182 #endif |
| 183 |
| 184 |
162 /* | 185 /* |
163 ** The following singleton contains the global configuration for | 186 ** The following singleton contains the global configuration for |
164 ** the SQLite library. | 187 ** the SQLite library. |
165 */ | 188 */ |
166 SQLITE_WSD struct Sqlite3Config sqlite3Config = { | 189 SQLITE_WSD struct Sqlite3Config sqlite3Config = { |
167 SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ | 190 SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ |
168 1, /* bCoreMutex */ | 191 1, /* bCoreMutex */ |
169 SQLITE_THREADSAFE==1, /* bFullMutex */ | 192 SQLITE_THREADSAFE==1, /* bFullMutex */ |
170 SQLITE_USE_URI, /* bOpenUri */ | 193 SQLITE_USE_URI, /* bOpenUri */ |
171 SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ | 194 SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ |
172 0x7ffffffe, /* mxStrlen */ | 195 0x7ffffffe, /* mxStrlen */ |
173 0, /* neverCorrupt */ | 196 0, /* neverCorrupt */ |
174 128, /* szLookaside */ | 197 SQLITE_DEFAULT_LOOKASIDE, /* szLookaside, nLookaside */ |
175 500, /* nLookaside */ | 198 SQLITE_STMTJRNL_SPILL, /* nStmtSpill */ |
176 {0,0,0,0,0,0,0,0}, /* m */ | 199 {0,0,0,0,0,0,0,0}, /* m */ |
177 {0,0,0,0,0,0,0,0,0}, /* mutex */ | 200 {0,0,0,0,0,0,0,0,0}, /* mutex */ |
178 {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */ | 201 {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */ |
179 (void*)0, /* pHeap */ | 202 (void*)0, /* pHeap */ |
180 0, /* nHeap */ | 203 0, /* nHeap */ |
181 0, 0, /* mnHeap, mxHeap */ | 204 0, 0, /* mnHeap, mxHeap */ |
182 SQLITE_DEFAULT_MMAP_SIZE, /* szMmap */ | 205 SQLITE_DEFAULT_MMAP_SIZE, /* szMmap */ |
183 SQLITE_MAX_MMAP_SIZE, /* mxMmap */ | 206 SQLITE_MAX_MMAP_SIZE, /* mxMmap */ |
184 (void*)0, /* pScratch */ | 207 (void*)0, /* pScratch */ |
185 0, /* szScratch */ | 208 0, /* szScratch */ |
(...skipping 15 matching lines...) Expand all Loading... |
201 0, /* xLog */ | 224 0, /* xLog */ |
202 0, /* pLogArg */ | 225 0, /* pLogArg */ |
203 #ifdef SQLITE_ENABLE_SQLLOG | 226 #ifdef SQLITE_ENABLE_SQLLOG |
204 0, /* xSqllog */ | 227 0, /* xSqllog */ |
205 0, /* pSqllogArg */ | 228 0, /* pSqllogArg */ |
206 #endif | 229 #endif |
207 #ifdef SQLITE_VDBE_COVERAGE | 230 #ifdef SQLITE_VDBE_COVERAGE |
208 0, /* xVdbeBranch */ | 231 0, /* xVdbeBranch */ |
209 0, /* pVbeBranchArg */ | 232 0, /* pVbeBranchArg */ |
210 #endif | 233 #endif |
211 #ifndef SQLITE_OMIT_BUILTIN_TEST | 234 #ifndef SQLITE_UNTESTABLE |
212 0, /* xTestCallback */ | 235 0, /* xTestCallback */ |
213 #endif | 236 #endif |
214 0 /* bLocaltimeFault */ | 237 0, /* bLocaltimeFault */ |
| 238 0x7ffffffe /* iOnceResetThreshold */ |
215 }; | 239 }; |
216 | 240 |
217 /* | 241 /* |
218 ** Hash table for global functions - functions common to all | 242 ** Hash table for global functions - functions common to all |
219 ** database connections. After initialization, this table is | 243 ** database connections. After initialization, this table is |
220 ** read-only. | 244 ** read-only. |
221 */ | 245 */ |
222 SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; | 246 FuncDefHash sqlite3BuiltinFunctions; |
223 | 247 |
224 /* | 248 /* |
225 ** Constant tokens for values 0 and 1. | 249 ** Constant tokens for values 0 and 1. |
226 */ | 250 */ |
227 const Token sqlite3IntTokens[] = { | 251 const Token sqlite3IntTokens[] = { |
228 { "0", 1 }, | 252 { "0", 1 }, |
229 { "1", 1 } | 253 { "1", 1 } |
230 }; | 254 }; |
231 | 255 |
232 | 256 |
233 /* | 257 /* |
234 ** The value of the "pending" byte must be 0x40000000 (1 byte past the | 258 ** The value of the "pending" byte must be 0x40000000 (1 byte past the |
235 ** 1-gibabyte boundary) in a compatible database. SQLite never uses | 259 ** 1-gibabyte boundary) in a compatible database. SQLite never uses |
236 ** the database page that contains the pending byte. It never attempts | 260 ** the database page that contains the pending byte. It never attempts |
237 ** to read or write that page. The pending byte page is set assign | 261 ** to read or write that page. The pending byte page is set aside |
238 ** for use by the VFS layers as space for managing file locks. | 262 ** for use by the VFS layers as space for managing file locks. |
239 ** | 263 ** |
240 ** During testing, it is often desirable to move the pending byte to | 264 ** During testing, it is often desirable to move the pending byte to |
241 ** a different position in the file. This allows code that has to | 265 ** a different position in the file. This allows code that has to |
242 ** deal with the pending byte to run on files that are much smaller | 266 ** deal with the pending byte to run on files that are much smaller |
243 ** than 1 GiB. The sqlite3_test_control() interface can be used to | 267 ** than 1 GiB. The sqlite3_test_control() interface can be used to |
244 ** move the pending byte. | 268 ** move the pending byte. |
245 ** | 269 ** |
246 ** IMPORTANT: Changing the pending byte to any value other than | 270 ** IMPORTANT: Changing the pending byte to any value other than |
247 ** 0x40000000 results in an incompatible database file format! | 271 ** 0x40000000 results in an incompatible database file format! |
(...skipping 10 matching lines...) Expand all Loading... |
258 ** created by mkopcodeh.awk during compilation. Data is obtained | 282 ** created by mkopcodeh.awk during compilation. Data is obtained |
259 ** from the comments following the "case OP_xxxx:" statements in | 283 ** from the comments following the "case OP_xxxx:" statements in |
260 ** the vdbe.c file. | 284 ** the vdbe.c file. |
261 */ | 285 */ |
262 const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; | 286 const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; |
263 | 287 |
264 /* | 288 /* |
265 ** Name of the default collating sequence | 289 ** Name of the default collating sequence |
266 */ | 290 */ |
267 const char sqlite3StrBINARY[] = "BINARY"; | 291 const char sqlite3StrBINARY[] = "BINARY"; |
OLD | NEW |