Skip to content

Commit ea5e27e

Browse files
authored
Update to sqlcipher 4.9.0 (#9)
1 parent c581471 commit ea5e27e

File tree

4 files changed

+71
-69
lines changed

4 files changed

+71
-69
lines changed

Examples/PackageTraits/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ It contains a test case:
121121

122122
```swift
123123
@Test func testDatabaseIsSQLCipher() async throws {
124-
#expect(databaseVersion() == "SQLCipher 4.8.0 community")
124+
#expect(databaseVersion() == "SQLCipher 4.9.0 community")
125125
}
126126
```
127127

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ library (e.g., Android, Windows).
1414
## Features
1515

1616
- A pure-Swift interface
17-
- Embeds a modern and consistent sqlite ([3.49.1](https://www.sqlite.org/releaselog/3_49_1.html)) and sqlcipher ([4.8.0](https://github.com/sqlcipher/sqlcipher/releases/tag/v4.8.0)) build in the library
17+
- Embeds a modern and consistent sqlite ([3.49.2](https://www.sqlite.org/releaselog/3_49_2.html)) and sqlcipher ([4.9.0](https://github.com/sqlcipher/sqlcipher/releases/tag/v4.9.0)) build in the library
1818
- Works on iOS, macOS, Android, Windows, and Linux
1919
- A type-safe, optional-aware SQL expression builder
2020
- A flexible, chainable, lazy-executing query layer

Sources/SQLCipher/sqlite/sqlite3.c

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/******************************************************************************
22
** This file is an amalgamation of many separate C source files from SQLite
3-
** version 3.49.1. By combining all the individual C code files into this
3+
** version 3.49.2. By combining all the individual C code files into this
44
** single large file, the entire code can be compiled as a single translation
55
** unit. This allows many compilers to do optimizations that would not be
66
** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
1818
** separate file. This file contains only code for the core SQLite library.
1919
**
2020
** The content in this amalgamation comes from Fossil check-in
21-
** 873d4e274b4988d260ba8354a9718324a1c2 with changes in files:
21+
** 17144570b0d96ae63cd6f3edca39e27ebd74 with changes in files:
2222
**
2323
** .fossil-settings/empty-dirs
2424
** .fossil-settings/ignore-glob
@@ -495,9 +495,9 @@ extern "C" {
495495
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
496496
** [sqlite_version()] and [sqlite_source_id()].
497497
*/
498-
#define SQLITE_VERSION "3.49.1"
499-
#define SQLITE_VERSION_NUMBER 3049001
500-
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f1alt1"
498+
#define SQLITE_VERSION "3.49.2"
499+
#define SQLITE_VERSION_NUMBER 3049002
500+
#define SQLITE_SOURCE_ID "2025-05-07 10:39:52 17144570b0d96ae63cd6f3edca39e27ebd74925252bbaf6723bcb2f6b486alt1"
501501

502502
/*
503503
** CAPI3REF: Run-Time Library Version Numbers
@@ -19165,6 +19165,7 @@ struct Index {
1916519165
unsigned bLowQual:1; /* sqlite_stat1 says this is a low-quality index */
1916619166
unsigned bNoQuery:1; /* Do not use this index to optimize queries */
1916719167
unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */
19168+
unsigned bIdxRowid:1; /* One or more of the index keys is the ROWID */
1916819169
unsigned bHasVCol:1; /* Index references one or more VIRTUAL columns */
1916919170
unsigned bHasExpr:1; /* Index contains an expression, either a literal
1917019171
** expression, or a reference to a VIRTUAL column */
@@ -97633,6 +97634,7 @@ case OP_MakeRecord: {
9763397634
zHdr += sqlite3PutVarint(zHdr, serial_type);
9763497635
if( pRec->n ){
9763597636
assert( pRec->z!=0 );
97637+
assert( pRec->z!=(const char*)sqlite3CtypeMap );
9763697638
memcpy(zPayload, pRec->z, pRec->n);
9763797639
zPayload += pRec->n;
9763897640
}
@@ -107603,7 +107605,7 @@ SQLITE_API void sqlite3pager_reset(Pager *pPager);
107603107605
#define CIPHER_STR(s) #s
107604107606

107605107607
#ifndef CIPHER_VERSION_NUMBER
107606-
#define CIPHER_VERSION_NUMBER 4.8.0
107608+
#define CIPHER_VERSION_NUMBER 4.9.0
107607107609
#endif
107608107610

107609107611
#ifndef CIPHER_VERSION_BUILD
@@ -108093,10 +108095,6 @@ int sqlcipher_extra_init(const char* arg) {
108093108095
void sqlcipher_extra_shutdown(void) {
108094108096
int i = 0;
108095108097
sqlcipher_provider *provider = NULL;
108096-
sqlite3_mutex *mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_MASTER);
108097-
if(mutex) {
108098-
sqlite3_mutex_enter(mutex);
108099-
}
108100108098

108101108099
/* if sqlcipher hasn't been initialized or the shutdown already completed exit early */
108102108100
if(!sqlcipher_init || sqlcipher_shutdown) {
@@ -108167,9 +108165,6 @@ void sqlcipher_extra_shutdown(void) {
108167108165
sqlcipher_init = 0;
108168108166
sqlcipher_init_error = SQLITE_ERROR;
108169108167
sqlcipher_shutdown = 1;
108170-
if(mutex) {
108171-
sqlite3_mutex_leave(mutex);
108172-
}
108173108168
}
108174108169

108175108170
static void sqlcipher_shield(unsigned char *in, int sz) {
@@ -121135,11 +121130,11 @@ SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int
121135121130
assert( TK_ISNULL==OP_IsNull ); testcase( op==TK_ISNULL );
121136121131
assert( TK_NOTNULL==OP_NotNull ); testcase( op==TK_NOTNULL );
121137121132
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
121138-
sqlite3VdbeTypeofColumn(v, r1);
121133+
assert( regFree1==0 || regFree1==r1 );
121134+
if( regFree1 ) sqlite3VdbeTypeofColumn(v, r1);
121139121135
sqlite3VdbeAddOp2(v, op, r1, dest);
121140121136
VdbeCoverageIf(v, op==TK_ISNULL);
121141121137
VdbeCoverageIf(v, op==TK_NOTNULL);
121142-
testcase( regFree1==0 );
121143121138
break;
121144121139
}
121145121140
case TK_BETWEEN: {
@@ -121310,11 +121305,11 @@ SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int
121310121305
case TK_ISNULL:
121311121306
case TK_NOTNULL: {
121312121307
r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, &regFree1);
121313-
sqlite3VdbeTypeofColumn(v, r1);
121308+
assert( regFree1==0 || regFree1==r1 );
121309+
if( regFree1 ) sqlite3VdbeTypeofColumn(v, r1);
121314121310
sqlite3VdbeAddOp2(v, op, r1, dest);
121315121311
testcase( op==TK_ISNULL ); VdbeCoverageIf(v, op==TK_ISNULL);
121316121312
testcase( op==TK_NOTNULL ); VdbeCoverageIf(v, op==TK_NOTNULL);
121317-
testcase( regFree1==0 );
121318121313
break;
121319121314
}
121320121315
case TK_BETWEEN: {
@@ -132049,6 +132044,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
132049132044
assert( j<=0x7fff );
132050132045
if( j<0 ){
132051132046
j = pTab->iPKey;
132047+
pIndex->bIdxRowid = 1;
132052132048
}else{
132053132049
if( pTab->aCol[j].notNull==0 ){
132054132050
pIndex->uniqNotNull = 0;
@@ -144846,48 +144842,48 @@ static const char *const pragCName[] = {
144846144842
/* 13 */ "pk",
144847144843
/* 14 */ "hidden",
144848144844
/* table_info reuses 8 */
144849-
/* 15 */ "schema", /* Used by: table_list */
144850-
/* 16 */ "name",
144845+
/* 15 */ "name", /* Used by: function_list */
144846+
/* 16 */ "builtin",
144851144847
/* 17 */ "type",
144852-
/* 18 */ "ncol",
144853-
/* 19 */ "wr",
144854-
/* 20 */ "strict",
144855-
/* 21 */ "seqno", /* Used by: index_xinfo */
144856-
/* 22 */ "cid",
144857-
/* 23 */ "name",
144858-
/* 24 */ "desc",
144859-
/* 25 */ "coll",
144860-
/* 26 */ "key",
144861-
/* 27 */ "name", /* Used by: function_list */
144862-
/* 28 */ "builtin",
144863-
/* 29 */ "type",
144864-
/* 30 */ "enc",
144865-
/* 31 */ "narg",
144866-
/* 32 */ "flags",
144867-
/* 33 */ "tbl", /* Used by: stats */
144868-
/* 34 */ "idx",
144869-
/* 35 */ "wdth",
144870-
/* 36 */ "hght",
144871-
/* 37 */ "flgs",
144872-
/* 38 */ "seq", /* Used by: index_list */
144873-
/* 39 */ "name",
144874-
/* 40 */ "unique",
144875-
/* 41 */ "origin",
144876-
/* 42 */ "partial",
144848+
/* 18 */ "enc",
144849+
/* 19 */ "narg",
144850+
/* 20 */ "flags",
144851+
/* 21 */ "schema", /* Used by: table_list */
144852+
/* 22 */ "name",
144853+
/* 23 */ "type",
144854+
/* 24 */ "ncol",
144855+
/* 25 */ "wr",
144856+
/* 26 */ "strict",
144857+
/* 27 */ "seqno", /* Used by: index_xinfo */
144858+
/* 28 */ "cid",
144859+
/* 29 */ "name",
144860+
/* 30 */ "desc",
144861+
/* 31 */ "coll",
144862+
/* 32 */ "key",
144863+
/* 33 */ "seq", /* Used by: index_list */
144864+
/* 34 */ "name",
144865+
/* 35 */ "unique",
144866+
/* 36 */ "origin",
144867+
/* 37 */ "partial",
144868+
/* 38 */ "tbl", /* Used by: stats */
144869+
/* 39 */ "idx",
144870+
/* 40 */ "wdth",
144871+
/* 41 */ "hght",
144872+
/* 42 */ "flgs",
144877144873
/* 43 */ "table", /* Used by: foreign_key_check */
144878144874
/* 44 */ "rowid",
144879144875
/* 45 */ "parent",
144880144876
/* 46 */ "fkid",
144881-
/* index_info reuses 21 */
144882-
/* 47 */ "seq", /* Used by: database_list */
144883-
/* 48 */ "name",
144884-
/* 49 */ "file",
144885-
/* 50 */ "busy", /* Used by: wal_checkpoint */
144886-
/* 51 */ "log",
144887-
/* 52 */ "checkpointed",
144888-
/* collation_list reuses 38 */
144877+
/* 47 */ "busy", /* Used by: wal_checkpoint */
144878+
/* 48 */ "log",
144879+
/* 49 */ "checkpointed",
144880+
/* 50 */ "seq", /* Used by: database_list */
144881+
/* 51 */ "name",
144882+
/* 52 */ "file",
144883+
/* index_info reuses 27 */
144889144884
/* 53 */ "database", /* Used by: lock_status */
144890144885
/* 54 */ "status",
144886+
/* collation_list reuses 33 */
144891144887
/* 55 */ "cache_size", /* Used by: default_cache_size */
144892144888
/* module_list pragma_list reuses 9 */
144893144889
/* 56 */ "timeout", /* Used by: busy_timeout */
@@ -144980,7 +144976,7 @@ static const PragmaName aPragmaName[] = {
144980144976
{/* zName: */ "collation_list",
144981144977
/* ePragTyp: */ PragTyp_COLLATION_LIST,
144982144978
/* ePragFlg: */ PragFlg_Result0,
144983-
/* ColNames: */ 38, 2,
144979+
/* ColNames: */ 33, 2,
144984144980
/* iArg: */ 0 },
144985144981
#endif
144986144982
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
@@ -145015,7 +145011,7 @@ static const PragmaName aPragmaName[] = {
145015145011
{/* zName: */ "database_list",
145016145012
/* ePragTyp: */ PragTyp_DATABASE_LIST,
145017145013
/* ePragFlg: */ PragFlg_Result0,
145018-
/* ColNames: */ 47, 3,
145014+
/* ColNames: */ 50, 3,
145019145015
/* iArg: */ 0 },
145020145016
#endif
145021145017
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED)
@@ -145095,7 +145091,7 @@ static const PragmaName aPragmaName[] = {
145095145091
{/* zName: */ "function_list",
145096145092
/* ePragTyp: */ PragTyp_FUNCTION_LIST,
145097145093
/* ePragFlg: */ PragFlg_Result0,
145098-
/* ColNames: */ 27, 6,
145094+
/* ColNames: */ 15, 6,
145099145095
/* iArg: */ 0 },
145100145096
#endif
145101145097
#endif
@@ -145138,17 +145134,17 @@ static const PragmaName aPragmaName[] = {
145138145134
{/* zName: */ "index_info",
145139145135
/* ePragTyp: */ PragTyp_INDEX_INFO,
145140145136
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
145141-
/* ColNames: */ 21, 3,
145137+
/* ColNames: */ 27, 3,
145142145138
/* iArg: */ 0 },
145143145139
{/* zName: */ "index_list",
145144145140
/* ePragTyp: */ PragTyp_INDEX_LIST,
145145145141
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
145146-
/* ColNames: */ 38, 5,
145142+
/* ColNames: */ 33, 5,
145147145143
/* iArg: */ 0 },
145148145144
{/* zName: */ "index_xinfo",
145149145145
/* ePragTyp: */ PragTyp_INDEX_INFO,
145150145146
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
145151-
/* ColNames: */ 21, 6,
145147+
/* ColNames: */ 27, 6,
145152145148
/* iArg: */ 1 },
145153145149
#endif
145154145150
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
@@ -145347,7 +145343,7 @@ static const PragmaName aPragmaName[] = {
145347145343
{/* zName: */ "stats",
145348145344
/* ePragTyp: */ PragTyp_STATS,
145349145345
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq,
145350-
/* ColNames: */ 33, 5,
145346+
/* ColNames: */ 38, 5,
145351145347
/* iArg: */ 0 },
145352145348
#endif
145353145349
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -145366,7 +145362,7 @@ static const PragmaName aPragmaName[] = {
145366145362
{/* zName: */ "table_list",
145367145363
/* ePragTyp: */ PragTyp_TABLE_LIST,
145368145364
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1,
145369-
/* ColNames: */ 15, 6,
145365+
/* ColNames: */ 21, 6,
145370145366
/* iArg: */ 0 },
145371145367
{/* zName: */ "table_xinfo",
145372145368
/* ePragTyp: */ PragTyp_TABLE_INFO,
@@ -145457,7 +145453,7 @@ static const PragmaName aPragmaName[] = {
145457145453
{/* zName: */ "wal_checkpoint",
145458145454
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
145459145455
/* ePragFlg: */ PragFlg_NeedSchema,
145460-
/* ColNames: */ 50, 3,
145456+
/* ColNames: */ 47, 3,
145461145457
/* iArg: */ 0 },
145462145458
#endif
145463145459
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -152899,6 +152895,7 @@ static int multiSelect(
152899152895
multi_select_end:
152900152896
pDest->iSdst = dest.iSdst;
152901152897
pDest->nSdst = dest.nSdst;
152898+
pDest->iSDParm2 = dest.iSDParm2;
152902152899
if( pDelete ){
152903152900
sqlite3ParserAddCleanup(pParse, sqlite3SelectDeleteGeneric, pDelete);
152904152901
}
@@ -156853,6 +156850,7 @@ static void agginfoFree(sqlite3 *db, void *pArg){
156853156850
** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
156854156851
** * The outer query is a simple count(*) with no WHERE clause or other
156855156852
** extraneous syntax.
156853+
** * None of the subqueries are DISTINCT (forumpost/a860f5fb2e 2025-03-10)
156856156854
**
156857156855
** Return TRUE if the optimization is undertaken.
156858156856
*/
@@ -156885,7 +156883,11 @@ static int countOfViewOptimization(Parse *pParse, Select *p){
156885156883
if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
156886156884
if( pSub->pWhere ) return 0; /* No WHERE clause */
156887156885
if( pSub->pLimit ) return 0; /* No LIMIT clause */
156888-
if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
156886+
if( pSub->selFlags & (SF_Aggregate|SF_Distinct) ){
156887+
testcase( pSub->selFlags & SF_Aggregate );
156888+
testcase( pSub->selFlags & SF_Distinct );
156889+
return 0; /* Not an aggregate nor DISTINCT */
156890+
}
156889156891
assert( pSub->pHaving==0 ); /* Due to the previous */
156890156892
pSub = pSub->pPrior; /* Repeat over compound */
156891156893
}while( pSub );
@@ -172722,7 +172724,7 @@ static int whereLoopAddBtreeIndex(
172722172724
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
172723172725
&& pNew->u.btree.nEq<pProbe->nColumn
172724172726
&& (pNew->u.btree.nEq<pProbe->nKeyCol ||
172725-
pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY)
172727+
(pProbe->idxType!=SQLITE_IDXTYPE_PRIMARYKEY && !pProbe->bIdxRowid))
172726172728
){
172727172729
if( pNew->u.btree.nEq>3 ){
172728172730
sqlite3ProgressCheck(pParse);
@@ -261757,7 +261759,7 @@ static void fts5SourceIdFunc(
261757261759
){
261758261760
assert( nArg==0 );
261759261761
UNUSED_PARAM2(nArg, apUnused);
261760-
sqlite3_result_text(pCtx, "fts5: 2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f10e70", -1, SQLITE_TRANSIENT);
261762+
sqlite3_result_text(pCtx, "fts5: 2025-05-07 10:39:52 17144570b0d96ae63cd6f3edca39e27ebd74925252bbaf6723bcb2f6b4861fb1", -1, SQLITE_TRANSIENT);
261761261763
}
261762261764

261763261765
/*

Sources/SQLCipher/sqlite/sqlite3.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ extern "C" {
146146
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147147
** [sqlite_version()] and [sqlite_source_id()].
148148
*/
149-
#define SQLITE_VERSION "3.49.1"
150-
#define SQLITE_VERSION_NUMBER 3049001
151-
#define SQLITE_SOURCE_ID "2025-02-18 13:38:58 873d4e274b4988d260ba8354a9718324a1c26187a4ab4c1cc0227c03d0f1alt1"
149+
#define SQLITE_VERSION "3.49.2"
150+
#define SQLITE_VERSION_NUMBER 3049002
151+
#define SQLITE_SOURCE_ID "2025-05-07 10:39:52 17144570b0d96ae63cd6f3edca39e27ebd74925252bbaf6723bcb2f6b486alt1"
152152

153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers

0 commit comments

Comments
 (0)