mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-28 04:24:20 +00:00
Merge pull request #790 from groue/dev/iOS10
Bump required iOS version to 10.0
This commit is contained in:
33 files changed
+55
-61
No files matched your search
@@ -74,6 +74,10 @@ GRDB adheres to [Semantic Versioning](https://semver.org/), with one exception:
|
||||
|
||||
- [#784](https://github.com/groue/GRDB.swift/pull/784): Fix observation of eager-loaded to-many associations
|
||||
|
||||
### Breaking Changes
|
||||
|
||||
- [#790](https://github.com/groue/GRDB.swift/pull/790): Bump required iOS version to 10.0
|
||||
|
||||
|
||||
## 5.0.0-beta.2
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ GRDB requirements have been bumped:
|
||||
|
||||
- **Swift 5.2+** (was Swift 4.2+)
|
||||
- **Xcode 11.4+** (was Xcode 10.0+)
|
||||
- iOS 9.0+ (unchanged)
|
||||
- **iOS 10.0+** (was iOS 9.0+)
|
||||
- **macOS 10.10+** (was macOS 10.9+)
|
||||
- tvOS 9.0+ (unchanged)
|
||||
- watchOS 2.0+ (unchanged)
|
||||
|
||||
@@ -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).
|
||||
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ Pod::Spec.new do |s|
|
||||
s.module_name = 'GRDB'
|
||||
|
||||
s.swift_versions = ['5.2']
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.ios.deployment_target = '10.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.watchos.deployment_target = '2.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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.")
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) }
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ import PackageDescription
|
||||
let package = Package(
|
||||
name: "GRDB",
|
||||
platforms: [
|
||||
.iOS("9.0"),
|
||||
.iOS("10.0"),
|
||||
.macOS("10.10"),
|
||||
.tvOS("9.0"),
|
||||
.watchOS("2.0"),
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
**Latest release**: May 11, 2020 • version 5.0.0-beta.2 • [CHANGELOG](CHANGELOG.md) • [Migrating From GRDB 4 to GRDB 5](Documentation/GRDB5MigrationGuide.md)
|
||||
|
||||
**Requirements**: iOS 9.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ • Swift 5.2+ / Xcode 11.4+
|
||||
**Requirements**: iOS 10.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ • Swift 5.2+ / Xcode 11.4+
|
||||
|
||||
| Swift version | GRDB version |
|
||||
| ------------- | ----------------------------------------------------------- |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0
|
||||
@@ -1,4 +1,4 @@
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0
|
||||
WATCHOS_DEPLOYMENT_TARGET = 2.0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use_frameworks!
|
||||
target 'iOS'
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '10.0'
|
||||
pod 'GRDB.swift', :path => '../../..'
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -301,7 +301,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
target 'iOS'
|
||||
platform :ios, '9.0'
|
||||
platform :ios, '10.0'
|
||||
pod 'GRDB.swift', :path => '../../..'
|
||||
|
||||
post_install do |installer|
|
||||
|
||||
@@ -232,7 +232,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
@@ -282,7 +282,7 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
|
||||
@@ -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, [
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
@@ -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\"")
|
||||
|
||||
Reference in new issue
Block a user