Remove mentions of unsupported iOS versions

This commit is contained in:
Gwendal Roué committed 2020-05-31 13:54:02 +02:00
1 parent 03a66af35e
commit 9ee3fd38b5
22 files changed
+39 -49

No files matched your search

+1 -1
View File
@@ -371,7 +371,7 @@ final class LatinAsciiTokenizer : FTS5WrapperTokenizer {
}
```
> :point_up: **Note**: String.applyingTransform is not available before iOS 9.0 and macOS 10.11. Use the Core Foundation function [CFStringTransform](https://developer.apple.com/reference/corefoundation/1542411-cfstringtransform) instead.
> :point_up: **Note**: String.applyingTransform is not available before macOS 10.11. Use the Core Foundation function [CFStringTransform](https://developer.apple.com/reference/corefoundation/1542411-cfstringtransform) instead.
Remember to register LatinAsciiTokenizer before using it:
+1 -2
View File
@@ -31,8 +31,7 @@ migrator.registerMigration("v2") { db in
**Each migration runs in a separate transaction.** Should one throw an error, its transaction is rollbacked, subsequent migrations do not run, and the error is eventually thrown by `migrator.migrate(dbQueue)`.
**Migrations run with deferred foreign key checks,** starting SQLite 3.7.16+ (iOS 9.0+ /
+ / tvOS 9.0+ / watchOS 2.0+ / [custom SQLite build] / [SQLCipher](../README.md#encryption)). This means that eventual foreign key violations are only checked at the end of the migration (and they make the migration fail).
**Migrations run with deferred foreign key checks.** This means that eventual foreign key violations are only checked at the end of the migration (and they make the migration fail).
**The memory of applied migrations is stored in the database itself** (in a reserved table).
+6 -4
View File
@@ -228,9 +228,9 @@ public final class Database {
}
// sqlite3_trace_v2 and sqlite3_expanded_sql were introduced in SQLite 3.14.0
// http://www.sqlite.org/changes.html#version_3_14
// It is available from iOS 10.0 and OS X 10.12
// It is available from macOS 10.12, tvOS 10.0, watchOS 3.0
// https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
#if GRDBCUSTOMSQLITE || GRDBCIPHER || os(iOS)
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
sqlite3_trace_v2(
sqliteConnection,
@@ -242,7 +242,7 @@ public final class Database {
#elseif os(Linux)
setupTrace_v1()
#else
if #available(iOS 10.0, OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
if #available(OSX 10.12, tvOS 10.0, watchOS 3.0, *) {
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
sqlite3_trace_v2(
sqliteConnection,
@@ -257,6 +257,7 @@ public final class Database {
#endif
}
#if !(GRDBCUSTOMSQLITE || GRDBCIPHER || os(iOS))
// Precondition: configuration.trace != nil
private func setupTrace_v1() {
let dbPointer = Unmanaged.passUnretained(self).toOpaque()
@@ -266,6 +267,7 @@ public final class Database {
db.configuration.trace!(sql)
}, dbPointer)
}
#endif
// Precondition: configuration.trace != nil
private static func trace_v2(
@@ -331,7 +333,7 @@ public final class Database {
add(function: .lowercase)
add(function: .uppercase)
if #available(iOS 9.0, OSX 10.11, watchOS 3.0, *) {
if #available(OSX 10.11, watchOS 3.0, *) {
add(function: .localizedCapitalize)
add(function: .localizedLowercase)
add(function: .localizedUppercase)
+1 -1
View File
@@ -139,7 +139,7 @@ public final class DatabasePool: DatabaseWriter {
// Undo job done in setupMemoryManagement()
//
// https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/index.html#10_11Error
// Explicit unregistration is required before iOS 9 and OS X 10.11.
// Explicit unregistration is required before OS X 10.11.
NotificationCenter.default.removeObserver(self)
// Close reader connections before the writer connection.
+1 -1
View File
@@ -68,7 +68,7 @@ public final class DatabaseQueue: DatabaseWriter {
// Undo job done in setupMemoryManagement()
//
// https://developer.apple.com/library/mac/releasenotes/Foundation/RN-Foundation/index.html#10_11Error
// Explicit unregistration is required before iOS 9 and OS X 10.11.
// Explicit unregistration is required before OS X 10.11.
NotificationCenter.default.removeObserver(self)
}
}
@@ -554,7 +554,7 @@ extension DatabaseFunction {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedCapitalized)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public static let localizedCapitalize =
DatabaseFunction("swiftLocalizedCapitalizedString", argumentCount: 1, pure: true) { dbValues in
guard let string = String.fromDatabaseValue(dbValues[0]) else {
@@ -575,7 +575,7 @@ extension DatabaseFunction {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedLowercased)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public static let localizedLowercase =
DatabaseFunction("swiftLocalizedLowercaseString", argumentCount: 1, pure: true) { dbValues in
guard let string = String.fromDatabaseValue(dbValues[0]) else {
@@ -596,7 +596,7 @@ extension DatabaseFunction {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedUppercased)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public static let localizedUppercase =
DatabaseFunction("swiftLocalizedUppercaseString", argumentCount: 1, pure: true) { dbValues in
guard let string = String.fromDatabaseValue(dbValues[0]) else {
+1 -4
View File
@@ -4,10 +4,7 @@ struct Migration {
let migrate: (Database) throws -> Void
func run(_ db: Database) throws {
// PRAGMA foreign_key_check and SQLITE_CONSTRAINT_FOREIGNKEY were
// introduced in SQLite 3.7.16
// http://www.sqlite.org/changes.html#version_3_7_16
if try sqlite3_libversion_number() >= 3007016 && (Bool.fetchOne(db, sql: "PRAGMA foreign_keys") ?? false) {
if try Bool.fetchOne(db, sql: "PRAGMA foreign_keys") ?? false {
try runWithDeferredForeignKeysChecks(db)
} else {
try runWithoutDisabledForeignKeys(db)
+3 -3
View File
@@ -187,7 +187,7 @@ extension SQLSpecificExpressible {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedCapitalized)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public var localizedCapitalized: SQLExpression {
DatabaseFunction.localizedCapitalize(sqlExpression)
}
@@ -198,7 +198,7 @@ extension SQLSpecificExpressible {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedLowercased)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public var localizedLowercased: SQLExpression {
DatabaseFunction.localizedLowercase(sqlExpression)
}
@@ -209,7 +209,7 @@ extension SQLSpecificExpressible {
/// let nameColumn = Column("name")
/// let request = Player.select(nameColumn.localizedUppercased)
/// let names = try String.fetchAll(dbQueue, request) // [String]
@available(iOS 9.0, OSX 10.11, watchOS 3.0, *)
@available(OSX 10.11, watchOS 3.0, *)
public var localizedUppercased: SQLExpression {
DatabaseFunction.localizedUppercase(sqlExpression)
}
+2 -2
View File
@@ -320,7 +320,7 @@ extension JSONRequiredEncoder: UnkeyedEncodingContainer {
mutating func superEncoder() -> Encoder { self }
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
private var iso8601Formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
@@ -342,7 +342,7 @@ extension DatabaseDateEncodingStrategy {
case .secondsSince1970:
return Int64(floor(date.timeIntervalSince1970))
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
return iso8601Formatter.string(from: date)
} else {
fatalError("ISO8601DateFormatter is unavailable on this platform.")
+1 -1
View File
@@ -348,7 +348,7 @@ public enum DatabaseDateEncodingStrategy {
case millisecondsSince1970
/// Encodes dates according to the ISO 8601 and RFC 3339 standards
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
case iso8601
/// Encodes a String, according to the provided formatter
+3 -3
View File
@@ -412,7 +412,7 @@ private struct MissingColumnError: Error {
var column: String
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
private var iso8601Formatter: ISO8601DateFormatter = {
let formatter = ISO8601DateFormatter()
formatter.formatOptions = .withInternetDateTime
@@ -461,7 +461,7 @@ extension DatabaseDateDecodingStrategy {
let timeInterval = TimeInterval(sqliteStatement: sqliteStatement, index: index)
return Date(timeIntervalSince1970: timeInterval / 1000.0)
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
let string = String(sqliteStatement: sqliteStatement, index: index)
guard let date = iso8601Formatter.date(from: string) else {
fatalConversionError(to: Date.self, sqliteStatement: sqliteStatement, index: index)
@@ -540,7 +540,7 @@ extension DatabaseDateDecodingStrategy {
.fromDatabaseValue(dbValue)
.map { Date(timeIntervalSince1970: $0 / 1000.0) }
case .iso8601:
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
return String
.fromDatabaseValue(dbValue)
.flatMap { iso8601Formatter.date(from: $0) }
+1 -1
View File
@@ -497,7 +497,7 @@ public enum DatabaseDateDecodingStrategy {
case millisecondsSince1970
/// Decodes dates according to the ISO 8601 standards
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
case iso8601
/// Decodes a String, according to the provided formatter
@@ -231,8 +231,8 @@ class AssociationPrefetchingObservationTests: GRDBTestCase {
try assertRequestRegionEqual(
db, request,
"a(*),b(colb1,colb2,colb3),c(colc1,colc2)", // iOS 12
"a(cola1,cola2),b(colb1,colb2,colb3),c(colc1,colc2)") // iOS 9
"a(*),b(colb1,colb2,colb3),c(colc1,colc2)",
"a(cola1,cola2),b(colb1,colb2,colb3),c(colc1,colc2)")
}
// Request with filters
@@ -283,8 +283,8 @@ class AssociationPrefetchingObservationTests: GRDBTestCase {
try assertRequestRegionEqual(
db, request,
"a(*),b(colb1,colb2,colb3),c(colc1,colc2),d(cold1,cold2,cold3)", // iOS 12
"a(cola1),b(colb1,colb2,colb3),c(colc1,colc2),d(cold1,cold2,cold3)") // iOS 9
"a(*),b(colb1,colb2,colb3),c(colc1,colc2),d(cold1,cold2,cold3)",
"a(cola1),b(colb1,colb2,colb3),c(colc1,colc2),d(cold1,cold2,cold3)")
}
}
}
@@ -22,7 +22,7 @@ private enum StrategyMillisecondsSince1970: StrategyProvider {
static let strategy: DatabaseDateDecodingStrategy = .millisecondsSince1970
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
private enum StrategyIso8601: StrategyProvider {
static let strategy: DatabaseDateDecodingStrategy = .iso8601
}
@@ -269,7 +269,7 @@ extension DatabaseDateDecodingStrategyTests {
extension DatabaseDateDecodingStrategyTests {
func testIso8601() throws {
// check ISO8601DateFormatter availabiliity
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
try makeDatabaseQueue().read { db in
var calendar = Calendar(identifier: .gregorian)
calendar.timeZone = TimeZone(secondsFromGMT: 0)!
@@ -26,7 +26,7 @@ private enum StrategyMillisecondsSince1970: StrategyProvider {
static let strategy: DatabaseDateEncodingStrategy = .millisecondsSince1970
}
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)
@available(macOS 10.12, watchOS 3.0, tvOS 10.0, *)
private enum StrategyIso8601: StrategyProvider {
static let strategy: DatabaseDateEncodingStrategy = .iso8601
}
@@ -167,7 +167,7 @@ extension DatabaseDateEncodingStrategyTests {
extension DatabaseDateEncodingStrategyTests {
func testIso8601() {
// check ISO8601DateFormatter availabiliity
if #available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *) {
if #available(macOS 10.12, watchOS 3.0, tvOS 10.0, *) {
testNullEncoding(strategy: StrategyIso8601.self)
for (date, value) in zip(testedDates, [
-2
View File
@@ -27,8 +27,6 @@ class DatabaseErrorTests: GRDBTestCase {
XCTAssertEqual(error.resultCode, .SQLITE_CONSTRAINT)
XCTAssertEqual(error.message!.lowercased(), "foreign key constraint failed") // lowercased: accept multiple SQLite version
XCTAssertEqual(error.sql!, "INSERT INTO pets (masterId, name) VALUES (?, ?)")
// SQLITE_CONSTRAINT_FOREIGNKEY was added in SQLite 3.7.16 http://www.sqlite.org/changes.html#version_3_7_16
// It is available from iOS 8.2 and OS X 10.10 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
XCTAssertEqual(error.description.lowercased(), "sqlite error 19 with statement `insert into pets (masterid, name) values (?, ?)` arguments [1, \"bobby\"]: foreign key constraint failed")
XCTAssertEqual(sqlQueries.count, 2)
+1 -1
View File
@@ -31,7 +31,7 @@ class DatabaseFunctionTests: GRDBTestCase {
let uppercase = DatabaseFunction.uppercase
XCTAssertEqual(try String.fetchOne(db, sql: "SELECT \(uppercase.name)('jérÔME')"), "JÉRÔME")
if #available(iOS 9.0, OSX 10.11, *) {
if #available(OSX 10.11, *) {
// Locale-dependent tests. Are they fragile?
let localizedCapitalize = DatabaseFunction.localizedCapitalize
@@ -959,7 +959,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
func testTargetQueue() throws {
// dispatchPrecondition(condition:) availability
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, *) {
if #available(OSX 10.12, tvOS 10.0, *) {
func test(targetQueue: DispatchQueue) throws {
dbConfiguration.targetQueue = targetQueue
let dbPool = try makeDatabasePool()
@@ -986,7 +986,7 @@ class DatabasePoolConcurrencyTests: GRDBTestCase {
func testQoS() throws {
// dispatchPrecondition(condition:) availability
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, *) {
if #available(OSX 10.12, tvOS 10.0, *) {
func test(qos: DispatchQoS) throws {
// https://forums.swift.org/t/what-is-the-default-target-queue-for-a-serial-queue/18094/5
//
+2 -2
View File
@@ -124,7 +124,7 @@ class DatabaseQueueTests: GRDBTestCase {
func testTargetQueue() throws {
// dispatchPrecondition(condition:) availability
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, *) {
if #available(OSX 10.12, tvOS 10.0, *) {
func test(targetQueue: DispatchQueue) throws {
dbConfiguration.targetQueue = targetQueue
let dbQueue = try makeDatabaseQueue()
@@ -151,7 +151,7 @@ class DatabaseQueueTests: GRDBTestCase {
func testQoS() throws {
// dispatchPrecondition(condition:) availability
if #available(OSX 10.12, iOS 10.0, tvOS 10.0, *) {
if #available(OSX 10.12, tvOS 10.0, *) {
func test(qos: DispatchQoS) throws {
// https://forums.swift.org/t/what-is-the-default-target-queue-for-a-serial-queue/18094/5
//
@@ -513,12 +513,6 @@ class DatabaseRegionTests : GRDBTestCase {
// the rowid column, regardless of its name in the request (rowid, oid, _rowid_)
//
// See also testRowIdNameInSelectStatement
guard sqlite3_libversion_number() > 3007013 else {
// This test fails on iOS 8.1 (SQLite 3.7.13)
// TODO: evaluate the consequences
return
}
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute(sql: "CREATE TABLE foo (name TEXT)")
@@ -37,7 +37,7 @@ private final class LatinAsciiTokenizer : FTS5WrapperTokenizer {
func accept(token: String, flags: FTS5TokenFlags, for tokenization: FTS5Tokenization, tokenCallback: FTS5WrapperTokenCallback) throws {
// Convert token to Latin-ASCII and lowercase
if #available(iOS 9.0, OSX 10.11, *) {
if #available(OSX 10.11, *) {
if let token = token.applyingTransform(StringTransform("Latin-ASCII; Lower"), reverse: false) {
try tokenCallback(token, flags)
}
@@ -927,7 +927,7 @@ class QueryInterfaceExpressionsTests: GRDBTestCase {
sql(dbQueue, tableRequest.select(Col.name.uppercased)),
"SELECT swiftUppercaseString(\"name\") FROM \"readers\"")
if #available(iOS 9.0, OSX 10.11, *) {
if #available(OSX 10.11, *) {
XCTAssertEqual(
sql(dbQueue, tableRequest.select(Col.name.localizedCapitalized)),
"SELECT swiftLocalizedCapitalizedString(\"name\") FROM \"readers\"")