Skip to content

Commit 761d3bf

Browse files
authored
Merge pull request #3711 from wmathurin/dev
Move to sqlcipher 4.5.7
2 parents f3fcf1e + b19ca86 commit 761d3bf

File tree

9 files changed

+168
-31
lines changed

9 files changed

+168
-31
lines changed

.circleci/fastlane/Fastfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ lane :PR do |options|
3232
pr_files = JSON.parse(pull_files)
3333
for pr_file in pr_files
3434
path = pr_file['filename']
35-
for scheme in $schemes
35+
$schemes.each do |scheme|
3636
if path.include? scheme
37-
schemes.add(scheme)
37+
schemes.merge($schemes[$schemes.index(scheme)..])
38+
break
3839
end
3940
end
4041
end

SmartStore.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
2121

2222
smartstore.dependency 'SalesforceSDKCore', "~>#{s.version}"
2323
smartstore.dependency 'FMDB/SQLCipher', '~> 2.7.10'
24-
smartstore.dependency 'SQLCipher', '~> 4.5.6'
24+
smartstore.dependency 'SQLCipher', '~> 4.5.7'
2525
smartstore.source_files = 'libs/SmartStore/SmartStore/Classes/**/*.{h,m,swift}', 'libs/SmartStore/SmartStore/SmartStore.h'
2626
smartstore.public_header_files = 'libs/SmartStore/SmartStore/Classes/SFAlterSoupLongOperation.h', 'libs/SmartStore/SmartStore/Classes/SFQuerySpec.h', 'libs/SmartStore/SmartStore/Classes/SFSDKSmartStoreLogger.h', 'libs/SmartStore/SmartStore/Classes/SFSDKStoreConfig.h', 'libs/SmartStore/SmartStore/Classes/SFSmartSqlHelper.h', 'libs/SmartStore/SmartStore/Classes/SFSmartStore.h', 'libs/SmartStore/SmartStore/Classes/SFSmartStoreDatabaseManager.h', 'libs/SmartStore/SmartStore/Classes/SFSmartStoreInspectorViewController.h', 'libs/SmartStore/SmartStore/Classes/SFSmartStoreUtils.h', 'libs/SmartStore/SmartStore/Classes/SFSoupIndex.h', 'libs/SmartStore/SmartStore/Classes/SFStoreCursor.h', 'libs/SmartStore/SmartStore/SmartStore.h', 'libs/SmartStore/SmartStore/Classes/SmartStoreSDKManager.h'
2727
smartstore.prefix_header_contents = '#import "SFSDKSmartStoreLogger.h"', '#import <SalesforceSDKCore/SalesforceSDKConstants.h>'
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>AvailableLibraries</key>
6+
<array>
7+
<dict>
8+
<key>BinaryPath</key>
9+
<string>libsqlcipher-catalyst.a</string>
10+
<key>LibraryIdentifier</key>
11+
<string>ios-arm64_x86_64-maccatalyst</string>
12+
<key>LibraryPath</key>
13+
<string>libsqlcipher-catalyst.a</string>
14+
<key>SupportedArchitectures</key>
15+
<array>
16+
<string>arm64</string>
17+
<string>x86_64</string>
18+
</array>
19+
<key>SupportedPlatform</key>
20+
<string>ios</string>
21+
<key>SupportedPlatformVariant</key>
22+
<string>maccatalyst</string>
23+
</dict>
24+
<dict>
25+
<key>BinaryPath</key>
26+
<string>libsqlcipher-iphonesimulator.a</string>
27+
<key>LibraryIdentifier</key>
28+
<string>ios-arm64_x86_64-simulator</string>
29+
<key>LibraryPath</key>
30+
<string>libsqlcipher-iphonesimulator.a</string>
31+
<key>SupportedArchitectures</key>
32+
<array>
33+
<string>arm64</string>
34+
<string>x86_64</string>
35+
</array>
36+
<key>SupportedPlatform</key>
37+
<string>ios</string>
38+
<key>SupportedPlatformVariant</key>
39+
<string>simulator</string>
40+
</dict>
41+
<dict>
42+
<key>BinaryPath</key>
43+
<string>libsqlcipher-iphoneos.a</string>
44+
<key>LibraryIdentifier</key>
45+
<string>ios-arm64_arm64e</string>
46+
<key>LibraryPath</key>
47+
<string>libsqlcipher-iphoneos.a</string>
48+
<key>SupportedArchitectures</key>
49+
<array>
50+
<string>arm64</string>
51+
<string>arm64e</string>
52+
</array>
53+
<key>SupportedPlatform</key>
54+
<string>ios</string>
55+
</dict>
56+
</array>
57+
<key>CFBundlePackageType</key>
58+
<string>XFWK</string>
59+
<key>XCFrameworkFormatVersion</key>
60+
<string>1.0</string>
61+
</dict>
62+
</plist>

external/ThirdPartyDependencies/sqlcipher/SQLCipher.xcframework/Info.plist

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
<array>
77
<dict>
88
<key>BinaryPath</key>
9-
<string>libsqlcipher-iphonesimulator.a</string>
9+
<string>libsqlcipher-catalyst.a</string>
1010
<key>LibraryIdentifier</key>
11-
<string>ios-arm64_x86_64-simulator</string>
11+
<string>ios-arm64_x86_64-maccatalyst</string>
1212
<key>LibraryPath</key>
13-
<string>libsqlcipher-iphonesimulator.a</string>
13+
<string>libsqlcipher-catalyst.a</string>
1414
<key>SupportedArchitectures</key>
1515
<array>
1616
<string>arm64</string>
@@ -19,15 +19,15 @@
1919
<key>SupportedPlatform</key>
2020
<string>ios</string>
2121
<key>SupportedPlatformVariant</key>
22-
<string>simulator</string>
22+
<string>maccatalyst</string>
2323
</dict>
2424
<dict>
2525
<key>BinaryPath</key>
26-
<string>libsqlcipher-catalyst.a</string>
26+
<string>libsqlcipher-iphonesimulator.a</string>
2727
<key>LibraryIdentifier</key>
28-
<string>ios-arm64_x86_64-maccatalyst</string>
28+
<string>ios-arm64_x86_64-simulator</string>
2929
<key>LibraryPath</key>
30-
<string>libsqlcipher-catalyst.a</string>
30+
<string>libsqlcipher-iphonesimulator.a</string>
3131
<key>SupportedArchitectures</key>
3232
<array>
3333
<string>arm64</string>
@@ -36,7 +36,7 @@
3636
<key>SupportedPlatform</key>
3737
<string>ios</string>
3838
<key>SupportedPlatformVariant</key>
39-
<string>maccatalyst</string>
39+
<string>simulator</string>
4040
</dict>
4141
<dict>
4242
<key>BinaryPath</key>

external/ThirdPartyDependencies/sqlcipher/sqlite3.h

Lines changed: 92 additions & 18 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.44.2"
150-
#define SQLITE_VERSION_NUMBER 3044002
151-
#define SQLITE_SOURCE_ID "2023-11-24 11:41:44 ebead0e7230cd33bcec9f95d2183069565b9e709bf745c9b5db65cc0cbf9alt1"
149+
#define SQLITE_VERSION "3.45.3"
150+
#define SQLITE_VERSION_NUMBER 3045003
151+
#define SQLITE_SOURCE_ID "2024-04-15 13:34:05 8653b758870e6ef0c98d46b3ace27849054af85da891eb121e9aaa537f1ealt1"
152152

153153
/*
154154
** CAPI3REF: Run-Time Library Version Numbers
@@ -420,6 +420,8 @@ typedef int (*sqlite3_callback)(void*,int,char**, char**);
420420
** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running.
421421
** <li> The application must not modify the SQL statement text passed into
422422
** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running.
423+
** <li> The application must not dereference the arrays or string pointers
424+
** passed as the 3rd and 4th callback parameters after it returns.
423425
** </ul>
424426
*/
425427
SQLITE_API int sqlite3_exec(
@@ -2141,6 +2143,22 @@ struct sqlite3_mem_methods {
21412143
** configuration setting is never used, then the default maximum is determined
21422144
** by the [SQLITE_MEMDB_DEFAULT_MAXSIZE] compile-time option. If that
21432145
** compile-time option is not set, then the default maximum is 1073741824.
2146+
**
2147+
** [[SQLITE_CONFIG_ROWID_IN_VIEW]]
2148+
** <dt>SQLITE_CONFIG_ROWID_IN_VIEW
2149+
** <dd>The SQLITE_CONFIG_ROWID_IN_VIEW option enables or disables the ability
2150+
** for VIEWs to have a ROWID. The capability can only be enabled if SQLite is
2151+
** compiled with -DSQLITE_ALLOW_ROWID_IN_VIEW, in which case the capability
2152+
** defaults to on. This configuration option queries the current setting or
2153+
** changes the setting to off or on. The argument is a pointer to an integer.
2154+
** If that integer initially holds a value of 1, then the ability for VIEWs to
2155+
** have ROWIDs is activated. If the integer initially holds zero, then the
2156+
** ability is deactivated. Any other initial value for the integer leaves the
2157+
** setting unchanged. After changes, if any, the integer is written with
2158+
** a 1 or 0, if the ability for VIEWs to have ROWIDs is on or off. If SQLite
2159+
** is compiled without -DSQLITE_ALLOW_ROWID_IN_VIEW (which is the usual and
2160+
** recommended case) then the integer is always filled with zero, regardless
2161+
** if its initial value.
21442162
** </dl>
21452163
*/
21462164
#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */
@@ -2172,6 +2190,7 @@ struct sqlite3_mem_methods {
21722190
#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
21732191
#define SQLITE_CONFIG_SORTERREF_SIZE 28 /* int nByte */
21742192
#define SQLITE_CONFIG_MEMDB_MAXSIZE 29 /* sqlite3_int64 */
2193+
#define SQLITE_CONFIG_ROWID_IN_VIEW 30 /* int* */
21752194

21762195
/*
21772196
** CAPI3REF: Database Connection Configuration Options
@@ -3954,15 +3973,17 @@ SQLITE_API void sqlite3_free_filename(sqlite3_filename);
39543973
** </ul>
39553974
**
39563975
** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language
3957-
** text that describes the error, as either UTF-8 or UTF-16 respectively.
3976+
** text that describes the error, as either UTF-8 or UTF-16 respectively,
3977+
** or NULL if no error message is available.
39583978
** (See how SQLite handles [invalid UTF] for exceptions to this rule.)
39593979
** ^(Memory to hold the error message string is managed internally.
39603980
** The application does not need to worry about freeing the result.
39613981
** However, the error string might be overwritten or deallocated by
39623982
** subsequent calls to other SQLite interface functions.)^
39633983
**
3964-
** ^The sqlite3_errstr() interface returns the English-language text
3965-
** that describes the [result code], as UTF-8.
3984+
** ^The sqlite3_errstr(E) interface returns the English-language text
3985+
** that describes the [result code] E, as UTF-8, or NULL if E is not an
3986+
** result code for which a text error message is available.
39663987
** ^(Memory to hold the error message string is managed internally
39673988
** and must not be freed by the application)^.
39683989
**
@@ -8097,9 +8118,11 @@ SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*);
80978118
**
80988119
** ^(Some systems (for example, Windows 95) do not support the operation
80998120
** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try()
8100-
** will always return SQLITE_BUSY. The SQLite core only ever uses
8101-
** sqlite3_mutex_try() as an optimization so this is acceptable
8102-
** behavior.)^
8121+
** will always return SQLITE_BUSY. In most cases the SQLite core only uses
8122+
** sqlite3_mutex_try() as an optimization, so this is acceptable
8123+
** behavior. The exceptions are unix builds that set the
8124+
** SQLITE_ENABLE_SETLK_TIMEOUT build option. In that case a working
8125+
** sqlite3_mutex_try() is required.)^
81038126
**
81048127
** ^The sqlite3_mutex_leave() routine exits a mutex that was
81058128
** previously entered by the same thread. The behavior
@@ -8358,6 +8381,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
83588381
#define SQLITE_TESTCTRL_ASSERT 12
83598382
#define SQLITE_TESTCTRL_ALWAYS 13
83608383
#define SQLITE_TESTCTRL_RESERVE 14 /* NOT USED */
8384+
#define SQLITE_TESTCTRL_JSON_SELFCHECK 14
83618385
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
83628386
#define SQLITE_TESTCTRL_ISKEYWORD 16 /* NOT USED */
83638387
#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
@@ -12871,8 +12895,11 @@ struct Fts5PhraseIter {
1287112895
** created with the "columnsize=0" option.
1287212896
**
1287312897
** xColumnText:
12874-
** This function attempts to retrieve the text of column iCol of the
12875-
** current document. If successful, (*pz) is set to point to a buffer
12898+
** If parameter iCol is less than zero, or greater than or equal to the
12899+
** number of columns in the table, SQLITE_RANGE is returned.
12900+
**
12901+
** Otherwise, this function attempts to retrieve the text of column iCol of
12902+
** the current document. If successful, (*pz) is set to point to a buffer
1287612903
** containing the text in utf-8 encoding, (*pn) is set to the size in bytes
1287712904
** (not characters) of the buffer and SQLITE_OK is returned. Otherwise,
1287812905
** if an error occurs, an SQLite error code is returned and the final values
@@ -12882,8 +12909,10 @@ struct Fts5PhraseIter {
1288212909
** Returns the number of phrases in the current query expression.
1288312910
**
1288412911
** xPhraseSize:
12885-
** Returns the number of tokens in phrase iPhrase of the query. Phrases
12886-
** are numbered starting from zero.
12912+
** If parameter iCol is less than zero, or greater than or equal to the
12913+
** number of phrases in the current query, as returned by xPhraseCount,
12914+
** 0 is returned. Otherwise, this function returns the number of tokens in
12915+
** phrase iPhrase of the query. Phrases are numbered starting from zero.
1288712916
**
1288812917
** xInstCount:
1288912918
** Set *pnInst to the total number of occurrences of all phrases within
@@ -12899,12 +12928,13 @@ struct Fts5PhraseIter {
1289912928
** Query for the details of phrase match iIdx within the current row.
1290012929
** Phrase matches are numbered starting from zero, so the iIdx argument
1290112930
** should be greater than or equal to zero and smaller than the value
12902-
** output by xInstCount().
12931+
** output by xInstCount(). If iIdx is less than zero or greater than
12932+
** or equal to the value returned by xInstCount(), SQLITE_RANGE is returned.
1290312933
**
12904-
** Usually, output parameter *piPhrase is set to the phrase number, *piCol
12934+
** Otherwise, output parameter *piPhrase is set to the phrase number, *piCol
1290512935
** to the column in which it occurs and *piOff the token offset of the
12906-
** first token of the phrase. Returns SQLITE_OK if successful, or an error
12907-
** code (i.e. SQLITE_NOMEM) if an error occurs.
12936+
** first token of the phrase. SQLITE_OK is returned if successful, or an
12937+
** error code (i.e. SQLITE_NOMEM) if an error occurs.
1290812938
**
1290912939
** This API can be quite slow if used with an FTS5 table created with the
1291012940
** "detail=none" or "detail=column" option.
@@ -12930,6 +12960,10 @@ struct Fts5PhraseIter {
1293012960
** Invoking Api.xUserData() returns a copy of the pointer passed as
1293112961
** the third argument to pUserData.
1293212962
**
12963+
** If parameter iPhrase is less than zero, or greater than or equal to
12964+
** the number of phrases in the query, as returned by xPhraseCount(),
12965+
** this function returns SQLITE_RANGE.
12966+
**
1293312967
** If the callback function returns any value other than SQLITE_OK, the
1293412968
** query is abandoned and the xQueryPhrase function returns immediately.
1293512969
** If the returned value is SQLITE_DONE, xQueryPhrase returns SQLITE_OK.
@@ -13044,9 +13078,42 @@ struct Fts5PhraseIter {
1304413078
**
1304513079
** xPhraseNextColumn()
1304613080
** See xPhraseFirstColumn above.
13081+
**
13082+
** xQueryToken(pFts5, iPhrase, iToken, ppToken, pnToken)
13083+
** This is used to access token iToken of phrase iPhrase of the current
13084+
** query. Before returning, output parameter *ppToken is set to point
13085+
** to a buffer containing the requested token, and *pnToken to the
13086+
** size of this buffer in bytes.
13087+
**
13088+
** If iPhrase or iToken are less than zero, or if iPhrase is greater than
13089+
** or equal to the number of phrases in the query as reported by
13090+
** xPhraseCount(), or if iToken is equal to or greater than the number of
13091+
** tokens in the phrase, SQLITE_RANGE is returned and *ppToken and *pnToken
13092+
are both zeroed.
13093+
**
13094+
** The output text is not a copy of the query text that specified the
13095+
** token. It is the output of the tokenizer module. For tokendata=1
13096+
** tables, this includes any embedded 0x00 and trailing data.
13097+
**
13098+
** xInstToken(pFts5, iIdx, iToken, ppToken, pnToken)
13099+
** This is used to access token iToken of phrase hit iIdx within the
13100+
** current row. If iIdx is less than zero or greater than or equal to the
13101+
** value returned by xInstCount(), SQLITE_RANGE is returned. Otherwise,
13102+
** output variable (*ppToken) is set to point to a buffer containing the
13103+
** matching document token, and (*pnToken) to the size of that buffer in
13104+
** bytes. This API is not available if the specified token matches a
13105+
** prefix query term. In that case both output variables are always set
13106+
** to 0.
13107+
**
13108+
** The output text is not a copy of the document text that was tokenized.
13109+
** It is the output of the tokenizer module. For tokendata=1 tables, this
13110+
** includes any embedded 0x00 and trailing data.
13111+
**
13112+
** This API can be quite slow if used with an FTS5 table created with the
13113+
** "detail=none" or "detail=column" option.
1304713114
*/
1304813115
struct Fts5ExtensionApi {
13049-
int iVersion; /* Currently always set to 2 */
13116+
int iVersion; /* Currently always set to 3 */
1305013117

1305113118
void *(*xUserData)(Fts5Context*);
1305213119

@@ -13081,6 +13148,13 @@ struct Fts5ExtensionApi {
1308113148

1308213149
int (*xPhraseFirstColumn)(Fts5Context*, int iPhrase, Fts5PhraseIter*, int*);
1308313150
void (*xPhraseNextColumn)(Fts5Context*, Fts5PhraseIter*, int *piCol);
13151+
13152+
/* Below this point are iVersion>=3 only */
13153+
int (*xQueryToken)(Fts5Context*,
13154+
int iPhrase, int iToken,
13155+
const char **ppToken, int *pnToken
13156+
);
13157+
int (*xInstToken)(Fts5Context*, int iIdx, int iToken, const char**, int*);
1308413158
};
1308513159

1308613160
/*

libs/SmartStore/SmartStoreTests/SFSmartStoreTests.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,13 @@ - (void) testRuntimeSettings
106106
- (void) testSqliteVersion
107107
{
108108
NSString* version = [NSString stringWithUTF8String:sqlite3_libversion()];
109-
XCTAssertEqualObjects(version, @"3.44.2");
109+
XCTAssertEqualObjects(version, @"3.45.3");
110110
}
111111

112112
- (void) testSqlCipherVersion
113113
{
114114
NSString* version = [self.store getSQLCipherVersion];
115-
XCTAssertEqualObjects(version, @"4.5.6 community");
115+
XCTAssertEqualObjects(version, @"4.5.7 community");
116116
}
117117

118118
/**

0 commit comments

Comments
 (0)