Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch sqlite4_env Excluding Merge-Ins
This is equivalent to a diff from 949cb749fe to dee2172b52
2012-06-25
| ||
19:34 | Merge the sqlite4_env api changes onto trunk. There is still a lot of work to be done, but it at least now passes most tests. check-in: 4192f826d1 user: drh tags: trunk | |
19:28 | Fixes to the kvwrap test interface. At this point, most tests pass, though there are still massive memory leaks. Major unresolved issues: (1) the global function. (2) API for substituting new storage engines. Leaf check-in: dee2172b52 user: drh tags: sqlite4_env | |
18:53 | Initialize the random number generator in sqlite4_initialize(). check-in: a34def59f7 user: drh tags: sqlite4_env | |
2012-06-22
| ||
20:29 | Continuing work on sqlite4_env and getting it to be used everywhere. The changes here are mostly having to do with mutexes. They compile, but there are errors. This is an incremental check-in so that I can change to work on another project where an issue has just come up. check-in: 1d65209131 user: drh tags: sqlite4_env | |
18:06 | Merge trunk changes. check-in: df818c275b user: dan tags: embedded-btree | |
16:55 | Modify sqlite4_mem_methods to remove xRoundup, add the Benign methods, and for all methods to take an environment pointer as their first argument. check-in: 949cb749fe user: drh tags: trunk | |
14:58 | Add the sqlite4_env parameter to sqlite4_threadsafe(). check-in: d3fa91fcba user: drh tags: trunk | |
Changes to src/alter.c.
︙ | |||
75 76 77 78 79 80 81 | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | - + + | len = sqlite4GetToken(zCsr, &token); } while( token==TK_SPACE ); assert( len>0 ); } while( token!=TK_LP && token!=TK_USING ); zRet = sqlite4MPrintf(db, "%.*s\"%w\"%s", ((u8*)tname.z) - zSql, zSql, zTableName, tname.z+tname.n); |
︙ | |||
137 138 139 140 141 142 143 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - + + | zInput = &z[n]; } sqlite4DbFree(db, zParent); } } zResult = sqlite4MPrintf(db, "%s%s", (zOutput?zOutput:""), zInput), |
︙ | |||
214 215 216 217 218 219 220 | 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | - + + - + - + | } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) ); /* Variable tname now contains the token that is the old table-name ** in the CREATE TRIGGER statement. */ zRet = sqlite4MPrintf(db, "%.*s\"%w\"%s", ((u8*)tname.z) - zSql, zSql, zTableName, tname.z+tname.n); |
︙ |
Changes to src/callback.c.
︙ | |||
360 361 362 363 364 365 366 | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | - + | ** Except, if createFlag is true, that means that we are trying to ** install a new function. Whatever FuncDef structure is returned it will ** have fields overwritten with new information appropriate for the ** new function. But the FuncDefs for built-in functions are read-only. ** So we must not search for built-ins when creating a new function. */ if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){ |
︙ |
Changes to src/date.c.
︙ | |||
1112 1113 1114 1115 1116 1117 1118 | 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 | - + | #else STR_FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc), STR_FUNCTION(current_date, 0, "%Y-%m-%d", 0, currentTimeFunc), STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc), #endif }; int i; |
Changes to src/func.c.
︙ | |||
1590 1591 1592 1593 1594 1595 1596 | 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | - + - + | #else LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), #endif }; int i; |
Changes to src/global.c.
︙ | |||
138 139 140 141 142 143 144 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - - + + - - + + - - - + + + + - - - - - - - | 1, /* iVersion */ SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ 1, /* bCoreMutex */ SQLITE_THREADSAFE==1, /* bFullMutex */ 0x7ffffffe, /* mxStrlen */ 128, /* szLookaside */ 500, /* nLookaside */ |
︙ |
Changes to src/main.c.
︙ | |||
78 79 80 81 82 83 84 | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | - + - - - + + - - - - - - - - - - - + - - - - - + - - - - - - - - - + + + + + + - - - - + - - - - - + - - - - - - - - - - - - - - - - - - - - - - - + + + - - - - - - - - - - - + + + + + + - - + - + - - - - - - + + + + - - + - - - - - - - - - - - - - - - - - + - - + - - + - + - - - - - - - - - - - - - - | ** As long as you do not compile with SQLITE_OMIT_AUTOINIT ** this routine will be called automatically by key routines such as ** sqlite4_open(). ** ** This routine is a no-op except on its very first call for a given ** sqlite4_env object, or for the first call after a call to sqlite4_shutdown. ** |
︙ | |||
466 467 468 469 470 471 472 | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | + + + + + + - - - + + + + + + + - - + + + + + + + + + + + + + + + + | /* ** sqlite4_env_config(pEnv, SQLITE_ENVCONFIG_KVSTORE_PUSH, zName, xFactory); ** ** Push a new KVStore factory onto the factory stack. The new factory ** takes priority over prior factories. */ case SQLITE_ENVCONFIG_KVSTORE_PUSH: { const char *zName = va_arg(ap, const char*); if( strcmp(zName, "temp")==0 ){ pEnv->xKVTmp = *va_arg(ap, int (*)(sqlite4_env*, KVStore **, const char *, unsigned int) ); }else{ |
︙ | |||
1751 1752 1753 1754 1755 1756 1757 | 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 | - + | } /* Allocate the sqlite data structure */ db = sqlite4MallocZero(pEnv, sizeof(sqlite4) ); if( db==0 ) goto opendb_out; db->pEnv = pEnv; if( isThreadsafe ){ |
︙ | |||
2082 2083 2084 2085 2086 2087 2088 | 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - | int sqlite4_test_control(int op, ...){ int rc = 0; #ifndef SQLITE_OMIT_BUILTIN_TEST va_list ap; va_start(ap, op); switch( op ){ |
︙ |
Changes to src/malloc.c.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - - - - - - - - - - - - + - + - | ************************************************************************* ** ** Memory allocation functions used throughout sqlite. */ #include "sqliteInt.h" #include <stdarg.h> |
︙ | |||
83 84 85 86 87 88 89 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | - - + + - + - + | ** signed integer value might cause an integer overflow inside of the ** xMalloc(). Hence we limit the maximum size to 0x7fffff00, giving ** 255 bytes of overhead. SQLite itself will never use anything near ** this amount. The only way to reach the limit is with sqlite4_malloc() */ p = 0; }else if( pEnv->bMemstat ){ int nFull = (n + 7)&~7; |
︙ | |||
132 133 134 135 136 137 138 | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | - + - + - + - - + + - + | ** Return the size of a memory allocation previously obtained from ** sqlite4Malloc() or sqlite4_malloc(). */ int sqlite4MallocSize(sqlite4_env *pEnv, void *p){ assert( sqlite4MemdebugHasType(p, MEMTYPE_HEAP) ); assert( sqlite4MemdebugNoType(p, MEMTYPE_DB) ); if( pEnv==0 ) pEnv = &sqlite4DefaultEnv; |
︙ | |||
215 216 217 218 219 220 221 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | - + - + - + - + | if( nBytes>=0x7fffff00 ){ /* The 0x7ffff00 limit term is explained in comments on sqlite4Malloc() */ return 0; } nOld = sqlite4MallocSize(pEnv, pOld); nNew = (nBytes + 7)&~7; if( pEnv->bMemstat ){ |
︙ |
Changes to src/mem0.c.
︙ | |||
52 53 54 55 56 57 58 59 60 61 | 52 53 54 55 56 57 58 59 60 61 62 | + | sqlite4MemInit, sqlite4MemShutdown, 0, 0, 0 }; pEnv->m = defaultMethods; pEnv->m.pMemEnv = (void*)pEnv; } #endif /* SQLITE_ZERO_MALLOC */ |
Changes to src/mem1.c.
︙ | |||
275 276 277 278 279 280 281 282 283 284 | 275 276 277 278 279 280 281 282 283 284 285 | + | sqlite4MemInit, sqlite4MemShutdown, 0, 0, 0 }; pEnv->m = defaultMethods; pEnv->m.pMemEnv = (void*)pEnv; } #endif /* SQLITE_SYSTEM_MALLOC */ |
Changes to src/mem2.c.
︙ | |||
182 183 184 185 186 187 188 | 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | - - + + + - + - - - + + - + - - + + + | pHdr = sqlite4MemsysGetHeader(p); return pHdr->iSize; } /* ** Initialize the memory allocation subsystem. */ |
︙ | |||
390 391 392 393 394 395 396 | 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | - + | ** allocation p. Also return true if p==NULL. ** ** This routine is designed for use within an assert() statement, to ** verify the type of an allocation. For example: ** ** assert( sqlite4MemdebugHasType(p, MEMTYPE_DB) ); */ |
︙ | |||
412 413 414 415 416 417 418 | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | - + | ** allocation p. Also return true if p==NULL. ** ** This routine is designed for use within an assert() statement, to ** verify the type of an allocation. For example: ** ** assert( sqlite4MemdebugNoType(p, MEMTYPE_DB) ); */ |
︙ |
Changes to src/mutex.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - - - - - - - - - - - + - + - - - - - - - - - - + + - + - - - - + - + - - - - - - + - - + + - - - - - - + + - + - + - - + + - - + - + - + - + - + - + - + | ** ************************************************************************* ** This file contains the C functions that implement mutexes. ** ** This file contains code that is common across all mutex implementations. */ #include "sqliteInt.h" |
Changes to src/mutex.h.
︙ | |||
50 51 52 53 54 55 56 | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | - + - - - + + + | # endif #endif #ifdef SQLITE_MUTEX_OMIT /* ** If this is a no-op implementation, implement everything as macros. */ |
Changes to src/mutex_noop.c.
︙ | |||
31 32 33 34 35 36 37 | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | - - - + + + + - - - + + - - - - + + + + + + - + - + - - + + - + - - + - - - - - - - + + + + - - - - - - - - + - - - + - - + - + - + - + - - + + | #ifndef SQLITE_DEBUG /* ** Stub routines for all mutex methods. ** ** This routines provide no mutual exclusion or error checking. */ |
︙ |
Changes to src/mutex_unix.c.
︙ | |||
34 35 36 37 38 39 40 | 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | - + + - + - + + - + - + + - + + - - + + | #else # define SQLITE_MUTEX_NREF 0 #endif /* ** Each recursive mutex is an instance of the following structure. */ |
︙ | |||
122 123 124 125 126 127 128 | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | - - + + - - - - - - - - + - + + - + + + - - - - - + - - + - + + + + - + - - + + + | ** ** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST ** or SQLITE_MUTEX_RECURSIVE) is used then sqlite4_mutex_alloc() ** returns a different mutex on every call. But for the static ** mutex types, the same mutex is returned on every call that has ** the same type number. */ |
︙ | |||
243 244 245 246 247 248 249 | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | - + + - + | #ifdef SQLITE_DEBUG if( p->trace ){ printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); } #endif } |
︙ | |||
300 301 302 303 304 305 306 | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | - - + + + | /* ** The sqlite4_mutex_leave() routine exits a mutex that was ** previously entered by the same thread. The behavior ** is undefined if the mutex is not currently entered or ** is not currently allocated. SQLite will never do either. */ |
︙ | |||
334 335 336 337 338 339 340 | 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | - + - + + | pthreadMutexAlloc, pthreadMutexFree, pthreadMutexEnter, pthreadMutexTry, pthreadMutexLeave, #ifdef SQLITE_DEBUG pthreadMutexHeld, |
Changes to src/os.c.
︙ | |||
13 14 15 16 17 18 19 | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + | ** This file contains OS interface code that is common to all ** architectures. */ #define _SQLITE_OS_C_ 1 #include "sqliteInt.h" #undef _SQLITE_OS_C_ |
Changes to src/random.c.
︙ | |||
14 15 16 17 18 19 20 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - - - - - - - - - - + - - - - - - - - - - - - - + - - - + + - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - + - + - + - - - - - - - - - - - - - - - - - - - - - - | ** ** Random numbers are used by some of the database backends in order ** to generate random integer keys for tables or random filenames. */ #include "sqliteInt.h" |
Changes to src/shell.c.
︙ | |||
2117 2118 2119 2120 2121 2122 2123 | 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 | - - - | }else if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){ static const struct { const char *zCtrlName; /* Name of a test-control option */ int ctrlCode; /* Integer code for that option */ } aCtrl[] = { |
︙ | |||
2165 2166 2167 2168 2169 2170 2171 | 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 | - - - - - - - - - - - - | int opt = (int)strtol(azArg[2], 0, 0); rc = sqlite4_test_control(testctrl, p->db, opt); printf("%d (0x%08x)\n", rc, rc); } else { fprintf(stderr,"Error: testctrl %s takes a single int option\n", azArg[1]); } |
︙ |
Changes to src/sqlite.h.in.
︙ | |||
119 120 121 122 123 124 125 126 127 128 129 130 131 132 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | + | #define SQLITE_ENVCONFIG_MALLOC 7 /* sqlite4_mem_methods* */ #define SQLITE_ENVCONFIG_GETMALLOC 8 /* sqlite4_mem_methods* */ #define SQLITE_ENVCONFIG_MEMSTATUS 9 /* boolean */ #define SQLITE_ENVCONFIG_LOOKASIDE 10 /* size, count */ #define SQLITE_ENVCONFIG_LOG 11 /* xLog, pArg */ #define SQLITE_ENVCONFIG_KVSTORE_PUSH 12 /* name, factory */ #define SQLITE_ENVCONFIG_KVSTORE_POP 13 /* name */ #define SQLITE_ENVCONFIG_KVSTORE_GET 14 /* name, *factor */ /* ** CAPIREF: Compile-Time Library Version Numbers ** ** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite4.h header ** evaluates to a string literal that is the SQLite version in the |
︙ | |||
531 532 533 534 535 536 537 538 539 540 541 542 543 544 | 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 | + + + + | ** abstract type for a mutex object. The SQLite core never looks ** at the internal representation of an [sqlite4_mutex]. It only ** deals with pointers to the [sqlite4_mutex] object. ** ** Mutexes are created using [sqlite4_mutex_alloc()]. */ typedef struct sqlite4_mutex sqlite4_mutex; struct sqlite4_mutex { struct sqlite4_mutex_methods *pMutexMethods; /* Subclasses will typically add additional fields */ }; /* ** CAPIREF: Initialize The SQLite Library ** ** ^The sqlite4_initialize(A) routine initializes an sqlite4_env object A. ** ^The sqlite4_shutdown(A) routine ** deallocates any resources that were allocated by sqlite4_initialize(A). |
︙ | |||
646 647 648 649 650 651 652 | 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - - + + - + | ** CAPIREF: Memory Allocation Routines ** ** An instance of this object defines the interface between SQLite ** and low-level memory allocation routines. ** ** This object is used in only one place in the SQLite interface. ** A pointer to an instance of this object is the argument to |
︙ | |||
684 685 686 687 688 689 690 | 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 | - + | ** or [sqlite4_realloc()] first calls xRoundup. If xRoundup returns 0, ** that causes the corresponding memory allocation to fail. ** ** The xInit method initializes the memory allocator. (For example, ** it might allocate any require mutexes or initialize internal data ** structures. The xShutdown method is invoked (indirectly) by ** [sqlite4_shutdown()] and should deallocate any resources acquired |
︙ | |||
711 712 713 714 715 716 717 | 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 | - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | void (*xFree)(void*,void*); /* Free a prior allocation */ void *(*xRealloc)(void*,void*,int); /* Resize an allocation */ sqlite4_size_t (*xSize)(void*,void*); /* Return the size of an allocation */ int (*xInit)(void*); /* Initialize the memory allocator */ void (*xShutdown)(void*); /* Deinitialize the allocator */ void (*xBeginBenign)(void*); /* Enter a benign malloc region */ void (*xEndBenign)(void*); /* Leave a benign malloc region */ |
︙ | |||
3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 | 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 | + + + | ** of the new function always causes an exception to be thrown. So ** the new function is not good for anything by itself. Its only ** purpose is to be a placeholder function that can be overloaded ** by a [virtual table]. */ int sqlite4_overload_function(sqlite4*, const char *zFuncName, int nArg); /* ** /* ** CAPIREF: Mutexes ** ** The SQLite core uses these routines for thread ** synchronization. Though they are intended for internal ** use by SQLite, code that links against SQLite is ** permitted to use any of these routines. |
︙ | |||
3715 3716 3717 3718 3719 3720 3721 | 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 | - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - | ** that means that a mutex could not be allocated. ^SQLite ** will unwind its stack and return an error. ^(The argument ** to sqlite4_mutex_alloc() is one of these integer constants: ** ** <ul> ** <li> SQLITE_MUTEX_FAST ** <li> SQLITE_MUTEX_RECURSIVE |
︙ | |||
3786 3787 3788 3789 3790 3791 3792 | 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 | - + | ** ** ^If the argument to sqlite4_mutex_enter(), sqlite4_mutex_try(), or ** sqlite4_mutex_leave() is a NULL pointer, then all three routines ** behave as no-ops. ** ** See also: [sqlite4_mutex_held()] and [sqlite4_mutex_notheld()]. */ |
︙ | |||
3859 3860 3861 3862 3863 3864 3865 | 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 | - - - + + + + | ** ^SQLite will invoke the xMutexEnd() method when [sqlite4_shutdown()] is ** called, but only if the prior call to xMutexInit returned SQLITE_OK. ** If xMutexInit fails in any way, it is expected to clean up after itself ** prior to returning. */ typedef struct sqlite4_mutex_methods sqlite4_mutex_methods; struct sqlite4_mutex_methods { |
︙ | |||
3916 3917 3918 3919 3920 3921 3922 | 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 | - - - - - - - - | ** ** The set of static mutexes may change from one SQLite release to the ** next. Applications that override the built-in mutex logic must be ** prepared to accommodate additional static mutexes. */ #define SQLITE_MUTEX_FAST 0 #define SQLITE_MUTEX_RECURSIVE 1 |
︙ | |||
4008 4009 4010 4011 4012 4013 4014 | 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 | - + - - - - - - - - - - - - - - + + + + + + + + + + + | ** as the first argument to [sqlite4_test_control()]. ** ** These parameters and their meanings are subject to change ** without notice. These values are for testing purposes only. ** Applications should not use any of these parameters or the ** [sqlite4_test_control()] interface. */ |
︙ |
Changes to src/sqliteInt.h.
︙ | |||
2409 2410 2411 2412 2413 2414 2415 | 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 | - - - - - + + + + | int (*xKVFile)(sqlite4_env*, KVStore**, const char*, unsigned int); int (*xKVTmp)(sqlite4_env*, KVStore**, const char*, unsigned int); int (*xRandomness)(sqlite4_env*, int, unsigned char*); int (*xCurrentTime)(sqlite4_env*, sqlite4_uint64*); /* The above might be initialized to non-zero. The following need to always ** initially be zero, however. */ int isInit; /* True after initialization has finished */ |
︙ | |||
2568 2569 2570 2571 2572 2573 2574 | 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 | - - - + + + | const sqlite4_mem_methods *sqlite4MemGetMemsys5(void); #endif #ifndef SQLITE_MUTEX_OMIT sqlite4_mutex_methods const *sqlite4DefaultMutex(void); sqlite4_mutex_methods const *sqlite4NoopMutex(void); |
︙ | |||
2955 2956 2957 2958 2959 2960 2961 | 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 | - + | extern SQLITE_WSD FuncDefHash sqlite4GlobalFunctions; #ifndef SQLITE_OMIT_WSD extern int sqlite4PendingByte; #endif #endif void sqlite4RootPageMoved(sqlite4*, int, int, int); void sqlite4Reindex(Parse*, Token*, Token*); |
︙ | |||
3194 3195 3196 3197 3198 3199 3200 | 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 | - - + + | ** this constraint. ** ** All of this is no-op for a production build. It only comes into ** play when the SQLITE_MEMDEBUG compile-time option is used. */ #ifdef SQLITE_MEMDEBUG void sqlite4MemdebugSetType(void*,u8); |
Changes to src/vdbeapi.c.
︙ | |||
191 192 193 194 195 196 197 198 199 200 201 202 203 204 | 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | + + + + + | static void setResultStrOrError( sqlite4_context *pCtx, /* Function context */ const char *z, /* String pointer */ int n, /* Bytes in string, or negative */ u8 enc, /* Encoding of z. 0 for BLOBs */ void (*xDel)(void*) /* Destructor function */ ){ if( xDel==SQLITE_DYNAMIC ){ assert( sqlite4MemdebugHasType(z, MEMTYPE_HEAP) ); assert( sqlite4MemdebugNoType(z, ~MEMTYPE_HEAP) ); sqlite4MemdebugSetType(z, MEMTYPE_DB | MEMTYPE_HEAP); } if( sqlite4VdbeMemSetStr(&pCtx->s, z, n, enc, xDel)==SQLITE_TOOBIG ){ sqlite4_result_error_toobig(pCtx); } } void sqlite4_result_blob( sqlite4_context *pCtx, const void *z, |
︙ |
Changes to test/log1.test.
︙ | |||
434 435 436 437 438 439 440 441 442 443 444 445 446 447 | 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | + | copy_db_files test.db test.db2 sqlite4 db2 test.db2 execsql { SELECT count(*) FROM t1 ; PRAGMA integrity_check } db2 } {21 ok} db2 close do_test 11.21 { sqlite4_lsm_work db main -flush } {0} db eval {SELECT randstr(5,5)} do_execsql_test 11.22 { INSERT INTO t1 VALUES(randstr(10,10), randstr(100,100)); } do_test 11.23 { sqlite4_lsm_info db main log-structure } {1335 1482 0 1259 1483 1908} do_test 11.24 { sqlite4_lsm_work db main -checkpoint } {0} |
︙ |
Changes to test/test_main.c.
︙ | |||
3969 3970 3971 3972 3973 3974 3975 | 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | } if( Tcl_GetIntFromObj(interp, objv[3], &val) ) return TCL_ERROR; rc = sqlite4_limit(db, id, val); Tcl_SetObjResult(interp, Tcl_NewIntObj(rc)); return TCL_OK; } |
︙ | |||
4503 4504 4505 4506 4507 4508 4509 | 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 | - - - | { "sqlite4_stmt_busy", test_stmt_busy ,0 }, { "uses_stmt_journal", uses_stmt_journal ,0 }, { "sqlite4_db_release_memory", test_db_release_memory, 0}, { "sqlite4_limit", test_limit, 0}, |
︙ |
Changes to test/test_malloc.c.
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + - + - + - + - + - + | ** A version of sqlite4_mem_methods.xMalloc() that includes fault simulation ** logic. */ static void *faultsimMalloc(void *pMem, sqlite4_size_t n){ void *p = 0; assert( pMem==(void*)&memfault ); if( !faultsimStep() ){ |
︙ | |||
187 188 189 190 191 192 193 | 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | - + | faultsimFree, /* xFree */ faultsimRealloc, /* xRealloc */ faultsimSize, /* xSize */ faultsimInit, /* xInit */ faultsimShutdown, /* xShutdown */ faultsimBeginBenign, /* xBeginBenign */ faultsimEndBenign, /* xEndBenign */ |
︙ |
Changes to test/test_mutex.c.
︙ | |||
19 20 21 22 23 24 25 | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | - + + - + - - + + - + + - + - + - + - + - + - + - + - - - + - - - - - + - + + - + + - + + - + + | #include <assert.h> #include <string.h> /* defined in test1.c */ const char *sqlite4TestErrorName(int); /* A countable mutex */ |
︙ | |||
190 191 192 193 194 195 196 | 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | - + + | counterMutexEnd, counterMutexAlloc, counterMutexFree, counterMutexEnter, counterMutexTry, counterMutexLeave, counterMutexHeld, |
︙ | |||
297 298 299 300 301 302 303 | 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | - + | static int test_alloc_mutex( void * clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[] ){ #if SQLITE_THREADSAFE |
︙ |
Changes to test/test_storage2.c.
︙ | |||
285 286 287 288 289 290 291 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | - - + + | static int kvwrap_install_cmd(Tcl_Interp *interp, int objc, Tcl_Obj **objv){ if( objc!=2 ){ Tcl_WrongNumArgs(interp, 2, objv, ""); return TCL_ERROR; } if( kvwg.xFactory==0 ){ |
︙ |
Changes to test/tester.tcl.
︙ | |||
1034 1035 1036 1037 1038 1039 1040 | 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | - + | # TEMPORARY: For 3.5.9, disable testing of extended result codes. There are # a couple of obscure IO errors that do not return them. set ::ioerropts(-erc) 0 set ::go 1 #reset_prng_state |
︙ | |||
1457 1458 1459 1460 1461 1462 1463 | 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 | - + | if {$tail != $::G(start:file) && $tail!="$::G(start:file).test"} return unset ::G(start:file) } # Run the test script in a slave interpreter. # unset -nocomplain ::run_thread_tests_called |
︙ |
Changes to test/where.test.
︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | + + + + | # focus of this file is testing the use of indices in WHERE clases. # # $Id: where.test,v 1.50 2008/11/03 09:06:06 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl db close kvwrap install sqlite4 db test.db # Build some test data # do_test where-1.0 { execsql { CREATE TABLE t1(w int, x int, y int); CREATE TABLE t2(p int, q int, r int, s int); } |
︙ |