| | @@ -398,10 +398,13 @@ |
| 398 | 398 | ** |
| 399 | 399 | ** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the |
| 400 | 400 | ** assert() macro is enabled, each call into the Win32 native heap subsystem |
| 401 | 401 | ** will cause HeapValidate to be called. If heap validation should fail, an |
| 402 | 402 | ** assertion will be triggered. |
| 403 | +** |
| 404 | +** (Historical note: There used to be several other options, but we've |
| 405 | +** pared it down to just these three.) |
| 403 | 406 | ** |
| 404 | 407 | ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as |
| 405 | 408 | ** the default. |
| 406 | 409 | */ |
| 407 | 410 | #if defined(SQLITE_SYSTEM_MALLOC) \ |
| | @@ -436,17 +439,24 @@ |
| 436 | 439 | */ |
| 437 | 440 | #if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) |
| 438 | 441 | # define _XOPEN_SOURCE 600 |
| 439 | 442 | #endif |
| 440 | 443 | |
| 444 | +/* |
| 445 | +** The TCL headers are only needed when compiling the TCL bindings. |
| 446 | +*/ |
| 447 | +#if defined(SQLITE_TCL) || defined(TCLSH) |
| 448 | +# include <tcl.h> |
| 449 | +#endif |
| 450 | + |
| 441 | 451 | /* |
| 442 | 452 | ** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that |
| 443 | 453 | ** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, |
| 444 | 454 | ** make it true by defining or undefining NDEBUG. |
| 445 | 455 | ** |
| 446 | | -** Setting NDEBUG makes the code smaller and faster by disabling the |
| 447 | | -** assert() statements in the code. So we want the default action |
| 456 | +** Setting NDEBUG makes the code smaller and run faster by disabling the |
| 457 | +** number assert() statements in the code. So we want the default action |
| 448 | 458 | ** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG |
| 449 | 459 | ** is set. Thus NDEBUG becomes an opt-in rather than an opt-out |
| 450 | 460 | ** feature. |
| 451 | 461 | */ |
| 452 | 462 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) |
| | @@ -512,11 +522,11 @@ |
| 512 | 522 | ** hint of unplanned behavior. |
| 513 | 523 | ** |
| 514 | 524 | ** In other words, ALWAYS and NEVER are added for defensive code. |
| 515 | 525 | ** |
| 516 | 526 | ** When doing coverage testing ALWAYS and NEVER are hard-coded to |
| 517 | | -** be true and false so that the unreachable code they specify will |
| 527 | +** be true and false so that the unreachable code then specify will |
| 518 | 528 | ** not be counted as untested code. |
| 519 | 529 | */ |
| 520 | 530 | #if defined(SQLITE_COVERAGE_TEST) |
| 521 | 531 | # define ALWAYS(X) (1) |
| 522 | 532 | # define NEVER(X) (0) |
| | @@ -536,16 +546,20 @@ |
| 536 | 546 | #define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) |
| 537 | 547 | |
| 538 | 548 | /* |
| 539 | 549 | ** The macro unlikely() is a hint that surrounds a boolean |
| 540 | 550 | ** expression that is usually false. Macro likely() surrounds |
| 541 | | -** a boolean expression that is usually true. These hints could, |
| 542 | | -** in theory, be used by the compiler to generate better code, but |
| 543 | | -** currently they are just comments for human readers. |
| 551 | +** a boolean expression that is usually true. GCC is able to |
| 552 | +** use these hints to generate better code, sometimes. |
| 544 | 553 | */ |
| 545 | | -#define likely(X) (X) |
| 546 | | -#define unlikely(X) (X) |
| 554 | +#if defined(__GNUC__) && 0 |
| 555 | +# define likely(X) __builtin_expect((X),1) |
| 556 | +# define unlikely(X) __builtin_expect((X),0) |
| 557 | +#else |
| 558 | +# define likely(X) !!(X) |
| 559 | +# define unlikely(X) !!(X) |
| 560 | +#endif |
| 547 | 561 | |
| 548 | 562 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 549 | 563 | /************** Begin file sqlite3.h *****************************************/ |
| 550 | 564 | /* |
| 551 | 565 | ** 2001 September 15 |
| | @@ -656,11 +670,11 @@ |
| 656 | 670 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | 671 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | 672 | */ |
| 659 | 673 | #define SQLITE_VERSION "3.8.0" |
| 660 | 674 | #define SQLITE_VERSION_NUMBER 3008000 |
| 661 | | -#define SQLITE_SOURCE_ID "2013-07-31 23:28:36 136fc2931b156f91cdd76a7a009298cdf09d826a" |
| 675 | +#define SQLITE_SOURCE_ID "2013-07-18 14:50:56 5dcffa671f592ae9355628afa439ae9a2d26f0cd" |
| 662 | 676 | |
| 663 | 677 | /* |
| 664 | 678 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | 679 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | 680 | ** |
| | @@ -1025,11 +1039,10 @@ |
| 1025 | 1039 | #define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) |
| 1026 | 1040 | #define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) |
| 1027 | 1041 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1028 | 1042 | #define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) |
| 1029 | 1043 | #define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) |
| 1030 | | -#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) |
| 1031 | 1044 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1032 | 1045 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1033 | 1046 | #define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) |
| 1034 | 1047 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1035 | 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| | @@ -3109,12 +3122,11 @@ |
| 3109 | 3122 | ** interface is to keep a GUI updated during a large query. |
| 3110 | 3123 | ** |
| 3111 | 3124 | ** ^The parameter P is passed through as the only parameter to the |
| 3112 | 3125 | ** callback function X. ^The parameter N is the approximate number of |
| 3113 | 3126 | ** [virtual machine instructions] that are evaluated between successive |
| 3114 | | -** invocations of the callback X. ^If N is less than one then the progress |
| 3115 | | -** handler is disabled. |
| 3127 | +** invocations of the callback X. |
| 3116 | 3128 | ** |
| 3117 | 3129 | ** ^Only a single progress handler may be defined at one time per |
| 3118 | 3130 | ** [database connection]; setting a new progress handler cancels the |
| 3119 | 3131 | ** old one. ^Setting parameter X to NULL disables the progress handler. |
| 3120 | 3132 | ** ^The progress handler is also disabled by setting N to a value less |
| | @@ -4730,49 +4742,50 @@ |
| 4730 | 4742 | SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); |
| 4731 | 4743 | |
| 4732 | 4744 | /* |
| 4733 | 4745 | ** CAPI3REF: Function Auxiliary Data |
| 4734 | 4746 | ** |
| 4735 | | -** These functions may be used by (non-aggregate) SQL functions to |
| 4747 | +** The following two functions may be used by scalar SQL functions to |
| 4736 | 4748 | ** associate metadata with argument values. If the same value is passed to |
| 4737 | 4749 | ** multiple invocations of the same SQL function during query execution, under |
| 4738 | | -** some circumstances the associated metadata may be preserved. An example |
| 4739 | | -** of where this might be useful is in a regular-expression matching |
| 4740 | | -** function. The compiled version of the regular expression can be stored as |
| 4741 | | -** metadata associated with the pattern string. |
| 4742 | | -** Then as long as the pattern string remains the same, |
| 4743 | | -** the compiled regular expression can be reused on multiple |
| 4744 | | -** invocations of the same function. |
| 4750 | +** some circumstances the associated metadata may be preserved. This might |
| 4751 | +** be used, for example, in a regular-expression matching |
| 4752 | +** function. The compiled version of the regular expression is stored as |
| 4753 | +** metadata associated with the SQL value passed as the regular expression |
| 4754 | +** pattern. The compiled regular expression can be reused on multiple |
| 4755 | +** invocations of the same function so that the original pattern string |
| 4756 | +** does not need to be recompiled on each invocation. |
| 4745 | 4757 | ** |
| 4746 | 4758 | ** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata |
| 4747 | 4759 | ** associated by the sqlite3_set_auxdata() function with the Nth argument |
| 4748 | | -** value to the application-defined function. ^If there is no metadata |
| 4749 | | -** associated with the function argument, this sqlite3_get_auxdata() interface |
| 4750 | | -** returns a NULL pointer. |
| 4760 | +** value to the application-defined function. ^If no metadata has been ever |
| 4761 | +** been set for the Nth argument of the function, or if the corresponding |
| 4762 | +** function parameter has changed since the meta-data was set, |
| 4763 | +** then sqlite3_get_auxdata() returns a NULL pointer. |
| 4751 | 4764 | ** |
| 4752 | 4765 | ** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th |
| 4753 | 4766 | ** argument of the application-defined function. ^Subsequent |
| 4754 | 4767 | ** calls to sqlite3_get_auxdata(C,N) return P from the most recent |
| 4755 | | -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or |
| 4756 | | -** NULL if the metadata has been discarded. |
| 4757 | | -** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, |
| 4758 | | -** SQLite will invoke the destructor function X with parameter P exactly |
| 4759 | | -** once, when the metadata is discarded. |
| 4760 | | -** SQLite is free to discard the metadata at any time, including: <ul> |
| 4761 | | -** <li> when the corresponding function parameter changes, or |
| 4762 | | -** <li> when [sqlite3_reset()] or [sqlite3_finalize()] is called for the |
| 4763 | | -** SQL statement, or |
| 4764 | | -** <li> when sqlite3_set_auxdata() is invoked again on the same parameter, or |
| 4765 | | -** <li> during the original sqlite3_set_auxdata() call when a memory |
| 4766 | | -** allocation error occurs. </ul>)^ |
| 4768 | +** sqlite3_set_auxdata(C,N,P,X) call if the data has not been dropped, or |
| 4769 | +** NULL if the data has been dropped. |
| 4770 | +** ^(If it is not NULL, SQLite will invoke the destructor |
| 4771 | +** function X passed to sqlite3_set_auxdata(C,N,P,X) when <ul> |
| 4772 | +** <li> the corresponding function parameter changes, |
| 4773 | +** <li> [sqlite3_reset()] or [sqlite3_finalize()] is called for the |
| 4774 | +** SQL statement, |
| 4775 | +** <li> sqlite3_set_auxdata() is invoked again on the same parameter, or |
| 4776 | +** <li> a memory allocation error occurs. </ul>)^ |
| 4767 | 4777 | ** |
| 4768 | | -** Note the last bullet in particular. The destructor X in |
| 4769 | | -** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the |
| 4770 | | -** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() |
| 4778 | +** SQLite is free to call the destructor and drop metadata on any |
| 4779 | +** parameter of any function at any time. ^The only guarantee is that |
| 4780 | +** the destructor will be called when the [prepared statement] is destroyed. |
| 4781 | +** Note in particular that the destructor X in the call to |
| 4782 | +** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before |
| 4783 | +** the sqlite3_set_auxdata() call even returns. Hence sqlite3_set_auxdata() |
| 4771 | 4784 | ** should be called near the end of the function implementation and the |
| 4772 | | -** function implementation should not make any use of P after |
| 4773 | | -** sqlite3_set_auxdata() has been called. |
| 4785 | +** implementation should not make any use of P after sqlite3_set_auxdata() |
| 4786 | +** has been called. |
| 4774 | 4787 | ** |
| 4775 | 4788 | ** ^(In practice, metadata is preserved between function calls for |
| 4776 | 4789 | ** function parameters that are compile-time constants, including literal |
| 4777 | 4790 | ** values and [parameters] and expressions composed from the same.)^ |
| 4778 | 4791 | ** |
| | @@ -8811,10 +8824,11 @@ |
| 8811 | 8824 | |
| 8812 | 8825 | /* |
| 8813 | 8826 | ** The names of the following types declared in vdbeInt.h are required |
| 8814 | 8827 | ** for the VdbeOp definition. |
| 8815 | 8828 | */ |
| 8829 | +typedef struct VdbeFunc VdbeFunc; |
| 8816 | 8830 | typedef struct Mem Mem; |
| 8817 | 8831 | typedef struct SubProgram SubProgram; |
| 8818 | 8832 | |
| 8819 | 8833 | /* |
| 8820 | 8834 | ** A single instruction of the virtual machine has an opcode |
| | @@ -8834,10 +8848,11 @@ |
| 8834 | 8848 | void *p; /* Generic pointer */ |
| 8835 | 8849 | char *z; /* Pointer to data for string (char array) types */ |
| 8836 | 8850 | i64 *pI64; /* Used when p4type is P4_INT64 */ |
| 8837 | 8851 | double *pReal; /* Used when p4type is P4_REAL */ |
| 8838 | 8852 | FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ |
| 8853 | + VdbeFunc *pVdbeFunc; /* Used when p4type is P4_VDBEFUNC */ |
| 8839 | 8854 | CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ |
| 8840 | 8855 | Mem *pMem; /* Used when p4type is P4_MEM */ |
| 8841 | 8856 | VTable *pVtab; /* Used when p4type is P4_VTAB */ |
| 8842 | 8857 | KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ |
| 8843 | 8858 | int *ai; /* Used when p4type is P4_INTARRAY */ |
| | @@ -8887,10 +8902,11 @@ |
| 8887 | 8902 | #define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ |
| 8888 | 8903 | #define P4_STATIC (-2) /* Pointer to a static string */ |
| 8889 | 8904 | #define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ |
| 8890 | 8905 | #define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ |
| 8891 | 8906 | #define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ |
| 8907 | +#define P4_VDBEFUNC (-7) /* P4 is a pointer to a VdbeFunc structure */ |
| 8892 | 8908 | #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ |
| 8893 | 8909 | #define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */ |
| 8894 | 8910 | #define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ |
| 8895 | 8911 | #define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */ |
| 8896 | 8912 | #define P4_REAL (-12) /* P4 is a 64-bit floating point value */ |
| | @@ -13241,13 +13257,10 @@ |
| 13241 | 13257 | typedef struct VdbeSorter VdbeSorter; |
| 13242 | 13258 | |
| 13243 | 13259 | /* Opaque type used by the explainer */ |
| 13244 | 13260 | typedef struct Explain Explain; |
| 13245 | 13261 | |
| 13246 | | -/* Elements of the linked list at Vdbe.pAuxData */ |
| 13247 | | -typedef struct AuxData AuxData; |
| 13248 | | - |
| 13249 | 13262 | /* |
| 13250 | 13263 | ** A cursor is a pointer into a single BTree within a database file. |
| 13251 | 13264 | ** The cursor can seek to a BTree entry with a particular key, or |
| 13252 | 13265 | ** loop over all entries of the Btree. You can also insert new BTree |
| 13253 | 13266 | ** entries or retrieve the key or data from the entry that the cursor |
| | @@ -13430,23 +13443,27 @@ |
| 13430 | 13443 | */ |
| 13431 | 13444 | #ifdef SQLITE_DEBUG |
| 13432 | 13445 | #define memIsValid(M) ((M)->flags & MEM_Invalid)==0 |
| 13433 | 13446 | #endif |
| 13434 | 13447 | |
| 13435 | | -/* |
| 13436 | | -** Each auxilliary data pointer stored by a user defined function |
| 13437 | | -** implementation calling sqlite3_set_auxdata() is stored in an instance |
| 13438 | | -** of this structure. All such structures associated with a single VM |
| 13439 | | -** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed |
| 13440 | | -** when the VM is halted (if not before). |
| 13448 | + |
| 13449 | +/* A VdbeFunc is just a FuncDef (defined in sqliteInt.h) that contains |
| 13450 | +** additional information about auxiliary information bound to arguments |
| 13451 | +** of the function. This is used to implement the sqlite3_get_auxdata() |
| 13452 | +** and sqlite3_set_auxdata() APIs. The "auxdata" is some auxiliary data |
| 13453 | +** that can be associated with a constant argument to a function. This |
| 13454 | +** allows functions such as "regexp" to compile their constant regular |
| 13455 | +** expression argument once and reused the compiled code for multiple |
| 13456 | +** invocations. |
| 13441 | 13457 | */ |
| 13442 | | -struct AuxData { |
| 13443 | | - int iOp; /* Instruction number of OP_Function opcode */ |
| 13444 | | - int iArg; /* Index of function argument. */ |
| 13445 | | - void *pAux; /* Aux data pointer */ |
| 13446 | | - void (*xDelete)(void *); /* Destructor for the aux data */ |
| 13447 | | - AuxData *pNext; /* Next element in list */ |
| 13458 | +struct VdbeFunc { |
| 13459 | + FuncDef *pFunc; /* The definition of the function */ |
| 13460 | + int nAux; /* Number of entries allocated for apAux[] */ |
| 13461 | + struct AuxData { |
| 13462 | + void *pAux; /* Aux data for the i-th argument */ |
| 13463 | + void (*xDelete)(void *); /* Destructor for the aux data */ |
| 13464 | + } apAux[1]; /* One slot for each function argument */ |
| 13448 | 13465 | }; |
| 13449 | 13466 | |
| 13450 | 13467 | /* |
| 13451 | 13468 | ** The "context" argument for a installable function. A pointer to an |
| 13452 | 13469 | ** instance of this structure is the first argument to the routines used |
| | @@ -13460,17 +13477,16 @@ |
| 13460 | 13477 | ** This structure is defined inside of vdbeInt.h because it uses substructures |
| 13461 | 13478 | ** (Mem) which are only defined there. |
| 13462 | 13479 | */ |
| 13463 | 13480 | struct sqlite3_context { |
| 13464 | 13481 | FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */ |
| 13482 | + VdbeFunc *pVdbeFunc; /* Auxilary data, if created. */ |
| 13465 | 13483 | Mem s; /* The return value is stored here */ |
| 13466 | 13484 | Mem *pMem; /* Memory cell used to store aggregate context */ |
| 13467 | 13485 | CollSeq *pColl; /* Collating sequence */ |
| 13468 | 13486 | int isError; /* Error code returned by the function. */ |
| 13469 | 13487 | int skipFlag; /* Skip skip accumulator loading if true */ |
| 13470 | | - int iOp; /* Instruction number of OP_Function */ |
| 13471 | | - Vdbe *pVdbe; /* The VM that owns this context */ |
| 13472 | 13488 | }; |
| 13473 | 13489 | |
| 13474 | 13490 | /* |
| 13475 | 13491 | ** An Explain object accumulates indented output which is helpful |
| 13476 | 13492 | ** in describing recursive data structures. |
| | @@ -13565,11 +13581,10 @@ |
| 13565 | 13581 | int nFrame; /* Number of frames in pFrame list */ |
| 13566 | 13582 | u32 expmask; /* Binding to these vars invalidates VM */ |
| 13567 | 13583 | SubProgram *pProgram; /* Linked list of all sub-programs used by VM */ |
| 13568 | 13584 | int nOnceFlag; /* Size of array aOnceFlag[] */ |
| 13569 | 13585 | u8 *aOnceFlag; /* Flags for OP_Once */ |
| 13570 | | - AuxData *pAuxData; /* Linked list of auxdata allocations */ |
| 13571 | 13586 | }; |
| 13572 | 13587 | |
| 13573 | 13588 | /* |
| 13574 | 13589 | ** The following are allowed values for Vdbe.magic |
| 13575 | 13590 | */ |
| | @@ -13589,11 +13604,11 @@ |
| 13589 | 13604 | #endif |
| 13590 | 13605 | SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); |
| 13591 | 13606 | SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int); |
| 13592 | 13607 | SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int); |
| 13593 | 13608 | SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); |
| 13594 | | -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe*, int, int); |
| 13609 | +SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(VdbeFunc*, int); |
| 13595 | 13610 | |
| 13596 | 13611 | int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); |
| 13597 | 13612 | SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); |
| 13598 | 13613 | SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *); |
| 13599 | 13614 | SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); |
| | @@ -28361,27 +28376,22 @@ |
| 28361 | 28376 | */ |
| 28362 | 28377 | static const char *unixTempFileDir(void){ |
| 28363 | 28378 | static const char *azDirs[] = { |
| 28364 | 28379 | 0, |
| 28365 | 28380 | 0, |
| 28366 | | - 0, |
| 28367 | | - 0, |
| 28368 | 28381 | "/var/tmp", |
| 28369 | 28382 | "/usr/tmp", |
| 28370 | 28383 | "/tmp", |
| 28371 | | - "." |
| 28384 | + 0 /* List terminator */ |
| 28372 | 28385 | }; |
| 28373 | 28386 | unsigned int i; |
| 28374 | 28387 | struct stat buf; |
| 28375 | | - const char *zDir; |
| 28388 | + const char *zDir = 0; |
| 28376 | 28389 | |
| 28377 | 28390 | azDirs[0] = sqlite3_temp_directory; |
| 28378 | 28391 | if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); |
| 28379 | | - if( !azDirs[2] ) azDirs[2] = getenv("TMP"); |
| 28380 | | - if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); |
| 28381 | | - for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ |
| 28382 | | - zDir = azDirs[i]; |
| 28392 | + for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); zDir=azDirs[i++]){ |
| 28383 | 28393 | if( zDir==0 ) continue; |
| 28384 | 28394 | if( osStat(zDir, &buf) ) continue; |
| 28385 | 28395 | if( !S_ISDIR(buf.st_mode) ) continue; |
| 28386 | 28396 | if( osAccess(zDir, 07) ) continue; |
| 28387 | 28397 | break; |
| | @@ -28407,10 +28417,11 @@ |
| 28407 | 28417 | ** function failing. |
| 28408 | 28418 | */ |
| 28409 | 28419 | SimulateIOError( return SQLITE_IOERR ); |
| 28410 | 28420 | |
| 28411 | 28421 | zDir = unixTempFileDir(); |
| 28422 | + if( zDir==0 ) zDir = "."; |
| 28412 | 28423 | |
| 28413 | 28424 | /* Check that the output buffer is large enough for the temporary file |
| 28414 | 28425 | ** name. If it is not, return SQLITE_ERROR. |
| 28415 | 28426 | */ |
| 28416 | 28427 | if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ |
| | @@ -30488,11 +30499,10 @@ |
| 30488 | 30499 | */ |
| 30489 | 30500 | #if SQLITE_OS_WIN /* This file is used for Windows only */ |
| 30490 | 30501 | |
| 30491 | 30502 | #ifdef __CYGWIN__ |
| 30492 | 30503 | # include <sys/cygwin.h> |
| 30493 | | -/* # include <errno.h> */ |
| 30494 | 30504 | #endif |
| 30495 | 30505 | |
| 30496 | 30506 | /* |
| 30497 | 30507 | ** Include code that is common to all os_*.c files |
| 30498 | 30508 | */ |
| | @@ -30717,11 +30727,11 @@ |
| 30717 | 30727 | |
| 30718 | 30728 | /* |
| 30719 | 30729 | ** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions |
| 30720 | 30730 | ** based on the sub-platform)? |
| 30721 | 30731 | */ |
| 30722 | | -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30732 | +#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 30723 | 30733 | # define SQLITE_WIN32_HAS_ANSI |
| 30724 | 30734 | #endif |
| 30725 | 30735 | |
| 30726 | 30736 | /* |
| 30727 | 30737 | ** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions |
| | @@ -30909,11 +30919,10 @@ |
| 30909 | 30919 | * zero for the default behavior. |
| 30910 | 30920 | */ |
| 30911 | 30921 | #ifndef SQLITE_WIN32_HEAP_FLAGS |
| 30912 | 30922 | # define SQLITE_WIN32_HEAP_FLAGS (0) |
| 30913 | 30923 | #endif |
| 30914 | | - |
| 30915 | 30924 | |
| 30916 | 30925 | /* |
| 30917 | 30926 | ** The winMemData structure stores information required by the Win32-specific |
| 30918 | 30927 | ** sqlite3_mem_methods implementation. |
| 30919 | 30928 | */ |
| | @@ -34375,14 +34384,14 @@ |
| 34375 | 34384 | OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=SQLITE_IOERR_MMAP\n", |
| 34376 | 34385 | osGetCurrentProcessId(), pFd)); |
| 34377 | 34386 | return SQLITE_OK; |
| 34378 | 34387 | } |
| 34379 | 34388 | assert( (nMap % winSysInfo.dwPageSize)==0 ); |
| 34380 | | - assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34381 | 34389 | #if SQLITE_OS_WINRT |
| 34382 | | - pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); |
| 34390 | + pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, nMap); |
| 34383 | 34391 | #else |
| 34392 | + assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); |
| 34384 | 34393 | pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); |
| 34385 | 34394 | #endif |
| 34386 | 34395 | if( pNew==NULL ){ |
| 34387 | 34396 | osCloseHandle(pFd->hMap); |
| 34388 | 34397 | pFd->hMap = NULL; |
| | @@ -34549,19 +34558,10 @@ |
| 34549 | 34558 | return zConverted; |
| 34550 | 34559 | } |
| 34551 | 34560 | |
| 34552 | 34561 | static int winIsDir(const void *zConverted); |
| 34553 | 34562 | |
| 34554 | | -/* |
| 34555 | | -** Maximum pathname length (in bytes) for windows. The MAX_PATH macro is |
| 34556 | | -** in characters, so we allocate 3 bytes per character assuming worst-case |
| 34557 | | -** 3-bytes-per-character UTF8. |
| 34558 | | -*/ |
| 34559 | | -#ifndef SQLITE_WIN32_MAX_PATH |
| 34560 | | -# define SQLITE_WIN32_MAX_PATH (MAX_PATH*3) |
| 34561 | | -#endif |
| 34562 | | - |
| 34563 | 34563 | /* |
| 34564 | 34564 | ** Create a temporary file name in zBuf. zBuf must be big enough to |
| 34565 | 34565 | ** hold at pVfs->mxPathname characters. |
| 34566 | 34566 | */ |
| 34567 | 34567 | static int getTempname(int nBuf, char *zBuf){ |
| | @@ -34569,21 +34569,22 @@ |
| 34569 | 34569 | "abcdefghijklmnopqrstuvwxyz" |
| 34570 | 34570 | "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 34571 | 34571 | "0123456789"; |
| 34572 | 34572 | size_t i, j; |
| 34573 | 34573 | int nTempPath; |
| 34574 | | - char zTempPath[SQLITE_WIN32_MAX_PATH+2]; |
| 34574 | + char zTempPath[MAX_PATH+2]; |
| 34575 | 34575 | |
| 34576 | 34576 | /* It's odd to simulate an io-error here, but really this is just |
| 34577 | 34577 | ** using the io-error infrastructure to test that SQLite handles this |
| 34578 | 34578 | ** function failing. |
| 34579 | 34579 | */ |
| 34580 | 34580 | SimulateIOError( return SQLITE_IOERR ); |
| 34581 | 34581 | |
| 34582 | + memset(zTempPath, 0, MAX_PATH+2); |
| 34583 | + |
| 34582 | 34584 | if( sqlite3_temp_directory ){ |
| 34583 | | - sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", |
| 34584 | | - sqlite3_temp_directory); |
| 34585 | + sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", sqlite3_temp_directory); |
| 34585 | 34586 | } |
| 34586 | 34587 | #if defined(__CYGWIN__) |
| 34587 | 34588 | else{ |
| 34588 | 34589 | static const char *azDirs[] = { |
| 34589 | 34590 | 0, |
| | @@ -34626,58 +34627,36 @@ |
| 34626 | 34627 | } |
| 34627 | 34628 | #elif !SQLITE_OS_WINRT |
| 34628 | 34629 | else if( isNT() ){ |
| 34629 | 34630 | char *zMulti; |
| 34630 | 34631 | WCHAR zWidePath[MAX_PATH]; |
| 34631 | | - if( osGetTempPathW(MAX_PATH-30, zWidePath)==0 ){ |
| 34632 | | - OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34633 | | - return SQLITE_IOERR_GETTEMPPATH; |
| 34634 | | - } |
| 34632 | + osGetTempPathW(MAX_PATH-30, zWidePath); |
| 34635 | 34633 | zMulti = unicodeToUtf8(zWidePath); |
| 34636 | 34634 | if( zMulti ){ |
| 34637 | | - sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34635 | + sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zMulti); |
| 34638 | 34636 | sqlite3_free(zMulti); |
| 34639 | 34637 | }else{ |
| 34640 | 34638 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34641 | 34639 | return SQLITE_IOERR_NOMEM; |
| 34642 | 34640 | } |
| 34643 | 34641 | } |
| 34644 | 34642 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34645 | 34643 | else{ |
| 34646 | 34644 | char *zUtf8; |
| 34647 | | - char zMbcsPath[SQLITE_WIN32_MAX_PATH]; |
| 34648 | | - if( osGetTempPathA(SQLITE_WIN32_MAX_PATH-30, zMbcsPath)==0 ){ |
| 34649 | | - OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_GETTEMPPATH\n")); |
| 34650 | | - return SQLITE_IOERR_GETTEMPPATH; |
| 34651 | | - } |
| 34645 | + char zMbcsPath[MAX_PATH]; |
| 34646 | + osGetTempPathA(MAX_PATH-30, zMbcsPath); |
| 34652 | 34647 | zUtf8 = sqlite3_win32_mbcs_to_utf8(zMbcsPath); |
| 34653 | 34648 | if( zUtf8 ){ |
| 34654 | | - sqlite3_snprintf(SQLITE_WIN32_MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34649 | + sqlite3_snprintf(MAX_PATH-30, zTempPath, "%s", zUtf8); |
| 34655 | 34650 | sqlite3_free(zUtf8); |
| 34656 | 34651 | }else{ |
| 34657 | 34652 | OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); |
| 34658 | 34653 | return SQLITE_IOERR_NOMEM; |
| 34659 | 34654 | } |
| 34660 | 34655 | } |
| 34661 | | -#else |
| 34662 | | - else{ |
| 34663 | | - /* |
| 34664 | | - ** Compiled without ANSI support and the current operating system |
| 34665 | | - ** is not Windows NT; therefore, just zero the temporary buffer. |
| 34666 | | - */ |
| 34667 | | - memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34668 | | - } |
| 34669 | | -#endif /* SQLITE_WIN32_HAS_ANSI */ |
| 34670 | | -#else |
| 34671 | | - else{ |
| 34672 | | - /* |
| 34673 | | - ** Compiled for WinRT and the sqlite3_temp_directory is not set; |
| 34674 | | - ** therefore, just zero the temporary buffer. |
| 34675 | | - */ |
| 34676 | | - memset(zTempPath, 0, SQLITE_WIN32_MAX_PATH+2); |
| 34677 | | - } |
| 34678 | | -#endif /* !SQLITE_OS_WINRT */ |
| 34656 | +#endif |
| 34657 | +#endif |
| 34679 | 34658 | |
| 34680 | 34659 | /* Check that the output buffer is large enough for the temporary file |
| 34681 | 34660 | ** name. If it is not, return SQLITE_ERROR. |
| 34682 | 34661 | */ |
| 34683 | 34662 | nTempPath = sqlite3Strlen30(zTempPath); |
| | @@ -34759,11 +34738,11 @@ |
| 34759 | 34738 | int cnt = 0; |
| 34760 | 34739 | |
| 34761 | 34740 | /* If argument zPath is a NULL pointer, this function is required to open |
| 34762 | 34741 | ** a temporary file. Use this buffer to store the file name in. |
| 34763 | 34742 | */ |
| 34764 | | - char zTmpname[SQLITE_WIN32_MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34743 | + char zTmpname[MAX_PATH+2]; /* Buffer used to create temp filename */ |
| 34765 | 34744 | |
| 34766 | 34745 | int rc = SQLITE_OK; /* Function Return Code */ |
| 34767 | 34746 | #if !defined(NDEBUG) || SQLITE_OS_WINCE |
| 34768 | 34747 | int eType = flags&0xFFFFFF00; /* Type of file to open */ |
| 34769 | 34748 | #endif |
| | @@ -34825,11 +34804,12 @@ |
| 34825 | 34804 | /* If the second argument to this function is NULL, generate a |
| 34826 | 34805 | ** temporary file name to use |
| 34827 | 34806 | */ |
| 34828 | 34807 | if( !zUtf8Name ){ |
| 34829 | 34808 | assert(isDelete && !isOpenJournal); |
| 34830 | | - rc = getTempname(SQLITE_WIN32_MAX_PATH+2, zTmpname); |
| 34809 | + memset(zTmpname, 0, MAX_PATH+2); |
| 34810 | + rc = getTempname(MAX_PATH+2, zTmpname); |
| 34831 | 34811 | if( rc!=SQLITE_OK ){ |
| 34832 | 34812 | OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); |
| 34833 | 34813 | return rc; |
| 34834 | 34814 | } |
| 34835 | 34815 | zUtf8Name = zTmpname; |
| | @@ -35256,34 +35236,27 @@ |
| 35256 | 35236 | ){ |
| 35257 | 35237 | |
| 35258 | 35238 | #if defined(__CYGWIN__) |
| 35259 | 35239 | SimulateIOError( return SQLITE_ERROR ); |
| 35260 | 35240 | UNUSED_PARAMETER(nFull); |
| 35261 | | - assert( pVfs->mxPathname>=SQLITE_WIN32_MAX_PATH ); |
| 35241 | + assert( pVfs->mxPathname>=MAX_PATH ); |
| 35262 | 35242 | assert( nFull>=pVfs->mxPathname ); |
| 35263 | 35243 | if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ |
| 35264 | 35244 | /* |
| 35265 | 35245 | ** NOTE: We are dealing with a relative path name and the data |
| 35266 | 35246 | ** directory has been set. Therefore, use it as the basis |
| 35267 | 35247 | ** for converting the relative path name to an absolute |
| 35268 | 35248 | ** one by prepending the data directory and a slash. |
| 35269 | 35249 | */ |
| 35270 | | - char zOut[SQLITE_WIN32_MAX_PATH+1]; |
| 35271 | | - if( cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35272 | | - SQLITE_WIN32_MAX_PATH+1)<0 ){ |
| 35273 | | - winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35274 | | - zRelative); |
| 35275 | | - return SQLITE_CANTOPEN_FULLPATH; |
| 35276 | | - } |
| 35250 | + char zOut[MAX_PATH+1]; |
| 35251 | + memset(zOut, 0, MAX_PATH+1); |
| 35252 | + cygwin_conv_path(CCP_POSIX_TO_WIN_A|CCP_RELATIVE, zRelative, zOut, |
| 35253 | + MAX_PATH+1); |
| 35277 | 35254 | sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s\\%s", |
| 35278 | 35255 | sqlite3_data_directory, zOut); |
| 35279 | 35256 | }else{ |
| 35280 | | - if( cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull)<0 ){ |
| 35281 | | - winLogError(SQLITE_CANTOPEN_FULLPATH, (DWORD)errno, "cygwin_conv_path", |
| 35282 | | - zRelative); |
| 35283 | | - return SQLITE_CANTOPEN_FULLPATH; |
| 35284 | | - } |
| 35257 | + cygwin_conv_path(CCP_POSIX_TO_WIN_A, zRelative, zFull, nFull); |
| 35285 | 35258 | } |
| 35286 | 35259 | return SQLITE_OK; |
| 35287 | 35260 | #endif |
| 35288 | 35261 | |
| 35289 | 35262 | #if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) |
| | @@ -35621,11 +35594,11 @@ |
| 35621 | 35594 | */ |
| 35622 | 35595 | SQLITE_API int sqlite3_os_init(void){ |
| 35623 | 35596 | static sqlite3_vfs winVfs = { |
| 35624 | 35597 | 3, /* iVersion */ |
| 35625 | 35598 | sizeof(winFile), /* szOsFile */ |
| 35626 | | - SQLITE_WIN32_MAX_PATH, /* mxPathname */ |
| 35599 | + MAX_PATH, /* mxPathname */ |
| 35627 | 35600 | 0, /* pNext */ |
| 35628 | 35601 | "win32", /* zName */ |
| 35629 | 35602 | 0, /* pAppData */ |
| 35630 | 35603 | winOpen, /* xOpen */ |
| 35631 | 35604 | winDelete, /* xDelete */ |
| | @@ -60607,10 +60580,17 @@ |
| 60607 | 60580 | break; |
| 60608 | 60581 | } |
| 60609 | 60582 | case P4_MPRINTF: { |
| 60610 | 60583 | if( db->pnBytesFreed==0 ) sqlite3_free(p4); |
| 60611 | 60584 | break; |
| 60585 | + } |
| 60586 | + case P4_VDBEFUNC: { |
| 60587 | + VdbeFunc *pVdbeFunc = (VdbeFunc *)p4; |
| 60588 | + freeEphemeralFunction(db, pVdbeFunc->pFunc); |
| 60589 | + if( db->pnBytesFreed==0 ) sqlite3VdbeDeleteAuxData(pVdbeFunc, 0); |
| 60590 | + sqlite3DbFree(db, pVdbeFunc); |
| 60591 | + break; |
| 60612 | 60592 | } |
| 60613 | 60593 | case P4_FUNCDEF: { |
| 60614 | 60594 | freeEphemeralFunction(db, (FuncDef*)p4); |
| 60615 | 60595 | break; |
| 60616 | 60596 | } |
| | @@ -61637,14 +61617,10 @@ |
| 61637 | 61617 | while( p->pDelFrame ){ |
| 61638 | 61618 | VdbeFrame *pDel = p->pDelFrame; |
| 61639 | 61619 | p->pDelFrame = pDel->pParent; |
| 61640 | 61620 | sqlite3VdbeFrameDelete(pDel); |
| 61641 | 61621 | } |
| 61642 | | - |
| 61643 | | - /* Delete any auxdata allocations made by the VM */ |
| 61644 | | - sqlite3VdbeDeleteAuxData(p, -1, 0); |
| 61645 | | - assert( p->pAuxData==0 ); |
| 61646 | 61622 | } |
| 61647 | 61623 | |
| 61648 | 61624 | /* |
| 61649 | 61625 | ** Clean up the VM after execution. |
| 61650 | 61626 | ** |
| | @@ -62439,39 +62415,24 @@ |
| 62439 | 62415 | sqlite3VdbeDelete(p); |
| 62440 | 62416 | return rc; |
| 62441 | 62417 | } |
| 62442 | 62418 | |
| 62443 | 62419 | /* |
| 62444 | | -** If parameter iOp is less than zero, then invoke the destructor for |
| 62445 | | -** all auxiliary data pointers currently cached by the VM passed as |
| 62446 | | -** the first argument. |
| 62447 | | -** |
| 62448 | | -** Or, if iOp is greater than or equal to zero, then the destructor is |
| 62449 | | -** only invoked for those auxiliary data pointers created by the user |
| 62450 | | -** function invoked by the OP_Function opcode at instruction iOp of |
| 62451 | | -** VM pVdbe, and only then if: |
| 62452 | | -** |
| 62453 | | -** * the associated function parameter is the 32nd or later (counting |
| 62454 | | -** from left to right), or |
| 62455 | | -** |
| 62456 | | -** * the corresponding bit in argument mask is clear (where the first |
| 62457 | | -** function parameter corrsponds to bit 0 etc.). |
| 62420 | +** Call the destructor for each auxdata entry in pVdbeFunc for which |
| 62421 | +** the corresponding bit in mask is clear. Auxdata entries beyond 31 |
| 62422 | +** are always destroyed. To destroy all auxdata entries, call this |
| 62423 | +** routine with mask==0. |
| 62458 | 62424 | */ |
| 62459 | | -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){ |
| 62460 | | - AuxData **pp = &pVdbe->pAuxData; |
| 62461 | | - while( *pp ){ |
| 62462 | | - AuxData *pAux = *pp; |
| 62463 | | - if( (iOp<0) |
| 62464 | | - || (pAux->iOp==iOp && (pAux->iArg>31 || !(mask & ((u32)1<<pAux->iArg)))) |
| 62465 | | - ){ |
| 62425 | +SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(VdbeFunc *pVdbeFunc, int mask){ |
| 62426 | + int i; |
| 62427 | + for(i=0; i<pVdbeFunc->nAux; i++){ |
| 62428 | + struct AuxData *pAux = &pVdbeFunc->apAux[i]; |
| 62429 | + if( (i>31 || !(mask&(((u32)1)<<i))) && pAux->pAux ){ |
| 62466 | 62430 | if( pAux->xDelete ){ |
| 62467 | 62431 | pAux->xDelete(pAux->pAux); |
| 62468 | 62432 | } |
| 62469 | | - *pp = pAux->pNext; |
| 62470 | | - sqlite3DbFree(pVdbe->db, pAux); |
| 62471 | | - }else{ |
| 62472 | | - pp= &pAux->pNext; |
| 62433 | + pAux->pAux = 0; |
| 62473 | 62434 | } |
| 62474 | 62435 | } |
| 62475 | 62436 | } |
| 62476 | 62437 | |
| 62477 | 62438 | /* |
| | @@ -63866,18 +63827,18 @@ |
| 63866 | 63827 | /* |
| 63867 | 63828 | ** Return the auxilary data pointer, if any, for the iArg'th argument to |
| 63868 | 63829 | ** the user-function defined by pCtx. |
| 63869 | 63830 | */ |
| 63870 | 63831 | SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ |
| 63871 | | - AuxData *pAuxData; |
| 63832 | + VdbeFunc *pVdbeFunc; |
| 63872 | 63833 | |
| 63873 | 63834 | assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); |
| 63874 | | - for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){ |
| 63875 | | - if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break; |
| 63835 | + pVdbeFunc = pCtx->pVdbeFunc; |
| 63836 | + if( !pVdbeFunc || iArg>=pVdbeFunc->nAux || iArg<0 ){ |
| 63837 | + return 0; |
| 63876 | 63838 | } |
| 63877 | | - |
| 63878 | | - return (pAuxData ? pAuxData->pAux : 0); |
| 63839 | + return pVdbeFunc->apAux[iArg].pAux; |
| 63879 | 63840 | } |
| 63880 | 63841 | |
| 63881 | 63842 | /* |
| 63882 | 63843 | ** Set the auxilary data pointer and delete function, for the iArg'th |
| 63883 | 63844 | ** argument to the user-function defined by pCtx. Any previous value is |
| | @@ -63887,30 +63848,33 @@ |
| 63887 | 63848 | sqlite3_context *pCtx, |
| 63888 | 63849 | int iArg, |
| 63889 | 63850 | void *pAux, |
| 63890 | 63851 | void (*xDelete)(void*) |
| 63891 | 63852 | ){ |
| 63892 | | - AuxData *pAuxData; |
| 63893 | | - Vdbe *pVdbe = pCtx->pVdbe; |
| 63894 | | - |
| 63895 | | - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); |
| 63853 | + struct AuxData *pAuxData; |
| 63854 | + VdbeFunc *pVdbeFunc; |
| 63896 | 63855 | if( iArg<0 ) goto failed; |
| 63897 | 63856 | |
| 63898 | | - for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){ |
| 63899 | | - if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break; |
| 63900 | | - } |
| 63901 | | - if( pAuxData==0 ){ |
| 63902 | | - pAuxData = sqlite3DbMallocZero(pVdbe->db, sizeof(AuxData)); |
| 63903 | | - if( !pAuxData ) goto failed; |
| 63904 | | - pAuxData->iOp = pCtx->iOp; |
| 63905 | | - pAuxData->iArg = iArg; |
| 63906 | | - pAuxData->pNext = pVdbe->pAuxData; |
| 63907 | | - pVdbe->pAuxData = pAuxData; |
| 63908 | | - }else if( pAuxData->xDelete ){ |
| 63857 | + assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); |
| 63858 | + pVdbeFunc = pCtx->pVdbeFunc; |
| 63859 | + if( !pVdbeFunc || pVdbeFunc->nAux<=iArg ){ |
| 63860 | + int nAux = (pVdbeFunc ? pVdbeFunc->nAux : 0); |
| 63861 | + int nMalloc = sizeof(VdbeFunc) + sizeof(struct AuxData)*iArg; |
| 63862 | + pVdbeFunc = sqlite3DbRealloc(pCtx->s.db, pVdbeFunc, nMalloc); |
| 63863 | + if( !pVdbeFunc ){ |
| 63864 | + goto failed; |
| 63865 | + } |
| 63866 | + pCtx->pVdbeFunc = pVdbeFunc; |
| 63867 | + memset(&pVdbeFunc->apAux[nAux], 0, sizeof(struct AuxData)*(iArg+1-nAux)); |
| 63868 | + pVdbeFunc->nAux = iArg+1; |
| 63869 | + pVdbeFunc->pFunc = pCtx->pFunc; |
| 63870 | + } |
| 63871 | + |
| 63872 | + pAuxData = &pVdbeFunc->apAux[iArg]; |
| 63873 | + if( pAuxData->pAux && pAuxData->xDelete ){ |
| 63909 | 63874 | pAuxData->xDelete(pAuxData->pAux); |
| 63910 | 63875 | } |
| 63911 | | - |
| 63912 | 63876 | pAuxData->pAux = pAux; |
| 63913 | 63877 | pAuxData->xDelete = xDelete; |
| 63914 | 63878 | return; |
| 63915 | 63879 | |
| 63916 | 63880 | failed: |
| | @@ -65518,11 +65482,11 @@ |
| 65518 | 65482 | u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */ |
| 65519 | 65483 | u8 encoding = ENC(db); /* The database encoding */ |
| 65520 | 65484 | int iCompare = 0; /* Result of last OP_Compare operation */ |
| 65521 | 65485 | unsigned nVmStep = 0; /* Number of virtual machine steps */ |
| 65522 | 65486 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 65523 | | - unsigned nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */ |
| 65487 | + unsigned nProgressOps = 0; /* nVmStep at last progress callback. */ |
| 65524 | 65488 | #endif |
| 65525 | 65489 | Mem *aMem = p->aMem; /* Copy of p->aMem */ |
| 65526 | 65490 | Mem *pIn1 = 0; /* 1st input operand */ |
| 65527 | 65491 | Mem *pIn2 = 0; /* 2nd input operand */ |
| 65528 | 65492 | Mem *pIn3 = 0; /* 3rd input operand */ |
| | @@ -65977,21 +65941,10 @@ |
| 65977 | 65941 | assert( p->explain==0 ); |
| 65978 | 65942 | p->pResultSet = 0; |
| 65979 | 65943 | db->busyHandler.nBusy = 0; |
| 65980 | 65944 | CHECK_FOR_INTERRUPT; |
| 65981 | 65945 | sqlite3VdbeIOTraceSql(p); |
| 65982 | | -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 65983 | | - if( db->xProgress ){ |
| 65984 | | - assert( 0 < db->nProgressOps ); |
| 65985 | | - nProgressLimit = (unsigned)p->aCounter[SQLITE_STMTSTATUS_VM_STEP-1]; |
| 65986 | | - if( nProgressLimit==0 ){ |
| 65987 | | - nProgressLimit = db->nProgressOps; |
| 65988 | | - }else{ |
| 65989 | | - nProgressLimit %= (unsigned)db->nProgressOps; |
| 65990 | | - } |
| 65991 | | - } |
| 65992 | | -#endif |
| 65993 | 65946 | #ifdef SQLITE_DEBUG |
| 65994 | 65947 | sqlite3BeginBenignMalloc(); |
| 65995 | 65948 | if( p->pc==0 && (p->db->flags & SQLITE_VdbeListing)!=0 ){ |
| 65996 | 65949 | int i; |
| 65997 | 65950 | printf("VDBE Program Listing:\n"); |
| | @@ -66148,20 +66101,18 @@ |
| 66148 | 66101 | ** of VDBE ops have been executed (either since this invocation of |
| 66149 | 66102 | ** sqlite3VdbeExec() or since last time the progress callback was called). |
| 66150 | 66103 | ** If the progress callback returns non-zero, exit the virtual machine with |
| 66151 | 66104 | ** a return code SQLITE_ABORT. |
| 66152 | 66105 | */ |
| 66153 | | - if( db->xProgress!=0 && nVmStep>=nProgressLimit ){ |
| 66106 | + if( db->xProgress!=0 && (nVmStep - nProgressOps)>=db->nProgressOps ){ |
| 66154 | 66107 | int prc; |
| 66155 | 66108 | prc = db->xProgress(db->pProgressArg); |
| 66156 | 66109 | if( prc!=0 ){ |
| 66157 | 66110 | rc = SQLITE_INTERRUPT; |
| 66158 | 66111 | goto vdbe_error_halt; |
| 66159 | 66112 | } |
| 66160 | | - if( db->xProgress!=0 ){ |
| 66161 | | - nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps); |
| 66162 | | - } |
| 66113 | + nProgressOps = nVmStep; |
| 66163 | 66114 | } |
| 66164 | 66115 | #endif |
| 66165 | 66116 | |
| 66166 | 66117 | break; |
| 66167 | 66118 | } |
| | @@ -66843,18 +66794,23 @@ |
| 66843 | 66794 | Deephemeralize(u.ai.pArg); |
| 66844 | 66795 | sqlite3VdbeMemStoreType(u.ai.pArg); |
| 66845 | 66796 | REGISTER_TRACE(pOp->p2+u.ai.i, u.ai.pArg); |
| 66846 | 66797 | } |
| 66847 | 66798 | |
| 66848 | | - assert( pOp->p4type==P4_FUNCDEF ); |
| 66849 | | - u.ai.ctx.pFunc = pOp->p4.pFunc; |
| 66799 | + assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC ); |
| 66800 | + if( pOp->p4type==P4_FUNCDEF ){ |
| 66801 | + u.ai.ctx.pFunc = pOp->p4.pFunc; |
| 66802 | + u.ai.ctx.pVdbeFunc = 0; |
| 66803 | + }else{ |
| 66804 | + u.ai.ctx.pVdbeFunc = (VdbeFunc*)pOp->p4.pVdbeFunc; |
| 66805 | + u.ai.ctx.pFunc = u.ai.ctx.pVdbeFunc->pFunc; |
| 66806 | + } |
| 66807 | + |
| 66850 | 66808 | u.ai.ctx.s.flags = MEM_Null; |
| 66851 | 66809 | u.ai.ctx.s.db = db; |
| 66852 | 66810 | u.ai.ctx.s.xDel = 0; |
| 66853 | 66811 | u.ai.ctx.s.zMalloc = 0; |
| 66854 | | - u.ai.ctx.iOp = pc; |
| 66855 | | - u.ai.ctx.pVdbe = p; |
| 66856 | 66812 | |
| 66857 | 66813 | /* The output cell may already have a buffer allocated. Move |
| 66858 | 66814 | ** the pointer to u.ai.ctx.s so in case the user-function can use |
| 66859 | 66815 | ** the already allocated buffer instead of allocating a new one. |
| 66860 | 66816 | */ |
| | @@ -66873,11 +66829,15 @@ |
| 66873 | 66829 | lastRowid = db->lastRowid; |
| 66874 | 66830 | |
| 66875 | 66831 | /* If any auxiliary data functions have been called by this user function, |
| 66876 | 66832 | ** immediately call the destructor for any non-static values. |
| 66877 | 66833 | */ |
| 66878 | | - sqlite3VdbeDeleteAuxData(p, pc, pOp->p1); |
| 66834 | + if( u.ai.ctx.pVdbeFunc ){ |
| 66835 | + sqlite3VdbeDeleteAuxData(u.ai.ctx.pVdbeFunc, pOp->p1); |
| 66836 | + pOp->p4.pVdbeFunc = u.ai.ctx.pVdbeFunc; |
| 66837 | + pOp->p4type = P4_VDBEFUNC; |
| 66838 | + } |
| 66879 | 66839 | |
| 66880 | 66840 | if( db->mallocFailed ){ |
| 66881 | 66841 | /* Even though a malloc() has failed, the implementation of the |
| 66882 | 66842 | ** user function may have called an sqlite3_result_XXX() function |
| 66883 | 66843 | ** to return a value. The following call releases any resources |
| | @@ -107790,11 +107750,10 @@ |
| 107790 | 107750 | WhereLevel *pLevel; /* The where level to be coded */ |
| 107791 | 107751 | WhereLoop *pLoop; /* The WhereLoop object being coded */ |
| 107792 | 107752 | WhereClause *pWC; /* Decomposition of the entire WHERE clause */ |
| 107793 | 107753 | WhereTerm *pTerm; /* A WHERE clause term */ |
| 107794 | 107754 | Parse *pParse; /* Parsing context */ |
| 107795 | | - sqlite3 *db; /* Database connection */ |
| 107796 | 107755 | Vdbe *v; /* The prepared stmt under constructions */ |
| 107797 | 107756 | struct SrcList_item *pTabItem; /* FROM clause term being coded */ |
| 107798 | 107757 | int addrBrk; /* Jump here to break out of the loop */ |
| 107799 | 107758 | int addrCont; /* Jump here to continue with next cycle */ |
| 107800 | 107759 | int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ |
| | @@ -107802,11 +107761,10 @@ |
| 107802 | 107761 | Bitmask newNotReady; /* Return value */ |
| 107803 | 107762 | |
| 107804 | 107763 | pParse = pWInfo->pParse; |
| 107805 | 107764 | v = pParse->pVdbe; |
| 107806 | 107765 | pWC = &pWInfo->sWC; |
| 107807 | | - db = pParse->db; |
| 107808 | 107766 | pLevel = &pWInfo->a[iLevel]; |
| 107809 | 107767 | pLoop = pLevel->pWLoop; |
| 107810 | 107768 | pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 107811 | 107769 | iCur = pTabItem->iCursor; |
| 107812 | 107770 | bRev = (pWInfo->revMask>>iLevel)&1; |
| | @@ -108093,11 +108051,11 @@ |
| 108093 | 108051 | /* Generate code to evaluate all constraint terms using == or IN |
| 108094 | 108052 | ** and store the values of those terms in an array of registers |
| 108095 | 108053 | ** starting at regBase. |
| 108096 | 108054 | */ |
| 108097 | 108055 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 108098 | | - zEndAff = sqlite3DbStrDup(db, zStartAff); |
| 108056 | + zEndAff = sqlite3DbStrDup(pParse->db, zStartAff); |
| 108099 | 108057 | addrNxt = pLevel->addrNxt; |
| 108100 | 108058 | |
| 108101 | 108059 | /* If we are doing a reverse order scan on an ascending index, or |
| 108102 | 108060 | ** a forward order scan on a descending index, interchange the |
| 108103 | 108061 | ** start and end terms (pRangeStart and pRangeEnd). |
| | @@ -108178,12 +108136,12 @@ |
| 108178 | 108136 | } |
| 108179 | 108137 | codeApplyAffinity(pParse, regBase, nEq+1, zEndAff); |
| 108180 | 108138 | nConstraint++; |
| 108181 | 108139 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 108182 | 108140 | } |
| 108183 | | - sqlite3DbFree(db, zStartAff); |
| 108184 | | - sqlite3DbFree(db, zEndAff); |
| 108141 | + sqlite3DbFree(pParse->db, zStartAff); |
| 108142 | + sqlite3DbFree(pParse->db, zEndAff); |
| 108185 | 108143 | |
| 108186 | 108144 | /* Top of the loop body */ |
| 108187 | 108145 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 108188 | 108146 | |
| 108189 | 108147 | /* Check if the index cursor is past the end of the range. */ |
| | @@ -108306,11 +108264,11 @@ |
| 108306 | 108264 | */ |
| 108307 | 108265 | if( pWInfo->nLevel>1 ){ |
| 108308 | 108266 | int nNotReady; /* The number of notReady tables */ |
| 108309 | 108267 | struct SrcList_item *origSrc; /* Original list of tables */ |
| 108310 | 108268 | nNotReady = pWInfo->nLevel - iLevel - 1; |
| 108311 | | - pOrTab = sqlite3StackAllocRaw(db, |
| 108269 | + pOrTab = sqlite3StackAllocRaw(pParse->db, |
| 108312 | 108270 | sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); |
| 108313 | 108271 | if( pOrTab==0 ) return notReady; |
| 108314 | 108272 | pOrTab->nAlloc = (u8)(nNotReady + 1); |
| 108315 | 108273 | pOrTab->nSrc = pOrTab->nAlloc; |
| 108316 | 108274 | memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); |
| | @@ -108360,12 +108318,12 @@ |
| 108360 | 108318 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| 108361 | 108319 | if( &pWC->a[iTerm] == pTerm ) continue; |
| 108362 | 108320 | if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; |
| 108363 | 108321 | if( pWC->a[iTerm].wtFlags & (TERM_ORINFO) ) continue; |
| 108364 | 108322 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 108365 | | - pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 108366 | | - pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); |
| 108323 | + pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| 108324 | + pAndExpr = sqlite3ExprAnd(pParse->db, pAndExpr, pExpr); |
| 108367 | 108325 | } |
| 108368 | 108326 | if( pAndExpr ){ |
| 108369 | 108327 | pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); |
| 108370 | 108328 | } |
| 108371 | 108329 | } |
| | @@ -108381,11 +108339,11 @@ |
| 108381 | 108339 | } |
| 108382 | 108340 | /* Loop through table entries that match term pOrTerm. */ |
| 108383 | 108341 | pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, |
| 108384 | 108342 | WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | |
| 108385 | 108343 | WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); |
| 108386 | | - assert( pSubWInfo || pParse->nErr || db->mallocFailed ); |
| 108344 | + assert( pSubWInfo || pParse->nErr || pParse->db->mallocFailed ); |
| 108387 | 108345 | if( pSubWInfo ){ |
| 108388 | 108346 | WhereLoop *pSubLoop; |
| 108389 | 108347 | explainOneScan( |
| 108390 | 108348 | pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 |
| 108391 | 108349 | ); |
| | @@ -108436,17 +108394,17 @@ |
| 108436 | 108394 | } |
| 108437 | 108395 | pLevel->u.pCovidx = pCov; |
| 108438 | 108396 | if( pCov ) pLevel->iIdxCur = iCovCur; |
| 108439 | 108397 | if( pAndExpr ){ |
| 108440 | 108398 | pAndExpr->pLeft = 0; |
| 108441 | | - sqlite3ExprDelete(db, pAndExpr); |
| 108399 | + sqlite3ExprDelete(pParse->db, pAndExpr); |
| 108442 | 108400 | } |
| 108443 | 108401 | sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); |
| 108444 | 108402 | sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
| 108445 | 108403 | sqlite3VdbeResolveLabel(v, iLoopBody); |
| 108446 | 108404 | |
| 108447 | | - if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); |
| 108405 | + if( pWInfo->nLevel>1 ) sqlite3StackFree(pParse->db, pOrTab); |
| 108448 | 108406 | if( !untestedTerms ) disableTerm(pLevel, pTerm); |
| 108449 | 108407 | }else |
| 108450 | 108408 | #endif /* SQLITE_OMIT_OR_OPTIMIZATION */ |
| 108451 | 108409 | |
| 108452 | 108410 | { |
| | @@ -108497,12 +108455,13 @@ |
| 108497 | 108455 | ** and we are coding the t1 loop and the t2 loop has not yet coded, |
| 108498 | 108456 | ** then we cannot use the "t1.a=t2.b" constraint, but we can code |
| 108499 | 108457 | ** the implied "t1.a=123" constraint. |
| 108500 | 108458 | */ |
| 108501 | 108459 | for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ |
| 108502 | | - Expr *pE, *pEAlt; |
| 108460 | + Expr *pE; |
| 108503 | 108461 | WhereTerm *pAlt; |
| 108462 | + Expr sEq; |
| 108504 | 108463 | if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; |
| 108505 | 108464 | if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; |
| 108506 | 108465 | if( pTerm->leftCursor!=iCur ) continue; |
| 108507 | 108466 | if( pLevel->iLeftJoin ) continue; |
| 108508 | 108467 | pE = pTerm->pExpr; |
| | @@ -108512,17 +108471,13 @@ |
| 108512 | 108471 | if( pAlt==0 ) continue; |
| 108513 | 108472 | if( pAlt->wtFlags & (TERM_CODED) ) continue; |
| 108514 | 108473 | testcase( pAlt->eOperator & WO_EQ ); |
| 108515 | 108474 | testcase( pAlt->eOperator & WO_IN ); |
| 108516 | 108475 | VdbeNoopComment((v, "begin transitive constraint")); |
| 108517 | | - pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); |
| 108518 | | - if( pEAlt ){ |
| 108519 | | - *pEAlt = *pAlt->pExpr; |
| 108520 | | - pEAlt->pLeft = pE->pLeft; |
| 108521 | | - sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); |
| 108522 | | - sqlite3StackFree(db, pEAlt); |
| 108523 | | - } |
| 108476 | + sEq = *pAlt->pExpr; |
| 108477 | + sEq.pLeft = pE->pLeft; |
| 108478 | + sqlite3ExprIfFalse(pParse, &sEq, addrCont, SQLITE_JUMPIFNULL); |
| 108524 | 108479 | } |
| 108525 | 108480 | |
| 108526 | 108481 | /* For a LEFT OUTER JOIN, generate code that will record the fact that |
| 108527 | 108482 | ** at least one row of the right table has matched the left table. |
| 108528 | 108483 | */ |
| | @@ -116461,11 +116416,10 @@ |
| 116461 | 116416 | case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; |
| 116462 | 116417 | case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; |
| 116463 | 116418 | case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; |
| 116464 | 116419 | case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; |
| 116465 | 116420 | case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; |
| 116466 | | - case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; |
| 116467 | 116421 | case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; |
| 116468 | 116422 | case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; |
| 116469 | 116423 | case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; |
| 116470 | 116424 | case SQLITE_FULL: zName = "SQLITE_FULL"; break; |
| 116471 | 116425 | case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; |
| | @@ -117817,11 +117771,11 @@ |
| 117817 | 117771 | db->autoCommit = 1; |
| 117818 | 117772 | db->nextAutovac = -1; |
| 117819 | 117773 | db->szMmap = sqlite3GlobalConfig.szMmap; |
| 117820 | 117774 | db->nextPagesize = 0; |
| 117821 | 117775 | db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger |
| 117822 | | -#if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX |
| 117776 | +#if !defined(SQLITE_DEAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX |
| 117823 | 117777 | | SQLITE_AutoIndex |
| 117824 | 117778 | #endif |
| 117825 | 117779 | #if SQLITE_DEFAULT_FILE_FORMAT<4 |
| 117826 | 117780 | | SQLITE_LegacyFileFmt |
| 117827 | 117781 | #endif |
| | @@ -128290,11 +128244,11 @@ |
| 128290 | 128244 | } |
| 128291 | 128245 | |
| 128292 | 128246 | |
| 128293 | 128247 | #ifdef SQLITE_TEST |
| 128294 | 128248 | |
| 128295 | | -#include <tcl.h> |
| 128249 | +/* #include <tcl.h> */ |
| 128296 | 128250 | /* #include <string.h> */ |
| 128297 | 128251 | |
| 128298 | 128252 | /* |
| 128299 | 128253 | ** Implementation of a special SQL scalar function for testing tokenizers |
| 128300 | 128254 | ** designed to be used in concert with the Tcl testing framework. This |
| 128301 | 128255 | |