diff --git a/Plugins/DbSqliteWx/update_sqlite_version.tcl b/Plugins/DbSqliteWx/update_sqlite_version.tcl index 5677ba3e2e..c09e863967 100644 --- a/Plugins/DbSqliteWx/update_sqlite_version.tcl +++ b/Plugins/DbSqliteWx/update_sqlite_version.tcl @@ -4,7 +4,7 @@ # https://github.com/utelle/wxsqlite3/releases # Link from download page will redicrect to the codeload..... -set THE_URL "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v1.9.1/sqlite3mc-1.9.1-sqlite-3.47.1-amalgamation.zip" +set THE_URL "https://github.com/utelle/SQLite3MultipleCiphers/releases/download/v1.9.2/sqlite3mc-1.9.2-sqlite-3.47.2-amalgamation.zip" set SRC_DIR "src" set FILES [list \ diff --git a/Plugins/DbSqliteWx/wxsqlite3.c b/Plugins/DbSqliteWx/wxsqlite3.c index af6e4dd5d0..e13cc9906e 100644 --- a/Plugins/DbSqliteWx/wxsqlite3.c +++ b/Plugins/DbSqliteWx/wxsqlite3.c @@ -136,7 +136,7 @@ SQLITE_API LPWSTR wx_sqlite3_win32_utf8_to_unicode(const char*); /*** Begin of #include "wx_sqlite3patched.c" ***/ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.47.1. By combining all the individual C code files into this +** version 3.47.2. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -154,7 +154,7 @@ SQLITE_API LPWSTR wx_sqlite3_win32_utf8_to_unicode(const char*); ** separate file. This file contains only code for the core SQLite library. ** ** The content in this amalgamation comes from Fossil check-in -** b95d11e958643b969c47a8e5857f3793b9e6. +** 2aabe05e2e8cae4847a802ee2daddc1d7413. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 @@ -598,9 +598,9 @@ extern "C" { ** [wx_sqlite3_libversion_number()], [wx_sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.47.1" -#define SQLITE_VERSION_NUMBER 3047001 -#define SQLITE_SOURCE_ID "2024-11-25 12:07:48 b95d11e958643b969c47a8e5857f3793b9e69700b8f1469371386369a26e577e" +#define SQLITE_VERSION "3.47.2" +#define SQLITE_VERSION_NUMBER 3047002 +#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -11354,6 +11354,7 @@ typedef struct Pager PagerMC; SQLITE_PRIVATE int wx_sqlite3mcPagerHasCodec(PagerMC* pPager); SQLITE_PRIVATE void wx_sqlite3mcInitMemoryMethods(); SQLITE_PRIVATE int wx_sqlite3mcIsBackupSupported(wx_sqlite3*, const char*, wx_sqlite3*, const char*); +SQLITE_PRIVATE void wx_sqlite3mcCodecGetKey(wx_sqlite3* db, int nDb, void** zKey, int* nKey); /******** Begin file wx_sqlite3rtree.h *********/ /* @@ -35851,8 +35852,8 @@ SQLITE_PRIVATE int wx_sqlite3AtoF(const char *z, double *pResult, int length, u8 int eValid = 1; /* True exponent is either not used or is well-formed */ int nDigit = 0; /* Number of digits processed */ int eType = 1; /* 1: pure integer, 2+: fractional -1 or less: bad UTF16 */ + u64 s2; /* round-tripped significand */ double rr[2]; - u64 s2; assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); *pResult = 0.0; /* Default return value, in case of an error */ @@ -35955,7 +35956,7 @@ SQLITE_PRIVATE int wx_sqlite3AtoF(const char *z, double *pResult, int length, u8 e = (e*esign) + d; /* Try to adjust the exponent to make it smaller */ - while( e>0 && s<(LARGEST_UINT64/10) ){ + while( e>0 && s<((LARGEST_UINT64-0x7ff)/10) ){ s *= 10; e--; } @@ -35965,11 +35966,16 @@ SQLITE_PRIVATE int wx_sqlite3AtoF(const char *z, double *pResult, int length, u8 } rr[0] = (double)s; - s2 = (u64)rr[0]; -#if defined(_MSC_VER) && _MSC_VER<1700 - if( s2==0x8000000000000000LL ){ s2 = 2*(u64)(0.5*rr[0]); } -#endif - rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s); + assert( sizeof(s2)==sizeof(rr[0]) ); + memcpy(&s2, &rr[0], sizeof(s2)); + if( s2<=0x43efffffffffffffLL ){ + s2 = (u64)rr[0]; + rr[1] = s>=s2 ? (double)(s - s2) : -(double)(s2 - s); + }else{ + rr[1] = 0.0; + } + assert( rr[1]<=1.0e-10*rr[0] ); /* Equal only when rr[0]==0.0 */ + if( e>0 ){ while( e>=100 ){ e -= 100; @@ -147775,32 +147781,32 @@ static Expr *substExpr( if( pSubst->isOuterJoin ){ ExprSetProperty(pNew, EP_CanBeNull); } - if( ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) ){ - wx_sqlite3SetJoinExpr(pNew, pExpr->w.iJoin, - pExpr->flags & (EP_OuterON|EP_InnerON)); - } - wx_sqlite3ExprDelete(db, pExpr); - pExpr = pNew; - if( pExpr->op==TK_TRUEFALSE ){ - pExpr->u.iValue = wx_sqlite3ExprTruthValue(pExpr); - pExpr->op = TK_INTEGER; - ExprSetProperty(pExpr, EP_IntValue); + if( pNew->op==TK_TRUEFALSE ){ + pNew->u.iValue = wx_sqlite3ExprTruthValue(pNew); + pNew->op = TK_INTEGER; + ExprSetProperty(pNew, EP_IntValue); } /* Ensure that the expression now has an implicit collation sequence, ** just as it did when it was a column of a view or sub-query. */ { - CollSeq *pNat = wx_sqlite3ExprCollSeq(pSubst->pParse, pExpr); + CollSeq *pNat = wx_sqlite3ExprCollSeq(pSubst->pParse, pNew); CollSeq *pColl = wx_sqlite3ExprCollSeq(pSubst->pParse, pSubst->pCList->a[iColumn].pExpr ); - if( pNat!=pColl || (pExpr->op!=TK_COLUMN && pExpr->op!=TK_COLLATE) ){ - pExpr = wx_sqlite3ExprAddCollateString(pSubst->pParse, pExpr, + if( pNat!=pColl || (pNew->op!=TK_COLUMN && pNew->op!=TK_COLLATE) ){ + pNew = wx_sqlite3ExprAddCollateString(pSubst->pParse, pNew, (pColl ? pColl->zName : "BINARY") ); } } - ExprClearProperty(pExpr, EP_Collate); + ExprClearProperty(pNew, EP_Collate); + if( ExprHasProperty(pExpr,EP_OuterON|EP_InnerON) ){ + wx_sqlite3SetJoinExpr(pNew, pExpr->w.iJoin, + pExpr->flags & (EP_OuterON|EP_InnerON)); + } + wx_sqlite3ExprDelete(db, pExpr); + pExpr = pNew; } } }else{ @@ -156352,6 +156358,15 @@ SQLITE_PRIVATE SQLITE_NOINLINE int wx_sqlite3RunVacuum( } nRes = wx_sqlite3BtreeGetRequestedReserve(pMain); + /* A VACUUM cannot change the pagesize of an encrypted database. */ + if( db->nextPagesize ){ + extern void wx_sqlite3mcCodecGetKey(wx_sqlite3*, int, void**, int*); + int nKey; + char *zKey; + wx_sqlite3mcCodecGetKey(db, iDb, (void**)&zKey, &nKey); + if( nKey ) db->nextPagesize = 0; + } + wx_sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); wx_sqlite3BtreeSetSpillSize(pTemp, wx_sqlite3BtreeSetSpillSize(pMain,0)); wx_sqlite3BtreeSetPagerFlags(pTemp, pgflags|PAGER_CACHESPILL); @@ -255116,7 +255131,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - wx_sqlite3_result_text(pCtx, "fts5: 2024-11-25 12:07:48 b95d11e958643b969c47a8e5857f3793b9e69700b8f1469371386369a26e577e", -1, SQLITE_TRANSIENT); + wx_sqlite3_result_text(pCtx, "fts5: 2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c", -1, SQLITE_TRANSIENT); } /* @@ -260890,9 +260905,9 @@ SQLITE_API const char *wx_sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } #define SQLITE3MC_VERSION_MAJOR 1 #define SQLITE3MC_VERSION_MINOR 9 -#define SQLITE3MC_VERSION_RELEASE 1 +#define SQLITE3MC_VERSION_RELEASE 2 #define SQLITE3MC_VERSION_SUBRELEASE 0 -#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.1" +#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.2" #endif /* SQLITE3MC_VERSION_H_ */ /*** End of #include "wx_sqlite3mc_version.h" ***/ @@ -261051,9 +261066,9 @@ extern "C" { ** [wx_sqlite3_libversion_number()], [wx_sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.47.1" -#define SQLITE_VERSION_NUMBER 3047001 -#define SQLITE_SOURCE_ID "2024-11-25 12:07:48 b95d11e958643b969c47a8e5857f3793b9e69700b8f1469371386369a26e577e" +#define SQLITE_VERSION "3.47.2" +#define SQLITE_VERSION_NUMBER 3047002 +#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -286632,7 +286647,7 @@ wx_sqlite3mcBtreeSetPageSize(Btree* p, int pageSize, int nReserve, int iFix) ** Change 4: Call wx_sqlite3mcBtreeSetPageSize instead of wx_sqlite3BtreeSetPageSize for main database ** (wx_sqlite3mcBtreeSetPageSize allows to reduce the number of reserved bytes) ** -** This code is generated by the script rekeyvacuum.sh from SQLite version 3.47.1 amalgamation. +** This code is generated by the script rekeyvacuum.sh from SQLite version 3.47.2 amalgamation. */ SQLITE_PRIVATE SQLITE_NOINLINE int wx_sqlite3mcRunVacuumForRekey( char **pzErrMsg, /* Write error message here */ diff --git a/Plugins/DbSqliteWx/wxsqlite3.h b/Plugins/DbSqliteWx/wxsqlite3.h index 7c0620fd36..6520c73293 100644 --- a/Plugins/DbSqliteWx/wxsqlite3.h +++ b/Plugins/DbSqliteWx/wxsqlite3.h @@ -31,9 +31,9 @@ #define SQLITE3MC_VERSION_MAJOR 1 #define SQLITE3MC_VERSION_MINOR 9 -#define SQLITE3MC_VERSION_RELEASE 1 +#define SQLITE3MC_VERSION_RELEASE 2 #define SQLITE3MC_VERSION_SUBRELEASE 0 -#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.1" +#define SQLITE3MC_VERSION_STRING "SQLite3 Multiple Ciphers 1.9.2" #endif /* SQLITE3MC_VERSION_H_ */ /*** End of #include "wx_sqlite3mc_version.h" ***/ @@ -192,9 +192,9 @@ extern "C" { ** [wx_sqlite3_libversion_number()], [wx_sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.47.1" -#define SQLITE_VERSION_NUMBER 3047001 -#define SQLITE_SOURCE_ID "2024-11-25 12:07:48 b95d11e958643b969c47a8e5857f3793b9e69700b8f1469371386369a26e577e" +#define SQLITE_VERSION "3.47.2" +#define SQLITE_VERSION_NUMBER 3047002 +#define SQLITE_SOURCE_ID "2024-12-07 20:39:59 2aabe05e2e8cae4847a802ee2daddc1d7413d8fc560254d93ee3e72c14685b6c" /* ** CAPI3REF: Run-Time Library Version Numbers