From c5da564fb38ec2efe4cafc9087ecf00c5e430d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Sat, 19 Aug 2017 15:21:44 +0200 Subject: [PATCH] Use built-in SQLite3 module when available --- CHANGELOG.md | 2 ++ .../ExtensionDelegate.swift | 8 ----- .../InterfaceController.swift | 9 +----- .../GRDBDemoiOS.xcodeproj/project.pbxproj | 12 -------- GRDB.xcodeproj/project.pbxproj | 30 ++----------------- GRDB/Core/Configuration.swift | 3 +- GRDB/Core/Database.swift | 3 +- GRDB/Core/DatabaseError.swift | 3 +- GRDB/Core/DatabaseFunction.swift | 2 ++ GRDB/Core/DatabasePool.swift | 10 +++---- GRDB/Core/DatabaseReader.swift | 2 ++ GRDB/Core/DatabaseValue.swift | 3 +- GRDB/Core/Row.swift | 3 +- GRDB/Core/SchedulingWatchdog.swift | 4 --- GRDB/Core/Statement.swift | 3 +- GRDB/Core/StatementColumnConvertible.swift | 2 ++ .../StandardLibrary/StandardLibrary.swift | 2 ++ GRDB/Utils/Utils.swift | 4 --- README.md | 21 +++++-------- Support/GRDB.h | 2 +- Tests/GRDBTests/DataMemoryTests.swift | 8 +++-- Tests/GRDBTests/GRDBTestCase.swift | 8 +++-- Tests/GRDBTests/SelectStatementTests.swift | 8 +++-- ...StatementColumnConvertibleFetchTests.swift | 8 +++-- 24 files changed, 58 insertions(+), 102 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f95a1b93..6f992ce63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,8 @@ Release Notes - All `TableMapping` methods that would modify the database have moved to `MutablePersistable`, now the only record protocol that is able to write. +- WatchOS extension targets no longer need `libsqlite3.tbd` to be added to the *Linked Frameworks and Libraries* section of their *General* tab. + **API diff** diff --git a/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/ExtensionDelegate.swift b/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/ExtensionDelegate.swift index b6f6d2e2e..14aebf848 100644 --- a/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/ExtensionDelegate.swift +++ b/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/ExtensionDelegate.swift @@ -1,11 +1,3 @@ -// -// ExtensionDelegate.swift -// GRDBDemoWatchOS Extension -// -// Created by Gwendal Roué on 03/04/2017. -// Copyright © 2017 Gwendal Roué. All rights reserved. -// - import WatchKit class ExtensionDelegate: NSObject, WKExtensionDelegate { diff --git a/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/InterfaceController.swift b/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/InterfaceController.swift index 54af834d2..a116db10f 100644 --- a/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/InterfaceController.swift +++ b/DemoApps/GRDBDemoiOS/GRDBDemoWatchOS Extension/InterfaceController.swift @@ -1,14 +1,7 @@ -// -// InterfaceController.swift -// GRDBDemoWatchOS Extension -// -// Created by Gwendal Roué on 03/04/2017. -// Copyright © 2017 Gwendal Roué. All rights reserved. -// - import WatchKit import Foundation import GRDB +import SQLite3 class InterfaceController: WKInterfaceController { diff --git a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj index e8fc337d6..b3399ba06 100644 --- a/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj +++ b/DemoApps/GRDBDemoiOS/GRDBDemoiOS.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - 5657C36E1E926B05008402E8 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5657C36D1E926B05008402E8 /* libsqlite3.tbd */; }; 568E5FC31E926430002582E0 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 568E5FC11E926430002582E0 /* Interface.storyboard */; }; 568E5FC51E926430002582E0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 568E5FC41E926430002582E0 /* Assets.xcassets */; }; 568E5FCC1E926430002582E0 /* GRDBDemoWatchOS Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 568E5FCB1E926430002582E0 /* GRDBDemoWatchOS Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -243,7 +242,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 5657C36D1E926B05008402E8 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.2.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; }; 568E5FBF1E926430002582E0 /* GRDBDemoWatchOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GRDBDemoWatchOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 568E5FC21E926430002582E0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = ""; }; 568E5FC41E926430002582E0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -273,7 +271,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5657C36E1E926B05008402E8 /* libsqlite3.tbd in Frameworks */, 568E5FE41E926547002582E0 /* GRDB.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -289,14 +286,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - 5657C36C1E926B05008402E8 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 5657C36D1E926B05008402E8 /* libsqlite3.tbd */, - ); - name = Frameworks; - sourceTree = ""; - }; 568E5FC01E926430002582E0 /* GRDBDemoWatchOS */ = { isa = PBXGroup; children = ( @@ -326,7 +315,6 @@ 568E5FC01E926430002582E0 /* GRDBDemoWatchOS */, 568E5FCF1E926430002582E0 /* GRDBDemoWatchOS Extension */, 56B036041E8D9EBE003B6DA4 /* Products */, - 5657C36C1E926B05008402E8 /* Frameworks */, ); sourceTree = ""; }; diff --git a/GRDB.xcodeproj/project.pbxproj b/GRDB.xcodeproj/project.pbxproj index 9290c8961..1181516ff 100755 --- a/GRDB.xcodeproj/project.pbxproj +++ b/GRDB.xcodeproj/project.pbxproj @@ -29,7 +29,6 @@ 5605F18E1C6B1A8700235C62 /* SQLCollatedExpression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5605F1891C6B1A8700235C62 /* SQLCollatedExpression.swift */; }; 5605F1931C6B1A8700235C62 /* QueryInterfaceSelectQueryDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5605F18C1C6B1A8700235C62 /* QueryInterfaceSelectQueryDefinition.swift */; }; 5605F1941C6B1A8700235C62 /* QueryInterfaceSelectQueryDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5605F18C1C6B1A8700235C62 /* QueryInterfaceSelectQueryDefinition.swift */; }; - 5606AF911C0ED37000D20487 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BB86301BA98AB0001F9168 /* libsqlite3.tbd */; }; 56071A411DB54ED000CA6E47 /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; 56071A4E1DB54ED200CA6E47 /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; 56071A4F1DB54ED300CA6E47 /* FetchedRecordsControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B15D0A1CD4C35100A24C8B /* FetchedRecordsControllerTests.swift */; }; @@ -48,7 +47,6 @@ 560C97EC1C0E22D300BF8471 /* FMDatabaseQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 56BB861F1BA988F2001F9168 /* FMDatabaseQueue.m */; }; 560C97F21C0E22D300BF8471 /* FMDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 56BB861D1BA988F2001F9168 /* FMDatabasePool.m */; }; 560C98121C0E22D300BF8471 /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56CA220F1BB414FE009A04C5 /* SQLite.framework */; }; - 560C98131C0E22D300BF8471 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BB86301BA98AB0001F9168 /* libsqlite3.tbd */; }; 560C98141C0E22D300BF8471 /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; }; 560C98161C0E22D300BF8471 /* PerformanceTests.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = 56BB86111BA9886D001F9168 /* PerformanceTests.sqlite */; }; 560C98231C0E23BB00BF8471 /* InsertRecordTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB86121BA9886D001F9168 /* InsertRecordTests.swift */; }; @@ -402,7 +400,6 @@ 565490E21D5AE252005622CB /* Record.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238A11B9C753B0082EB20 /* Record.swift */; }; 565490E41D5AE252005622CB /* TableMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 560D92461C672C4B00F4F92B /* TableMapping.swift */; }; 56553C101C3E906C00522B5C /* GRDBTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5623E0901B4AFACC00B20B7F /* GRDBTestCase.swift */; }; - 56553C121C3E906C00522B5C /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BB86301BA98AB0001F9168 /* libsqlite3.tbd */; }; 56553C131C3E906C00522B5C /* GRDB.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DC3773F319C8CBB3004FCF85 /* GRDB.framework */; }; 5657AAB91D107001006283EF /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AAB81D107001006283EF /* NSData.swift */; }; 5657AABA1D107001006283EF /* NSData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5657AAB81D107001006283EF /* NSData.swift */; }; @@ -746,7 +743,6 @@ 568068361EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */; }; 568068371EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */; }; 568068381EBBA26100EFB8AA /* SQLRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */; }; - 5683C2691B4D445E00296494 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5683C2681B4D445E00296494 /* libsqlite3.dylib */; }; 568735A01CEDE16C009B9116 /* Betty.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 5687359E1CEDE16C009B9116 /* Betty.jpeg */; }; 568735A11CEDE16C009B9116 /* Betty.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 5687359E1CEDE16C009B9116 /* Betty.jpeg */; }; 568735A21CEDE16C009B9116 /* Betty.jpeg in Resources */ = {isa = PBXBuildFile; fileRef = 5687359E1CEDE16C009B9116 /* Betty.jpeg */; }; @@ -763,7 +759,6 @@ 568E1CB21CB037BA008D97A6 /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = 568BE5191CB035A900270F93 /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; }; 568E1CB91CB03847008D97A6 /* GRDBCipher-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = 568E1CB71CB03847008D97A6 /* GRDBCipher-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; 568E1CBA1CB03847008D97A6 /* GRDBCipher.h in Headers */ = {isa = PBXBuildFile; fileRef = 568E1CB81CB03847008D97A6 /* GRDBCipher.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 568E5FF61E9266B5002582E0 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 568E5FF51E9266B5002582E0 /* libsqlite3.tbd */; }; 568E5FF91E9267A5002582E0 /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = 568E5FF81E9267A5002582E0 /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; }; 568E5FFE1E92685C002582E0 /* sqlite3.h in Headers */ = {isa = PBXBuildFile; fileRef = 568E5FFD1E92685C002582E0 /* sqlite3.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5690C3271D23E6D800E59934 /* FoundationDateComponentsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5690C3251D23E6D800E59934 /* FoundationDateComponentsTests.swift */; }; @@ -1227,7 +1222,6 @@ 56BB6EAC1D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB6EA81D3009B100A1CA52 /* SchedulingWatchdog.swift */; }; 56BB6EAD1D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB6EA81D3009B100A1CA52 /* SchedulingWatchdog.swift */; }; 56BB6EAE1D3009B100A1CA52 /* SchedulingWatchdog.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BB6EA81D3009B100A1CA52 /* SchedulingWatchdog.swift */; }; - 56BB862F1BA98AA9001F9168 /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 56BB862E1BA98AA9001F9168 /* libsqlite3.tbd */; }; 56BF6D2F1DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BF6D2C1DEF47DA006039A3 /* Fixits-0-84-0.swift */; }; 56BF6D301DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BF6D2C1DEF47DA006039A3 /* Fixits-0-84-0.swift */; }; 56BF6D311DEF47DA006039A3 /* Fixits-0-84-0.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56BF6D2C1DEF47DA006039A3 /* Fixits-0-84-0.swift */; }; @@ -1524,7 +1518,6 @@ 6340BF871E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6340BF7F1E5E3F7900832805 /* RecordPersistenceConflictPolicy.swift */; }; DC2393C81ABE35F8003FF113 /* GRDB-Bridging.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2393C61ABE35F8003FF113 /* GRDB-Bridging.h */; settings = {ATTRIBUTES = (Public, ); }; }; DC3773F919C8CBB3004FCF85 /* GRDB.h in Headers */ = {isa = PBXBuildFile; fileRef = DC3773F819C8CBB3004FCF85 /* GRDB.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DC70AC991AC2331000371524 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = DC37744219C8DC91004FCF85 /* libsqlite3.dylib */; }; EED476F21CFD17270026A4EC /* GRDBCustomSQLite-USER.h in Headers */ = {isa = PBXBuildFile; fileRef = EED476F11CFD16FF0026A4EC /* GRDBCustomSQLite-USER.h */; settings = {ATTRIBUTES = (Public, ); }; }; EED476F31CFD172C0026A4EC /* GRDBCustomSQLite-USER.h in Headers */ = {isa = PBXBuildFile; fileRef = EED476F11CFD16FF0026A4EC /* GRDBCustomSQLite-USER.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3BA800A1CFB286A003DC1BA /* Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56A238701B9C75030082EB20 /* Configuration.swift */; }; @@ -2006,7 +1999,6 @@ 564F9C1D1F069B4E00877A00 /* DatabaseAggregateTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseAggregateTests.swift; sourceTree = ""; }; 564F9C2C1F075DD200877A00 /* DatabaseFunction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseFunction.swift; sourceTree = ""; }; 565490A01D5A4798005622CB /* GRDB.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = GRDB.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 565490E51D5AE282005622CB /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS2.2.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; }; 56553C181C3E906C00522B5C /* GRDBOSXCrashTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GRDBOSXCrashTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 5657AAB81D107001006283EF /* NSData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NSData.swift; sourceTree = ""; }; 5657AB0E1D10899D006283EF /* URL.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = URL.swift; sourceTree = ""; }; @@ -2056,7 +2048,6 @@ 567DAF141EAB61ED00FC0928 /* grdb_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = grdb_config.h; sourceTree = ""; }; 567DAF341EAB789800FC0928 /* DatabaseLogErrorTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseLogErrorTests.swift; sourceTree = ""; }; 568068301EBBA26100EFB8AA /* SQLRequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SQLRequestTests.swift; sourceTree = ""; }; - 5683C2681B4D445E00296494 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk/usr/lib/libsqlite3.dylib; sourceTree = DEVELOPER_DIR; }; 5687359E1CEDE16C009B9116 /* Betty.jpeg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Betty.jpeg; sourceTree = ""; }; 56873BEB1F2CB400004D24B4 /* Fixits-1.2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Fixits-1.2.swift"; sourceTree = ""; }; 568BE5191CB035A900270F93 /* sqlite3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3.h; path = SQLCipher/src/sqlite3.h; sourceTree = ""; }; @@ -2064,7 +2055,6 @@ 568BE5201CB0360500270F93 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; name = module.modulemap; path = SQLCipher/module.modulemap; sourceTree = ""; }; 568E1CB71CB03847008D97A6 /* GRDBCipher-Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "GRDBCipher-Bridging.h"; path = "SQLCipher/GRDBCipher-Bridging.h"; sourceTree = ""; }; 568E1CB81CB03847008D97A6 /* GRDBCipher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GRDBCipher.h; path = SQLCipher/GRDBCipher.h; sourceTree = ""; }; - 568E5FF51E9266B5002582E0 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.2.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; }; 568E5FF81E9267A5002582E0 /* sqlite3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3.h; path = usr/include/sqlite3.h; sourceTree = SDKROOT; }; 568E5FFD1E92685C002582E0 /* sqlite3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = sqlite3.h; path = usr/include/sqlite3.h; sourceTree = SDKROOT; }; 5690C3251D23E6D800E59934 /* FoundationDateComponentsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FoundationDateComponentsTests.swift; sourceTree = ""; }; @@ -2175,8 +2165,6 @@ 56BB86211BA988F2001F9168 /* FMResultSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FMResultSet.h; sourceTree = ""; }; 56BB86221BA988F2001F9168 /* FMResultSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FMResultSet.m; sourceTree = ""; }; 56BB862D1BA98933001F9168 /* GRDBPerformanceTests-Bridging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GRDBPerformanceTests-Bridging.h"; sourceTree = ""; }; - 56BB862E1BA98AA9001F9168 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; }; - 56BB86301BA98AB0001F9168 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; }; 56BF6D2C1DEF47DA006039A3 /* Fixits-0-84-0.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0-84-0.swift"; sourceTree = ""; }; 56BF6D2D1DEF47DA006039A3 /* Fixits-0-90-1.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-0-90-1.swift"; sourceTree = ""; }; 56BF6D2E1DEF47DA006039A3 /* Fixits-Swift2.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Fixits-Swift2.swift"; sourceTree = ""; }; @@ -2237,7 +2225,6 @@ DC3773F719C8CBB3004FCF85 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; DC3773F819C8CBB3004FCF85 /* GRDB.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GRDB.h; sourceTree = ""; }; DC37740419C8CBB3004FCF85 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DC37744219C8DC91004FCF85 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; DC37744719C8F50B004FCF85 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; EED476F11CFD16FF0026A4EC /* GRDBCustomSQLite-USER.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "GRDBCustomSQLite-USER.h"; path = "SQLiteCustom/GRDBCustomSQLite-USER.h"; sourceTree = ""; }; F3BA7FEE1CFB23B7003DC1BA /* GRDB.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = GRDB.xcconfig; path = SQLiteCustom/GRDB.xcconfig; sourceTree = ""; }; @@ -2263,7 +2250,6 @@ 569DF9731DB8E9280003D0CC /* RealmSwift.framework in Frameworks */, 56DE7B351C42B37E00861EB8 /* CoreData.framework in Frameworks */, 560C98121C0E22D300BF8471 /* SQLite.framework in Frameworks */, - 560C98131C0E22D300BF8471 /* libsqlite3.tbd in Frameworks */, 560C98141C0E22D300BF8471 /* GRDB.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2288,7 +2274,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 568E5FF61E9266B5002582E0 /* libsqlite3.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2296,7 +2281,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 56553C121C3E906C00522B5C /* libsqlite3.tbd in Frameworks */, 56553C131C3E906C00522B5C /* GRDB.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2337,7 +2321,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5683C2691B4D445E00296494 /* libsqlite3.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2345,7 +2328,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 56BB862F1BA98AA9001F9168 /* libsqlite3.tbd in Frameworks */, 56E5D7D41B4D3FEE00430942 /* GRDB.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2354,7 +2336,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5606AF911C0ED37000D20487 /* libsqlite3.tbd in Frameworks */, 56E5D7FE1B4D422E00430942 /* GRDB.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2363,7 +2344,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DC70AC991AC2331000371524 /* libsqlite3.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2510,8 +2490,6 @@ 5614DEEE1BA9D6F9003163B3 /* Frameworks */ = { isa = PBXGroup; children = ( - 56BB86301BA98AB0001F9168 /* libsqlite3.tbd */, - 56BB862E1BA98AA9001F9168 /* libsqlite3.tbd */, ); name = Frameworks; sourceTree = ""; @@ -2673,18 +2651,16 @@ isa = PBXGroup; children = ( 568E5FF81E9267A5002582E0 /* sqlite3.h */, - 5683C2681B4D445E00296494 /* libsqlite3.dylib */, ); - path = GRDBiOS; + name = GRDBiOS; sourceTree = ""; }; 567D10641C9A911C00ACC500 /* GRDBOSX */ = { isa = PBXGroup; children = ( 5620D0DE1E7D70F2006781C5 /* sqlite3.h */, - DC37744219C8DC91004FCF85 /* libsqlite3.dylib */, ); - path = GRDBOSX; + name = GRDBOSX; sourceTree = ""; }; 569530FA1C9067CC00CF1A2B /* Crash */ = { @@ -2757,7 +2733,6 @@ 569DF96F1DB8E9270003D0CC /* Frameworks */ = { isa = PBXGroup; children = ( - 568E5FF51E9266B5002582E0 /* libsqlite3.tbd */, 569DF9701DB8E9280003D0CC /* Realm.framework */, 569DF9711DB8E9280003D0CC /* RealmSwift.framework */, ); @@ -3028,7 +3003,6 @@ isa = PBXGroup; children = ( 568E5FFD1E92685C002582E0 /* sqlite3.h */, - 565490E51D5AE282005622CB /* libsqlite3.tbd */, ); name = GRDBWatchOS; sourceTree = ""; diff --git a/GRDB/Core/Configuration.swift b/GRDB/Core/Configuration.swift index 1e4addf1b..cc789ad40 100644 --- a/GRDB/Core/Configuration.swift +++ b/GRDB/Core/Configuration.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// Configuration for a DatabaseQueue or DatabasePool. diff --git a/GRDB/Core/Database.swift b/GRDB/Core/Database.swift index c42b88e81..2a86106be 100644 --- a/GRDB/Core/Database.swift +++ b/GRDB/Core/Database.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// A raw SQLite connection, suitable for the SQLite C API. diff --git a/GRDB/Core/DatabaseError.swift b/GRDB/Core/DatabaseError.swift index 8b7c6970a..a21daa414 100644 --- a/GRDB/Core/DatabaseError.swift +++ b/GRDB/Core/DatabaseError.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif public struct ResultCode : RawRepresentable, Equatable, CustomStringConvertible { diff --git a/GRDB/Core/DatabaseFunction.swift b/GRDB/Core/DatabaseFunction.swift index 8742600cf..2aec0262c 100644 --- a/GRDB/Core/DatabaseFunction.swift +++ b/GRDB/Core/DatabaseFunction.swift @@ -1,5 +1,7 @@ #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// An SQL function or aggregate. diff --git a/GRDB/Core/DatabasePool.swift b/GRDB/Core/DatabasePool.swift index 6521c56f2..7289b9d53 100644 --- a/GRDB/Core/DatabasePool.swift +++ b/GRDB/Core/DatabasePool.swift @@ -1,11 +1,11 @@ import Foundation - -#if os(iOS) - import UIKit -#endif - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 +#endif +#if os(iOS) + import UIKit #endif /// A DatabasePool grants concurrent accesses to an SQLite database. diff --git a/GRDB/Core/DatabaseReader.swift b/GRDB/Core/DatabaseReader.swift index cfbc981a4..0d793a24c 100644 --- a/GRDB/Core/DatabaseReader.swift +++ b/GRDB/Core/DatabaseReader.swift @@ -1,5 +1,7 @@ #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// The protocol for all types that can fetch values from a database. diff --git a/GRDB/Core/DatabaseValue.swift b/GRDB/Core/DatabaseValue.swift index 98f10c515..ec46ae9ea 100644 --- a/GRDB/Core/DatabaseValue.swift +++ b/GRDB/Core/DatabaseValue.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif // MARK: - DatabaseValue diff --git a/GRDB/Core/Row.swift b/GRDB/Core/Row.swift index 51cb0e886..7a010b516 100644 --- a/GRDB/Core/Row.swift +++ b/GRDB/Core/Row.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// A database row. diff --git a/GRDB/Core/SchedulingWatchdog.swift b/GRDB/Core/SchedulingWatchdog.swift index c83bcf326..098fc3282 100644 --- a/GRDB/Core/SchedulingWatchdog.swift +++ b/GRDB/Core/SchedulingWatchdog.swift @@ -1,9 +1,5 @@ import Dispatch -#if SWIFT_PACKAGE - import CSQLite -#endif - /// SchedulingWatchdog makes sure that databases connections are used on correct /// dispatch queues, and warns the user with a fatal error whenever she misuses /// a database connection. diff --git a/GRDB/Core/Statement.swift b/GRDB/Core/Statement.swift index 5a1f7a24b..4b52581e7 100644 --- a/GRDB/Core/Statement.swift +++ b/GRDB/Core/Statement.swift @@ -1,7 +1,8 @@ import Foundation - #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// A raw SQLite statement, suitable for the SQLite C API. diff --git a/GRDB/Core/StatementColumnConvertible.swift b/GRDB/Core/StatementColumnConvertible.swift index fd3fc10c8..b35b3eaa0 100644 --- a/GRDB/Core/StatementColumnConvertible.swift +++ b/GRDB/Core/StatementColumnConvertible.swift @@ -1,5 +1,7 @@ #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif /// When a type adopts both DatabaseValueConvertible and diff --git a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift index 07cf3dac4..facddaa65 100644 --- a/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift +++ b/GRDB/Core/Support/StandardLibrary/StandardLibrary.swift @@ -1,5 +1,7 @@ #if SWIFT_PACKAGE import CSQLite +#elseif !GRDBCUSTOMSQLITE && !GRDBCIPHER + import SQLite3 #endif // MARK: - Value Types diff --git a/GRDB/Utils/Utils.swift b/GRDB/Utils/Utils.swift index cbd2cdcda..c2c9ace94 100644 --- a/GRDB/Utils/Utils.swift +++ b/GRDB/Utils/Utils.swift @@ -1,9 +1,5 @@ import Foundation -#if SWIFT_PACKAGE - import CSQLite -#endif - // MARK: - Public extension String { diff --git a/README.md b/README.md index f25a6e2fb..44a67d97a 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,7 @@ GRDB.swift [![Swift](https://img.shields.io/badge/swift-3.1-orange.svg?style=fla **Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ • Xcode 8.3+ • Swift 3.1 -- Swift 2.2: use [version 0.80.2](https://github.com/groue/GRDB.swift/tree/v0.80.2) -- Swift 2.3: use [version 0.81.2](https://github.com/groue/GRDB.swift/tree/v0.81.2) -- Swift 3.0: use [version 1.0](https://github.com/groue/GRDB.swift/tree/v1.0) -- Xcode 9 beta, Swift 3.2: use the master branch -- Xcode 9 beta, Swift 4: use the [Swift4](https://github.com/groue/GRDB.swift/tree/Swift4) branch +**Other Swift versions**: Swift 2.2 / Xcode 7.3 [v0.80.2](https://github.com/groue/GRDB.swift/tree/v0.80.2) • Swift 2.3 / Xcode 8.0: [v0.81.2](https://github.com/groue/GRDB.swift/tree/v0.81.2) • Swift 3.0 / Xcode 8.0: [v1.0](https://github.com/groue/GRDB.swift/tree/v1.0) • Swift 3.2 / Xcode 9 beta: [v1.3](https://github.com/groue/GRDB.swift/tree/v1.3.0) • Swift 4 / Xcode 9 beta: [Swift4 branch](https://github.com/groue/GRDB.swift/tree/Swift4) Follow [@groue](http://twitter.com/groue) on Twitter for release announcements and usage tips. @@ -283,8 +279,6 @@ Any pull request that has the `make test_CarthageBuild` command successfully com 4. Add the `GRDB.framework` from the targetted platform to the **Embedded Binaries** section of the **General** tab of your application target (extension target for WatchOS). -5. (WatchOS only). Add `libsqlite3.tbd` to the **Linked Frameworks and Libraries** section of the **General** tab of your extension target. - See [GRDBDemoiOS](DemoApps/GRDBDemoiOS/GRDBDemoiOS) for an example of such integration. @@ -1684,15 +1678,14 @@ row.scoped(on: "remainder") // **If not all SQLite APIs are exposed in GRDB, you can still use the [SQLite C Interface](https://www.sqlite.org/c3ref/intro.html) and call [SQLite C functions](https://www.sqlite.org/c3ref/funclist.html).** -```swift -let sqliteVersion = String(cString: sqlite3_libversion()) -``` - -Those functions are embedded right into the GRDB framework, unless you use GRDB through the Swift Package Manager. In this case, you need to import the `CSQLite` module: +Those functions are embedded right into the GRDBCustom and GRCBCipher modules. For the "regular" GRDB framework: you'll need to import `SQLite3`, or `CSQLite`, depending on whether you use the Swift Package Manager or not: ```swift -// When you use the Swift Package Manager -import CSQLite +#if SWIFT_PACKAGE + import CSQLite // For Swift Package Manager +#else + import SQLite3 // Otherwise +#endif let sqliteVersion = String(cString: sqlite3_libversion()) ``` diff --git a/Support/GRDB.h b/Support/GRDB.h index 2bd4d1b5d..69ad6ed45 100644 --- a/Support/GRDB.h +++ b/Support/GRDB.h @@ -7,4 +7,4 @@ FOUNDATION_EXPORT double GRDB_VersionNumber; FOUNDATION_EXPORT const unsigned char GRDB_VersionString[]; #import -#import + diff --git a/Tests/GRDBTests/DataMemoryTests.swift b/Tests/GRDBTests/DataMemoryTests.swift index 31e576779..58c30f77a 100644 --- a/Tests/GRDBTests/DataMemoryTests.swift +++ b/Tests/GRDBTests/DataMemoryTests.swift @@ -1,12 +1,14 @@ import XCTest -#if SWIFT_PACKAGE - import CSQLite -#endif #if GRDBCIPHER @testable import GRDBCipher #elseif GRDBCUSTOMSQLITE @testable import GRDBCustomSQLite #else + #if SWIFT_PACKAGE + import CSQLite + #else + import SQLite3 + #endif @testable import GRDB #endif diff --git a/Tests/GRDBTests/GRDBTestCase.swift b/Tests/GRDBTests/GRDBTestCase.swift index 4dbf3a97b..b5f4471be 100644 --- a/Tests/GRDBTests/GRDBTestCase.swift +++ b/Tests/GRDBTests/GRDBTestCase.swift @@ -1,12 +1,14 @@ import XCTest -#if SWIFT_PACKAGE - import CSQLite -#endif #if GRDBCIPHER @testable import GRDBCipher // @testable so that we have access to SQLiteConnectionWillClose #elseif GRDBCUSTOMSQLITE @testable import GRDBCustomSQLite // @testable so that we have access to SQLiteConnectionWillClose #else + #if SWIFT_PACKAGE + import CSQLite + #else + import SQLite3 + #endif @testable import GRDB // @testable so that we have access to SQLiteConnectionWillClose #endif diff --git a/Tests/GRDBTests/SelectStatementTests.swift b/Tests/GRDBTests/SelectStatementTests.swift index e2d5018bc..f58ee9a80 100644 --- a/Tests/GRDBTests/SelectStatementTests.swift +++ b/Tests/GRDBTests/SelectStatementTests.swift @@ -1,12 +1,14 @@ import XCTest -#if SWIFT_PACKAGE - import CSQLite -#endif #if GRDBCIPHER import GRDBCipher #elseif GRDBCUSTOMSQLITE import GRDBCustomSQLite #else + #if SWIFT_PACKAGE + import CSQLite + #else + import SQLite3 + #endif import GRDB #endif diff --git a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift index 9a4f103ed..5eb74b244 100644 --- a/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift +++ b/Tests/GRDBTests/StatementColumnConvertibleFetchTests.swift @@ -1,12 +1,14 @@ import XCTest -#if SWIFT_PACKAGE - import CSQLite -#endif #if GRDBCIPHER import GRDBCipher #elseif GRDBCUSTOMSQLITE import GRDBCustomSQLite #else + #if SWIFT_PACKAGE + import CSQLite + #else + import SQLite3 + #endif import GRDB #endif