Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Initialize the global built-in function table at start-time instead of at compile-time. This is less prone to malfunction when compile-time parameters very. (CVS 5583) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
ef6936e50adb9ebea39c890167403fff |
User & Date: | drh 2008-08-21 18:49:28.000 |
Context
2008-08-21
| ||
19:28 | Remove references to OP_MoveTo in comments of vdbe.c - that opcode no longer exists. Ticket #3327. (CVS 5584) (check-in: 30077ece45 user: drh tags: trunk) | |
18:49 | Initialize the global built-in function table at start-time instead of at compile-time. This is less prone to malfunction when compile-time parameters very. (CVS 5583) (check-in: ef6936e50a user: drh tags: trunk) | |
15:54 | Fix soft-heap-limit related test suite failures. (CVS 5582) (check-in: 2091d9a526 user: danielk1977 tags: trunk) | |
Changes
Changes to Makefile.in.
︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | - + | # You should not have to change anything below this line ############################################################################### # Object files for the SQLite library (non-amalgamation). # OBJS0 = alter.lo analyze.lo attach.lo auth.lo bitvec.lo btmutex.lo \ btree.lo build.lo callback.lo complete.lo date.lo \ |
︙ | |||
194 195 196 197 198 199 200 201 202 203 204 205 206 207 | 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | + | $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/complete.c \ $(TOP)/src/date.c \ $(TOP)/src/delete.c \ $(TOP)/src/expr.c \ $(TOP)/src/fault.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ $(TOP)/src/hash.c \ $(TOP)/src/hash.h \ $(TOP)/src/hwtime.h \ $(TOP)/src/insert.c \ $(TOP)/src/journal.c \ $(TOP)/src/legacy.c \ |
︙ | |||
261 262 263 264 265 266 267 | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | - | $(TOP)/src/vtab.c \ $(TOP)/src/walker.c \ $(TOP)/src/where.c # Generated source code files # SRC += \ |
︙ | |||
517 518 519 520 521 522 523 | 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 | - - + + | expr.lo: $(TOP)/src/expr.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/expr.c fault.lo: $(TOP)/src/fault.c $(HDR) $(LTCOMPILE) -c $(TOP)/src/fault.c |
︙ | |||
612 613 614 615 616 617 618 | 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | - - - - - | parse.c: $(TOP)/src/parse.y lemon$(BEXE) $(TOP)/addopcodes.awk cp $(TOP)/src/parse.y . ./lemon$(BEXE) $(OPTS) $(OPT_FEATURE_FLAGS) parse.y mv parse.h parse.h.temp $(NAWK) -f $(TOP)/addopcodes.awk parse.h.temp >parse.h |
︙ |
Changes to main.mk.
︙ | |||
47 48 49 50 51 52 53 | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | - + | TCCX = $(TCC) $(OPTS) -I. -I$(TOP)/src -I$(TOP) -I$(TOP)/ext/rtree # Object files for the SQLite library. # LIBOBJ+= alter.o analyze.o attach.o auth.o \ bitvec.o btmutex.o btree.o build.o \ callback.o complete.o date.o delete.o \ |
︙ | |||
79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | + | $(TOP)/src/build.c \ $(TOP)/src/callback.c \ $(TOP)/src/complete.c \ $(TOP)/src/date.c \ $(TOP)/src/delete.c \ $(TOP)/src/expr.c \ $(TOP)/src/fault.c \ $(TOP)/src/func.c \ $(TOP)/src/global.c \ $(TOP)/src/hash.c \ $(TOP)/src/hash.h \ $(TOP)/src/hwtime.h \ $(TOP)/src/insert.c \ $(TOP)/src/journal.c \ $(TOP)/src/legacy.c \ |
︙ | |||
138 139 140 141 142 143 144 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | - | $(TOP)/src/vdbe.c \ $(TOP)/src/vdbe.h \ $(TOP)/src/vdbeapi.c \ $(TOP)/src/vdbeaux.c \ $(TOP)/src/vdbeblob.c \ $(TOP)/src/vdbefifo.c \ $(TOP)/src/vdbemem.c \ |
︙ | |||
189 190 191 192 193 194 195 | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | - | # SRC += \ keywordhash.h \ opcodes.c \ opcodes.h \ parse.c \ parse.h \ |
︙ | |||
227 228 229 230 231 232 233 | 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | - + | $(TOP)/src/test_thread.c \ #TESTSRC += $(TOP)/ext/fts2/fts2_tokenizer.c #TESTSRC += $(TOP)/ext/fts3/fts3_tokenizer.c TESTSRC2 = \ $(TOP)/src/attach.c $(TOP)/src/btree.c $(TOP)/src/build.c $(TOP)/src/date.c \ |
︙ | |||
345 346 347 348 349 350 351 | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - - + + - - - - | # Rules to build opcodes.c and opcodes.h # opcodes.c: opcodes.h $(TOP)/mkopcodec.awk sort -n -b -k 3 opcodes.h | $(NAWK) -f $(TOP)/mkopcodec.awk >opcodes.c opcodes.h: parse.h $(TOP)/src/vdbe.c $(TOP)/mkopcodeh.awk |
︙ | |||
493 494 495 496 497 498 499 | 488 489 490 491 492 493 494 495 | - + | clean: rm -f *.o sqlite3 libsqlite3.a sqlite3.h opcodes.* rm -f lemon lempar.c parse.* sqlite*.tar.gz mkkeywordhash keywordhash.h rm -f $(PUBLISH) rm -f *.da *.bb *.bbg gmon.out rm -rf tsrc target_source rm -f testloadext.dll libtestloadext.so |
Changes to src/callback.c.
︙ | |||
9 10 11 12 13 14 15 | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** |
︙ | |||
256 257 258 259 260 261 262 263 264 265 266 267 268 269 | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | (enc==SQLITE_UTF16BE && p->iPrefEnc==SQLITE_UTF16LE) ){ match += 1; } } return match; } /* ** Search a FuncDefHash for a function with the given name. Return ** a pointer to the matching FuncDef if found, or 0 if there is no match. */ static FuncDef *functionSearch( FuncDefHash *pHash, /* Hash table to search */ int h, /* Hash of the name */ const char *zFunc, /* Name of function */ int nFunc /* Number of bytes in zFunc */ ){ FuncDef *p; for(p=pHash->a[h]; p; p=p->pHash){ if( sqlite3StrNICmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){ return p; } } return 0; } /* ** Insert a new FuncDef into a FuncDefHash hash table. */ void sqlite3FuncDefInsert( FuncDefHash *pHash, /* The hash table into which to insert */ FuncDef *pDef /* The function definition to insert */ ){ FuncDef *pOther; int nName = strlen(pDef->zName); u8 c1 = (u8)pDef->zName[0]; int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a); pOther = functionSearch(pHash, h, pDef->zName, nName); if( pOther ){ pDef->pNext = pOther->pNext; pOther->pNext = pDef; }else{ pDef->pNext = 0; pDef->pHash = pHash->a[h]; pHash->a[h] = pDef; } } /* ** Locate a user function given a name, a number of arguments and a flag ** indicating whether the function prefers UTF-16 over UTF-8. Return a ** pointer to the FuncDef structure that defines that function, or return ** NULL if the function does not exist. ** ** If the createFlag argument is true, then a new (blank) FuncDef |
︙ | |||
285 286 287 288 289 290 291 | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | - - + + + - - - - + + + + + - + + - - - + + - - - - - - + + + + + - + - - + - - - - | const char *zName, /* Name of the function. Not null-terminated */ int nName, /* Number of characters in the name */ int nArg, /* Number of arguments. -1 means any number */ u8 enc, /* Preferred text encoding */ int createFlag /* Create new entry if true and does not otherwise exist */ ){ FuncDef *p; /* Iterator variable */ |
︙ |
Changes to src/func.c.
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** |
︙ | |||
1418 1419 1420 1421 1422 1423 1424 | 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 | + + + + + + + + + + | LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), #else LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), #endif }; /* ** Build up the global built-in function table at initialization ** time. */ void sqlite3RegisterGlobalFunctions(void){ int i; for(i=0; i<ArraySize(aBuiltinFunc); i++){ sqlite3FuncDefInsert(&sqlite3FuncBuiltins, &aBuiltinFunc[i]); } } |
Changes to src/global.c.
︙ | |||
8 9 10 11 12 13 14 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | - + | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains definitions of global variables and contants. ** |
︙ | |||
71 72 73 74 75 76 77 | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | + + + + + + + + | 1, /* bCoreMutex */ 1, /* bFullMutex */ 0x7ffffffe, /* mxStrlen */ 100, /* szLookaside */ 500, /* nLookaside */ /* Other fields all default to zero */ }; /* ** Hash table for global functions - functions common to all ** database connections. After initialization, this table is ** read-only. */ FuncDefHash sqlite3FuncBuiltins; |
Changes to src/main.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | - + | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** |
︙ | |||
143 144 145 146 147 148 149 150 151 152 153 154 155 156 | 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | + + | ** sqlite3_initialize(). The recursive calls normally come through ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other ** recursive calls might also be possible. */ sqlite3_mutex_enter(sqlite3Config.pInitMutex); if( sqlite3Config.isInit==0 && inProgress==0 ){ inProgress = 1; memset(&sqlite3FuncBuiltins, 0, sizeof(sqlite3FuncBuiltins)); sqlite3RegisterGlobalFunctions(); rc = sqlite3_os_init(); if( rc==SQLITE_OK ){ rc = sqlite3PcacheInitialize(); sqlite3PCacheBufferSetup(sqlite3Config.pPage, sqlite3Config.szPage, sqlite3Config.nPage); } inProgress = 0; |
︙ | |||
562 563 564 565 566 567 568 | 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | - - - - - - - - + + + + + + + + + + + | pDb->pSchema = 0; } } } sqlite3ResetInternalSchema(db, 0); assert( db->nDb<=2 ); assert( db->aDb==db->aDbStatic ); |
︙ | |||
592 593 594 595 596 597 598 | 597 598 599 600 601 602 603 604 605 606 607 608 609 610 | - | pMod->xDestroy(pMod->pAux); } sqlite3DbFree(db, pMod); } sqlite3HashClear(&db->aModule); #endif |
︙ | |||
1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 | 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 | + + + | #endif #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 # error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1 #endif #if SQLITE_MAX_VARIABLE_NUMBER<1 # error SQLITE_MAX_VARIABLE_NUMBER must be at least 1 #endif #if SQLITE_MAX_COLUMN>32767 # error SQLITE_MAX_COLUMN must not exceed 32767 #endif /* ** Change the value of a limit. Report the old value. ** If an invalid limit index is supplied, report -1. ** Make no changes but still report the old value if the ** new limit is negative. |
︙ | |||
1462 1463 1464 1465 1466 1467 1468 | 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 | - | #if SQLITE_DEFAULT_FILE_FORMAT<4 | SQLITE_LegacyFileFmt #endif #ifdef SQLITE_ENABLE_LOAD_EXTENSION | SQLITE_LoadExtension #endif ; |
︙ |
Changes to src/sqliteInt.h.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | - + | /* ** 2001 September 15 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** |
︙ | |||
362 363 364 365 366 367 368 | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 | - + | #endif typedef sqlite_int64 i64; /* 8-byte signed integer */ typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ typedef INT16_TYPE i16; /* 2-byte signed integer */ typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ |
︙ | |||
451 452 453 454 455 456 457 458 459 460 461 462 463 464 | 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | + | typedef struct Column Column; typedef struct Db Db; typedef struct Schema Schema; typedef struct Expr Expr; typedef struct ExprList ExprList; typedef struct FKey FKey; typedef struct FuncDef FuncDef; typedef struct FuncDefHash FuncDefHash; typedef struct IdList IdList; typedef struct Index Index; typedef struct KeyClass KeyClass; typedef struct KeyInfo KeyInfo; typedef struct Lookaside Lookaside; typedef struct LookasideSlot LookasideSlot; typedef struct Module Module; |
︙ | |||
588 589 590 591 592 593 594 595 596 597 598 599 600 601 | 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | + + + + + + + + + + | void *pStart; /* First byte of available memory space */ void *pEnd; /* First byte past end of available space */ }; struct LookasideSlot { LookasideSlot *pNext; /* Next buffer in the list of free buffers */ }; /* ** A hash table for function definitions. ** ** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. ** Collisions are on the FuncDef.pHash chain. */ struct FuncDefHash { FuncDef *a[23]; /* Hash table for functions */ }; /* ** Each database is an instance of the following structure. ** ** The sqlite.lastRowid records the last insert rowid generated by an ** insert statement. Inserts on views do not affect its value. Each ** trigger has its own context, so that lastRowid can be updated inside ** triggers as usual. The previous value will be restored once the trigger |
︙ | |||
684 685 686 687 688 689 690 | 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | - + | #endif #ifndef SQLITE_OMIT_VIRTUALTABLE Hash aModule; /* populated by sqlite3_create_module() */ Table *pVTab; /* vtab with active Connect/Create method */ sqlite3_vtab **aVTrans; /* Virtual tables with open transactions */ int nVTrans; /* Allocated size of aVTrans */ #endif |
︙ | |||
749 750 751 752 753 754 755 | 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 | - + + - - - + + + | /* ** Each SQL function is defined by an instance of the following ** structure. A pointer to this structure is stored in the sqlite.aFunc ** hash table. When multiple functions have the same name, the hash table ** points to a linked list of these structures. */ struct FuncDef { |
︙ | |||
2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 | 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 | + + | void sqlite3BeginWriteOperation(Parse*, int, int); Expr *sqlite3ExprDup(sqlite3*,Expr*); void sqlite3TokenCopy(sqlite3*,Token*, Token*); ExprList *sqlite3ExprListDup(sqlite3*,ExprList*); SrcList *sqlite3SrcListDup(sqlite3*,SrcList*); IdList *sqlite3IdListDup(sqlite3*,IdList*); Select *sqlite3SelectDup(sqlite3*,Select*); void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*); FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int); void sqlite3RegisterBuiltinFunctions(sqlite3*); void sqlite3RegisterDateTimeFunctions(sqlite3*); void sqlite3RegisterGlobalFunctions(void); int sqlite3GetBuiltinFunction(const char *, int, FuncDef **); #ifdef SQLITE_DEBUG int sqlite3SafetyOn(sqlite3*); int sqlite3SafetyOff(sqlite3*); #else # define sqlite3SafetyOn(A) 0 # define sqlite3SafetyOff(A) 0 |
︙ | |||
2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 | + | sqlite3_value *sqlite3ValueNew(sqlite3 *); char *sqlite3Utf16to8(sqlite3 *, const void*, int); int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION extern const unsigned char sqlite3UpperToLower[]; extern struct Sqlite3Config sqlite3Config; extern FuncDefHash sqlite3FuncBuiltins; #endif void sqlite3RootPageMoved(Db*, int, int); void sqlite3Reindex(Parse*, Token*, Token*); void sqlite3AlterFunctions(sqlite3*); void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); int sqlite3GetToken(const unsigned char *, int *); void sqlite3NestedParse(Parse*, const char*, ...); |
︙ |
Deleted tool/mkfunction.c.
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
|
Changes to tool/mksqlite3c.tcl.
︙ | |||
252 253 254 255 256 257 258 | 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 | - + | alter.c analyze.c attach.c auth.c build.c callback.c delete.c |
︙ |