| | @@ -16,11 +16,11 @@ |
| 16 | 16 | ** if you want a wrapper to interface SQLite with your choice of programming |
| 17 | 17 | ** language. The code for the "sqlite3" command-line shell is also in a |
| 18 | 18 | ** separate file. This file contains only code for the core SQLite library. |
| 19 | 19 | ** |
| 20 | 20 | ** The content in this amalgamation comes from Fossil check-in |
| 21 | | -** 3ca1ed81c4fa41f5f9fdbebf0929dd8421a4 with changes in files: |
| 21 | +** 0780bce854b962fb2d4a1a19c55c9b5790a9 with changes in files: |
| 22 | 22 | ** |
| 23 | 23 | ** |
| 24 | 24 | */ |
| 25 | 25 | #ifndef SQLITE_AMALGAMATION |
| 26 | 26 | #define SQLITE_CORE 1 |
| | @@ -467,14 +467,14 @@ |
| 467 | 467 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 468 | 468 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 469 | 469 | */ |
| 470 | 470 | #define SQLITE_VERSION "3.52.0" |
| 471 | 471 | #define SQLITE_VERSION_NUMBER 3052000 |
| 472 | | -#define SQLITE_SOURCE_ID "2026-02-23 19:51:54 3ca1ed81c4fa41f5f9fdbebf0929dd8421a4e29f95764fe1027d4d8706a41480" |
| 472 | +#define SQLITE_SOURCE_ID "2026-02-27 22:59:46 0780bce854b962fb2d4a1a19c55c9b5790a9669f26e1ff8b5f1f1733cfc647e0" |
| 473 | 473 | #define SQLITE_SCM_BRANCH "trunk" |
| 474 | 474 | #define SQLITE_SCM_TAGS "" |
| 475 | | -#define SQLITE_SCM_DATETIME "2026-02-23T19:51:54.706Z" |
| 475 | +#define SQLITE_SCM_DATETIME "2026-02-27T22:59:46.633Z" |
| 476 | 476 | |
| 477 | 477 | /* |
| 478 | 478 | ** CAPI3REF: Run-Time Library Version Numbers |
| 479 | 479 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 480 | 480 | ** |
| | @@ -4772,23 +4772,24 @@ |
| 4772 | 4772 | ** fails, the sqlite3_prepare_v3() call returns the same error indications |
| 4773 | 4773 | ** with or without this flag; it just omits the call to [sqlite3_log()] that |
| 4774 | 4774 | ** logs the error. |
| 4775 | 4775 | ** |
| 4776 | 4776 | ** [[SQLITE_PREPARE_FROM_DDL]] <dt>SQLITE_PREPARE_FROM_DDL</dt> |
| 4777 | | -** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to behave as if |
| 4778 | | -** the SQL statement is part of a database schema. This makes a difference |
| 4779 | | -** when the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] option is set to off. |
| 4780 | | -** When this option is used and SQLITE_DBCONFIG_TRUSTED_SCHEMA is off, |
| 4781 | | -** SQL functions may not be called unless they are tagged with |
| 4782 | | -** [SQLITE_INNOCUOUS] and virtual tables may not be used unless tagged |
| 4783 | | -** with [SQLITE_VTAB_INNOCUOUS]. Use the SQLITE_PREPARE_FROM_DDL option |
| 4784 | | -** when preparing SQL that is derived from parts of the database |
| 4785 | | -** schema. In particular, virtual table implementations that |
| 4786 | | -** run SQL statements based on the arguments to their CREATE VIRTUAL |
| 4787 | | -** TABLE statement should use [sqlite3_prepare_v3()] and set the |
| 4788 | | -** SQLITE_PREPARE_FROM_DLL flag to prevent bypass of the |
| 4789 | | -** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks. |
| 4777 | +** <dd>The SQLITE_PREPARE_FROM_DDL flag causes the SQL compiler to enforce |
| 4778 | +** security constraints that would otherwise only be enforced when parsing |
| 4779 | +** the database schema. In other words, the SQLITE_PREPARE_FROM_DDL flag |
| 4780 | +** causes the SQL compiler to treat the SQL statement being prepared as if |
| 4781 | +** it had come from an attacker. When SQLITE_PREPARE_FROM_DDL is used and |
| 4782 | +** [SQLITE_DBCONFIG_TRUSTED_SCHEMA] is off, SQL functions may only be called |
| 4783 | +** if they are tagged with [SQLITE_INNOCUOUS] and virtual tables may only |
| 4784 | +** be used if they are tagged with [SQLITE_VTAB_INNOCUOUS]. Best practice |
| 4785 | +** is to use the SQLITE_PREPARE_FROM_DDL option when preparing any SQL that |
| 4786 | +** is derived from parts of the database schema. In particular, virtual |
| 4787 | +** table implementations that run SQL statements that are derived from |
| 4788 | +** arguments to their CREATE VIRTUAL TABLE statement should always use |
| 4789 | +** [sqlite3_prepare_v3()] and set the SQLITE_PREPARE_FROM_DDL flag to |
| 4790 | +** prevent bypass of the [SQLITE_DBCONFIG_TRUSTED_SCHEMA] security checks. |
| 4790 | 4791 | ** </dl> |
| 4791 | 4792 | */ |
| 4792 | 4793 | #define SQLITE_PREPARE_PERSISTENT 0x01 |
| 4793 | 4794 | #define SQLITE_PREPARE_NORMALIZE 0x02 |
| 4794 | 4795 | #define SQLITE_PREPARE_NO_VTAB 0x04 |
| | @@ -17949,14 +17950,14 @@ |
| 17949 | 17950 | void *pData; /* Page data */ |
| 17950 | 17951 | void *pExtra; /* Extra content */ |
| 17951 | 17952 | PCache *pCache; /* PRIVATE: Cache that owns this page */ |
| 17952 | 17953 | PgHdr *pDirty; /* Transient list of dirty sorted by pgno */ |
| 17953 | 17954 | Pager *pPager; /* The pager this page is part of */ |
| 17954 | | - Pgno pgno; /* Page number for this page */ |
| 17955 | 17955 | #ifdef SQLITE_CHECK_PAGES |
| 17956 | | - u32 pageHash; /* Hash of page content */ |
| 17956 | + u64 pageHash; /* Hash of page content */ |
| 17957 | 17957 | #endif |
| 17958 | + Pgno pgno; /* Page number for this page */ |
| 17958 | 17959 | u16 flags; /* PGHDR flags defined below */ |
| 17959 | 17960 | |
| 17960 | 17961 | /********************************************************************** |
| 17961 | 17962 | ** Elements above, except pCache, are public. All that follow are |
| 17962 | 17963 | ** private to pcache.c and should not be accessed by other modules. |
| | @@ -21541,11 +21542,24 @@ |
| 21541 | 21542 | |
| 21542 | 21543 | /* Access to mutexes used by sqlite3_status() */ |
| 21543 | 21544 | SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void); |
| 21544 | 21545 | SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void); |
| 21545 | 21546 | |
| 21546 | | -#if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT) |
| 21547 | + |
| 21548 | +/* The SQLITE_THREAD_MISUSE_WARNINGS compile-time option used to be called |
| 21549 | +** SQLITE_ENABLE_MULTITHREADED_CHECKS. Keep that older macro for backwards |
| 21550 | +** compatibility, at least for a while... */ |
| 21551 | +#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS |
| 21552 | +# define SQLITE_THREAD_MISUSE_WARNINGS 1 |
| 21553 | +#endif |
| 21554 | + |
| 21555 | +/* SQLITE_THREAD_MISUSE_ABORT implies SQLITE_THREAD_MISUSE_WARNINGS */ |
| 21556 | +#ifdef SQLITE_THREAD_MISUSE_ABORT |
| 21557 | +# define SQLITE_THREAD_MISUSE_WARNINGS 1 |
| 21558 | +#endif |
| 21559 | + |
| 21560 | +#if defined(SQLITE_THREAD_MISUSE_WARNINGS) && !defined(SQLITE_MUTEX_OMIT) |
| 21547 | 21561 | SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*); |
| 21548 | 21562 | #else |
| 21549 | 21563 | # define sqlite3MutexWarnOnContention(x) |
| 21550 | 21564 | #endif |
| 21551 | 21565 | |
| | @@ -26951,11 +26965,11 @@ |
| 26951 | 26965 | DateTime x; |
| 26952 | 26966 | if( isDate(context, argc, argv, &x)==0 ){ |
| 26953 | 26967 | char *zJson; |
| 26954 | 26968 | zJson = sqlite3_mprintf( |
| 26955 | 26969 | "{iJD:%lld,Y:%d,M:%d,D:%d,h:%d,m:%d,tz:%d," |
| 26956 | | - "s:%.3f,validJD:%d,validYMS:%d,validHMS:%d," |
| 26970 | + "s:%.3f,validJD:%d,validYMD:%d,validHMS:%d," |
| 26957 | 26971 | "nFloor:%d,rawS:%d,isError:%d,useSubsec:%d," |
| 26958 | 26972 | "isUtc:%d,isLocal:%d}", |
| 26959 | 26973 | x.iJD, x.Y, x.M, x.D, x.h, x.m, x.tz, |
| 26960 | 26974 | x.s, x.validJD, x.validYMD, x.validHMS, |
| 26961 | 26975 | x.nFloor, x.rawS, x.isError, x.useSubsec, |
| | @@ -29730,27 +29744,32 @@ |
| 29730 | 29744 | #endif /* SQLITE_DEBUG && !defined(SQLITE_MUTEX_OMIT) */ |
| 29731 | 29745 | |
| 29732 | 29746 | |
| 29733 | 29747 | #ifndef SQLITE_MUTEX_OMIT |
| 29734 | 29748 | |
| 29735 | | -#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS |
| 29749 | +#ifdef SQLITE_THREAD_MISUSE_WARNINGS |
| 29736 | 29750 | /* |
| 29737 | | -** This block (enclosed by SQLITE_ENABLE_MULTITHREADED_CHECKS) contains |
| 29751 | +** This block (enclosed by SQLITE_THREAD_MISUSE_WARNINGS) contains |
| 29738 | 29752 | ** the implementation of a wrapper around the system default mutex |
| 29739 | 29753 | ** implementation (sqlite3DefaultMutex()). |
| 29740 | 29754 | ** |
| 29741 | 29755 | ** Most calls are passed directly through to the underlying default |
| 29742 | 29756 | ** mutex implementation. Except, if a mutex is configured by calling |
| 29743 | 29757 | ** sqlite3MutexWarnOnContention() on it, then if contention is ever |
| 29744 | | -** encountered within xMutexEnter() a warning is emitted via sqlite3_log(). |
| 29758 | +** encountered within xMutexEnter() then a warning is emitted via |
| 29759 | +** sqlite3_log(). Furthermore, if SQLITE_THREAD_MISUSE_ABORT is |
| 29760 | +** defined then abort() is called after the sqlite3_log() warning. |
| 29745 | 29761 | ** |
| 29746 | | -** This type of mutex is used as the database handle mutex when testing |
| 29747 | | -** apps that usually use SQLITE_CONFIG_MULTITHREAD mode. |
| 29762 | +** This type of mutex is used on the database handle mutex when testing |
| 29763 | +** apps that usually use SQLITE_CONFIG_MULTITHREAD mode. A failure |
| 29764 | +** indicates that the app ought to be using SQLITE_OPEN_FULLMUTEX or |
| 29765 | +** similar because it is trying to use the same database handle from |
| 29766 | +** two different connections at the same time. |
| 29748 | 29767 | */ |
| 29749 | 29768 | |
| 29750 | 29769 | /* |
| 29751 | | -** Type for all mutexes used when SQLITE_ENABLE_MULTITHREADED_CHECKS |
| 29770 | +** Type for all mutexes used when SQLITE_THREAD_MISUSE_WARNINGS |
| 29752 | 29771 | ** is defined. Variable CheckMutex.mutex is a pointer to the real mutex |
| 29753 | 29772 | ** allocated by the system mutex implementation. Variable iType is usually set |
| 29754 | 29773 | ** to the type of mutex requested - SQLITE_MUTEX_RECURSIVE, SQLITE_MUTEX_FAST |
| 29755 | 29774 | ** or one of the static mutex identifiers. Or, if this is a recursive mutex |
| 29756 | 29775 | ** that has been configured using sqlite3MutexWarnOnContention(), it is |
| | @@ -29863,10 +29882,13 @@ |
| 29863 | 29882 | return; |
| 29864 | 29883 | } |
| 29865 | 29884 | sqlite3_log(SQLITE_MISUSE, |
| 29866 | 29885 | "illegal multi-threaded access to database connection" |
| 29867 | 29886 | ); |
| 29887 | +#if SQLITE_THREAD_MISUSE_ABORT |
| 29888 | + abort(); |
| 29889 | +#endif |
| 29868 | 29890 | } |
| 29869 | 29891 | pGlobalMutexMethods->xMutexEnter(pCheck->mutex); |
| 29870 | 29892 | } |
| 29871 | 29893 | |
| 29872 | 29894 | /* |
| | @@ -29914,11 +29936,11 @@ |
| 29914 | 29936 | CheckMutex *pCheck = (CheckMutex*)p; |
| 29915 | 29937 | assert( pCheck->iType==SQLITE_MUTEX_RECURSIVE ); |
| 29916 | 29938 | pCheck->iType = SQLITE_MUTEX_WARNONCONTENTION; |
| 29917 | 29939 | } |
| 29918 | 29940 | } |
| 29919 | | -#endif /* ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS */ |
| 29941 | +#endif /* ifdef SQLITE_THREAD_MISUSE_WARNINGS */ |
| 29920 | 29942 | |
| 29921 | 29943 | /* |
| 29922 | 29944 | ** Initialize the mutex system. |
| 29923 | 29945 | */ |
| 29924 | 29946 | SQLITE_PRIVATE int sqlite3MutexInit(void){ |
| | @@ -29931,11 +29953,11 @@ |
| 29931 | 29953 | */ |
| 29932 | 29954 | sqlite3_mutex_methods const *pFrom; |
| 29933 | 29955 | sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex; |
| 29934 | 29956 | |
| 29935 | 29957 | if( sqlite3GlobalConfig.bCoreMutex ){ |
| 29936 | | -#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS |
| 29958 | +#ifdef SQLITE_THREAD_MISUSE_WARNINGS |
| 29937 | 29959 | pFrom = multiThreadedCheckMutex(); |
| 29938 | 29960 | #else |
| 29939 | 29961 | pFrom = sqlite3DefaultMutex(); |
| 29940 | 29962 | #endif |
| 29941 | 29963 | }else{ |
| | @@ -36570,32 +36592,32 @@ |
| 36570 | 36592 | 0xa56fa5b99019a5c8LLU, /* 26: 1.0e+26 >> 23 */ |
| 36571 | 36593 | }; |
| 36572 | 36594 | static const u64 aScale[] = { |
| 36573 | 36595 | 0x8049a4ac0c5811aeLLU, /* 0: 1.0e-351 << 1229 */ |
| 36574 | 36596 | 0xcf42894a5dce35eaLLU, /* 1: 1.0e-324 << 1140 */ |
| 36575 | | - 0xa76c582338ed2621LLU, /* 2: 1.0e-297 << 1050 */ |
| 36597 | + 0xa76c582338ed2622LLU, /* 2: 1.0e-297 << 1050 */ |
| 36576 | 36598 | 0x873e4f75e2224e68LLU, /* 3: 1.0e-270 << 960 */ |
| 36577 | | - 0xda7f5bf590966848LLU, /* 4: 1.0e-243 << 871 */ |
| 36578 | | - 0xb080392cc4349decLLU, /* 5: 1.0e-216 << 781 */ |
| 36599 | + 0xda7f5bf590966849LLU, /* 4: 1.0e-243 << 871 */ |
| 36600 | + 0xb080392cc4349dedLLU, /* 5: 1.0e-216 << 781 */ |
| 36579 | 36601 | 0x8e938662882af53eLLU, /* 6: 1.0e-189 << 691 */ |
| 36580 | 36602 | 0xe65829b3046b0afaLLU, /* 7: 1.0e-162 << 602 */ |
| 36581 | | - 0xba121a4650e4ddebLLU, /* 8: 1.0e-135 << 512 */ |
| 36603 | + 0xba121a4650e4ddecLLU, /* 8: 1.0e-135 << 512 */ |
| 36582 | 36604 | 0x964e858c91ba2655LLU, /* 9: 1.0e-108 << 422 */ |
| 36583 | | - 0xf2d56790ab41c2a2LLU, /* 10: 1.0e-81 << 333 */ |
| 36584 | | - 0xc428d05aa4751e4cLLU, /* 11: 1.0e-54 << 243 */ |
| 36605 | + 0xf2d56790ab41c2a3LLU, /* 10: 1.0e-81 << 333 */ |
| 36606 | + 0xc428d05aa4751e4dLLU, /* 11: 1.0e-54 << 243 */ |
| 36585 | 36607 | 0x9e74d1b791e07e48LLU, /* 12: 1.0e-27 << 153 */ |
| 36586 | 36608 | 0x8000000000000000LLU, /* 13: 1.0e+0 << 63 */ |
| 36587 | 36609 | 0xcecb8f27f4200f3aLLU, /* 14: 1.0e+27 >> 26 */ |
| 36588 | | - 0xa70c3c40a64e6c51LLU, /* 15: 1.0e+54 >> 116 */ |
| 36610 | + 0xa70c3c40a64e6c52LLU, /* 15: 1.0e+54 >> 116 */ |
| 36589 | 36611 | 0x86f0ac99b4e8dafdLLU, /* 16: 1.0e+81 >> 206 */ |
| 36590 | | - 0xda01ee641a708de9LLU, /* 17: 1.0e+108 >> 295 */ |
| 36612 | + 0xda01ee641a708deaLLU, /* 17: 1.0e+108 >> 295 */ |
| 36591 | 36613 | 0xb01ae745b101e9e4LLU, /* 18: 1.0e+135 >> 385 */ |
| 36592 | 36614 | 0x8e41ade9fbebc27dLLU, /* 19: 1.0e+162 >> 475 */ |
| 36593 | | - 0xe5d3ef282a242e81LLU, /* 20: 1.0e+189 >> 564 */ |
| 36615 | + 0xe5d3ef282a242e82LLU, /* 20: 1.0e+189 >> 564 */ |
| 36594 | 36616 | 0xb9a74a0637ce2ee1LLU, /* 21: 1.0e+216 >> 654 */ |
| 36595 | 36617 | 0x95f83d0a1fb69cd9LLU, /* 22: 1.0e+243 >> 744 */ |
| 36596 | | - 0xf24a01a73cf2dccfLLU, /* 23: 1.0e+270 >> 833 */ |
| 36618 | + 0xf24a01a73cf2dcd0LLU, /* 23: 1.0e+270 >> 833 */ |
| 36597 | 36619 | 0xc3b8358109e84f07LLU, /* 24: 1.0e+297 >> 923 */ |
| 36598 | 36620 | 0x9e19db92b4e31ba9LLU, /* 25: 1.0e+324 >> 1013 */ |
| 36599 | 36621 | }; |
| 36600 | 36622 | int g, n; |
| 36601 | 36623 | u64 x, y; |
| | @@ -36618,11 +36640,11 @@ |
| 36618 | 36640 | if( n==0 ){ |
| 36619 | 36641 | return y; |
| 36620 | 36642 | } |
| 36621 | 36643 | x = sqlite3Multiply128(aBase[n],y); |
| 36622 | 36644 | if( (U64_BIT(63) & x)==0 ){ |
| 36623 | | - x <<= 1; |
| 36645 | + x = (x<<1)|1; |
| 36624 | 36646 | } |
| 36625 | 36647 | return x; |
| 36626 | 36648 | } |
| 36627 | 36649 | |
| 36628 | 36650 | /* |
| | @@ -36725,11 +36747,11 @@ |
| 36725 | 36747 | e1--; |
| 36726 | 36748 | } |
| 36727 | 36749 | if( e1<=(-972) ){ |
| 36728 | 36750 | return INFINITY; |
| 36729 | 36751 | } |
| 36730 | | - out = (out + 1 + ((out>>2)&1)) >> 2; |
| 36752 | + out = (out + 1) >> 2; |
| 36731 | 36753 | if( (out & U64_BIT(52))!=0 ){ |
| 36732 | 36754 | out = (out & ~U64_BIT(52)) | ((u64)(1075-e1)<<52); |
| 36733 | 36755 | } |
| 36734 | 36756 | memcpy(&r, &out, 8); |
| 36735 | 36757 | return r; |
| | @@ -60272,21 +60294,21 @@ |
| 60272 | 60294 | ** on the cache using a hash function. This is used for testing |
| 60273 | 60295 | ** and debugging only. |
| 60274 | 60296 | */ |
| 60275 | 60297 | #ifdef SQLITE_CHECK_PAGES |
| 60276 | 60298 | /* |
| 60277 | | -** Return a 32-bit hash of the page data for pPage. |
| 60299 | +** Return a 64-bit hash of the page data for pPage. |
| 60278 | 60300 | */ |
| 60279 | | -static u32 pager_datahash(int nByte, unsigned char *pData){ |
| 60280 | | - u32 hash = 0; |
| 60301 | +static u64 pager_datahash(int nByte, unsigned char *pData){ |
| 60302 | + u64 hash = 0; |
| 60281 | 60303 | int i; |
| 60282 | 60304 | for(i=0; i<nByte; i++){ |
| 60283 | 60305 | hash = (hash*1039) + pData[i]; |
| 60284 | 60306 | } |
| 60285 | 60307 | return hash; |
| 60286 | 60308 | } |
| 60287 | | -static u32 pager_pagehash(PgHdr *pPage){ |
| 60309 | +static u64 pager_pagehash(PgHdr *pPage){ |
| 60288 | 60310 | return pager_datahash(pPage->pPager->pageSize, (unsigned char *)pPage->pData); |
| 60289 | 60311 | } |
| 60290 | 60312 | static void pager_set_pagehash(PgHdr *pPage){ |
| 60291 | 60313 | pPage->pageHash = pager_pagehash(pPage); |
| 60292 | 60314 | } |
| | @@ -85002,18 +85024,19 @@ |
| 85002 | 85024 | */ |
| 85003 | 85025 | static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){ |
| 85004 | 85026 | StrAccum acc; |
| 85005 | 85027 | assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) ); |
| 85006 | 85028 | assert( sz>22 ); |
| 85007 | | - if( p->flags & (MEM_Int|MEM_IntReal) ){ |
| 85008 | | -#if 0 |
| 85009 | | - /* Work-around for GCC bug |
| 85010 | | - ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270. |
| 85011 | | - ** Bug fixed circa 2020, so this work-around removed in 2026. */ |
| 85029 | + if( p->flags & (MEM_Int|MEM_IntReal) ){ |
| 85030 | +#if GCC_VERSION>=7000000 && GCC_VERSION<15000000 && defined(__i386__) |
| 85031 | + /* Work-around for GCC bug or bugs: |
| 85032 | + ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96270 |
| 85033 | + ** https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114659 |
| 85034 | + ** The problem appears to be fixed in GCC 15 */ |
| 85012 | 85035 | i64 x; |
| 85013 | | - assert( (p->flags&MEM_Int)*2==sizeof(x) ); |
| 85014 | | - memcpy(&x, (char*)&p->u, (p->flags&MEM_Int)*2); |
| 85036 | + assert( (MEM_Str&~p->flags)*4==sizeof(x) ); |
| 85037 | + memcpy(&x, (char*)&p->u, (MEM_Str&~p->flags)*4); |
| 85015 | 85038 | p->n = sqlite3Int64ToText(x, zBuf); |
| 85016 | 85039 | #else |
| 85017 | 85040 | p->n = sqlite3Int64ToText(p->u.i, zBuf); |
| 85018 | 85041 | #endif |
| 85019 | 85042 | if( p->flags & MEM_IntReal ){ |
| | @@ -135184,10 +135207,12 @@ |
| 135184 | 135207 | } |
| 135185 | 135208 | for(nArg=2; nArg<=3; nArg++){ |
| 135186 | 135209 | sqlite3CreateFunc(db, "like", nArg, SQLITE_UTF8, pInfo, likeFunc, |
| 135187 | 135210 | 0, 0, 0, 0, 0); |
| 135188 | 135211 | pDef = sqlite3FindFunction(db, "like", nArg, SQLITE_UTF8, 0); |
| 135212 | + assert( pDef!=0 ); /* The sqlite3CreateFunc() call above cannot fail |
| 135213 | + ** because the "like" SQL-function already exists */ |
| 135189 | 135214 | pDef->funcFlags |= flags; |
| 135190 | 135215 | pDef->funcFlags &= ~SQLITE_FUNC_UNSAFE; |
| 135191 | 135216 | } |
| 135192 | 135217 | } |
| 135193 | 135218 | |
| | @@ -147881,11 +147906,11 @@ |
| 147881 | 147906 | ** how to process the DISTINCT keyword, to simplify passing that information |
| 147882 | 147907 | ** into the selectInnerLoop() routine. |
| 147883 | 147908 | */ |
| 147884 | 147909 | typedef struct DistinctCtx DistinctCtx; |
| 147885 | 147910 | struct DistinctCtx { |
| 147886 | | - u8 isTnct; /* 0: Not distinct. 1: DISTICT 2: DISTINCT and ORDER BY */ |
| 147911 | + u8 isTnct; /* 0: Not distinct. 1: DISTINCT 2: DISTINCT and ORDER BY */ |
| 147887 | 147912 | u8 eTnctType; /* One of the WHERE_DISTINCT_* operators */ |
| 147888 | 147913 | int tabTnct; /* Ephemeral table used for DISTINCT processing */ |
| 147889 | 147914 | int addrTnct; /* Address of OP_OpenEphemeral opcode for tabTnct */ |
| 147890 | 147915 | }; |
| 147891 | 147916 | |
| | @@ -170861,11 +170886,11 @@ |
| 170861 | 170886 | testcase( pLhs->iColumn==XN_ROWID ); |
| 170862 | 170887 | aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs)); |
| 170863 | 170888 | idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn); |
| 170864 | 170889 | if( aff!=idxaff ) break; |
| 170865 | 170890 | |
| 170866 | | - pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); |
| 170891 | + pColl = sqlite3ExprCompareCollSeq(pParse, pTerm->pExpr); |
| 170867 | 170892 | if( pColl==0 ) break; |
| 170868 | 170893 | if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break; |
| 170869 | 170894 | } |
| 170870 | 170895 | return i; |
| 170871 | 170896 | } |
| | @@ -189580,11 +189605,11 @@ |
| 189580 | 189605 | |
| 189581 | 189606 | /* Allocate the sqlite data structure */ |
| 189582 | 189607 | db = sqlite3MallocZero( sizeof(sqlite3) ); |
| 189583 | 189608 | if( db==0 ) goto opendb_out; |
| 189584 | 189609 | if( isThreadsafe |
| 189585 | | -#ifdef SQLITE_ENABLE_MULTITHREADED_CHECKS |
| 189610 | +#if defined(SQLITE_THREAD_MISUSE_WARNINGS) |
| 189586 | 189611 | || sqlite3GlobalConfig.bCoreMutex |
| 189587 | 189612 | #endif |
| 189588 | 189613 | ){ |
| 189589 | 189614 | db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); |
| 189590 | 189615 | if( db->mutex==0 ){ |
| | @@ -261831,11 +261856,11 @@ |
| 261831 | 261856 | int nArg, /* Number of args */ |
| 261832 | 261857 | sqlite3_value **apUnused /* Function arguments */ |
| 261833 | 261858 | ){ |
| 261834 | 261859 | assert( nArg==0 ); |
| 261835 | 261860 | UNUSED_PARAM2(nArg, apUnused); |
| 261836 | | - sqlite3_result_text(pCtx, "fts5: 2026-02-23 13:29:29 5da9bf09cc00faf98cc515fb5a10a0af325b8f7608893808d031dfef62380be2", -1, SQLITE_TRANSIENT); |
| 261861 | + sqlite3_result_text(pCtx, "fts5: 2026-02-27 11:36:43 7c5f4dcd748baa60097bbf68d7aca99cc959bb1f7da92bd9ad86a4425a37d391", -1, SQLITE_TRANSIENT); |
| 261837 | 261862 | } |
| 261838 | 261863 | |
| 261839 | 261864 | /* |
| 261840 | 261865 | ** Implementation of fts5_locale(LOCALE, TEXT) function. |
| 261841 | 261866 | ** |
| 261842 | 261867 | |