Compare commits

...
69 Commits
Author SHA1 Message Date
Gwendal Roué c6ab92e60a v2.4.2 2018-01-06 14:35:05 +01:00
Gwendal Roué c0d5f3019b generatePerformanceReport reads versions of tested libraries from info.plist files 2018-01-06 13:37:30 +01:00
Gwendal Roué b09d5c3833 Fix FMDB performance tests 2018-01-06 12:47:01 +01:00
Gwendal Roué 3eff1b48b1 Update copyright year 2018-01-06 12:33:32 +01:00
Gwendal Roué a12fffc4e7 Update documentation about readFromCurrentState 2018-01-06 10:04:41 +01:00
Gwendal Roué 94715130fc DatabaseWriter.readFromCurrentState(_:) now fails with a fatal error if a transaction is currently opened 2018-01-06 09:19:26 +01:00
Gwendal Roué 313188ca0e More TODO 2018-01-05 19:40:55 +01:00
Gwendal Roué 5a68b008c6 CHANGELOG 2018-01-02 13:34:23 +01:00
Gwendal Roué 6fe9098c76 Statement compilation cleanup 2018-01-02 13:10:11 +01:00
Gwendal Roué 631a914acd Fix failing test for schema cache shared between DatabasePool reader and writer (stop sharing cache) 2018-01-02 13:08:41 +01:00
Gwendal Roué d1f24c9722 More TODO 2017-12-28 17:48:15 +01:00
Gwendal Roué 7b76c9319a Failing test for schema cache shared between DatabasePool reader and writer 2017-12-28 14:16:36 +01:00
Gwendal Roué 63083c5d1e Less TODO 2017-12-28 13:56:54 +01:00
Gwendal Roué c51a3cd624 Statement compilation cleanup 2017-12-17 13:57:35 +01:00
Gwendal Roué 1fadb7485a Less TODO 2017-12-17 13:14:15 +01:00
Gwendal Roué 58e05d13d1 v2.4.1 2017-12-16 15:09:59 +01:00
Gwendal Roué d8c9692d4d Fix typo 2017-12-16 14:40:58 +01:00
Gwendal Roué f83ffd3a25 Remove unused file 2017-12-16 14:35:09 +01:00
Gwendal Roué d12ff2a92b Scripts that generate performance comparison report 2017-12-16 14:35:02 +01:00
Gwendal Roué 8709d6f9a9 FMDB 2.7.4 2017-12-16 14:25:24 +01:00
Gwendal Roué e2806c55ff Upgrade Makefile test_performance target for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:44:19 +01:00
Gwendal Roué 08d6c843d6 Upgrade performance comparison tests for Xcode 9.2 and Swift 4.0.3 2017-12-16 13:42:53 +01:00
Gwendal Roué 0da3726a89 Realm 3.0.2 2017-12-16 13:36:13 +01:00
Gwendal Roué 36676bcad3 SQLite.swift 0.11.4 2017-12-16 13:33:36 +01:00
Gwendal Roué 1509e1e9a8 Clean up projects & workspace 2017-12-16 13:29:05 +01:00
Gwendal Roué 4c71dd9ebe Remove compiler warning 2017-12-16 13:14:07 +01:00
Gwendal Roué ef8d0d6334 TODO.md 2017-12-15 18:49:36 +01:00
Gwendal Roué 7477b7a173 CHANGELOG.md 2017-12-13 08:24:14 +01:00
Gwendal Roué 246f36821b Merge pull request #284 from groue/Issue283
Don't call sqlite3_config() unless explicitly required to do so
2017-12-13 08:10:57 +01:00
Gwendal Roué d567ee60bf Remove compiler warning 2017-12-08 10:51:31 +01:00
Gwendal Roué 3a157d2808 Test for global SQLite error log requires global variables 2017-12-08 10:51:20 +01:00
Gwendal Roué 7d0c2f9ef8 Fix tests for Database.logError 2017-12-08 10:03:27 +01:00
Gwendal Roué f356f8734a Update Database.logError documentation, and make it clear that it has to be called very very early. 2017-12-07 13:35:19 +01:00
Gwendal Roué 5b7f4a7ff5 Call sqlite3_config(SQLITE_CONFIG_LOG, ...) if and only if Database.logError is set. 2017-12-07 13:14:49 +01:00
Gwendal Roué e10efca17a Fix typo 2017-12-03 16:27:59 +01:00
Gwendal Roué 578b9a5275 v2.4.0 2017-12-03 16:04:07 +01:00
Gwendal Roué 63304b3d12 Merge pull request #281 from groue/DropSynchronizationTriggers
Drop full-text synchronization triggers
2017-12-03 15:57:08 +01:00
Gwendal Roué 39f6ca0035 Merge branch 'master' into DropSynchronizationTriggers 2017-12-03 15:56:23 +01:00
Gwendal Roué 5e3c62c963 Merge pull request #282 from groue/preventXcodeWarningsForMissingFiles
Prevent Xcode warnings for missing files
2017-12-03 15:55:14 +01:00
Gwendal Roué 6966600223 Fix scheme references to projects 2017-12-03 14:41:16 +01:00
Gwendal Roué e028cbb6d5 Declare new GRDBCipher.xcodeproj and GRDBCustom.xcodeproj in CHANGELOG.md 2017-12-03 14:37:21 +01:00
Gwendal Roué 8b3c3f48a8 Update documention for embedding GRDBCipher & GRDBCustom 2017-12-03 14:23:49 +01:00
Gwendal Roué 2d84e72097 Restore GRDBOSXPerformanceComparisonTests 2017-12-03 14:20:08 +01:00
Gwendal Roué d91fe7b633 Extract GRDBCipher.xcodeproj and GRDBCustom.xcodeproj from GRDB.xcodeproj 2017-12-03 14:07:05 +01:00
Gwendal Roué 090df10831 Revert attempt at preventing Xcode warnings with Run Script phases 2017-12-03 12:52:37 +01:00
Gwendal Roué f21037bb69 Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in all targets except custom SQLite 2017-12-01 13:47:06 +01:00
Gwendal Roué f3041bcc9a Run make preventXcodeWarningsForMissingFiles as a Run Script Phase in the GRDBiOS target 2017-12-01 13:41:47 +01:00
Gwendal Roué 67b1225dfa make preventXcodeWarningsForMissingFiles 2017-12-01 13:37:02 +01:00
Gwendal Roué 23f2e0371e Fix documentation typo 2017-12-01 13:24:04 +01:00
Gwendal Roué a3d8df222f Fix documentation typo 2017-12-01 13:20:17 +01:00
Gwendal Roué 632ef3707c CHANGELOG.md 2017-12-01 13:17:58 +01:00
Gwendal Roué 79dc099e6d Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:17:54 +01:00
Gwendal Roué 75035fb40c Documentation for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:30 +01:00
Gwendal Roué b4887b661c Tests for Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:24 +01:00
Gwendal Roué e8835af363 Database.dropFTS4SynchronizationTriggers & Database.dropFTS5SynchronizationTriggers 2017-12-01 13:14:13 +01:00
Gwendal Roué 1fabe08332 Trust SQLite: don't assert anything about the remaining characters after a statement 2017-11-30 08:53:10 +01:00
Gwendal Roué c2e3638e8d More failing tests for Database.execute() 2017-11-30 08:50:42 +01:00
Gwendal Roué 71abced420 CHANGELOG.md 2017-11-30 08:09:15 +01:00
Gwendal Roué ac00046b07 CHANGELOG.md 2017-11-29 20:29:33 +01:00
Gwendal Roué 38b5204713 Merge pull request #280 from groue/AddUntypedColumn
Table alteration: add untyped column
2017-11-29 20:21:13 +01:00
Gwendal Roué 4b173dece5 Test for t.add(column:) without any explicit column type 2017-11-29 20:17:26 +01:00
Gwendal Roué 8ce2c09b52 TableAlteration.add(column:type:) accepts nil type 2017-11-29 20:11:28 +01:00
Gwendal Roué 8125574f8f Fix typo in ISSUE_TEMPLATE.md 2017-11-22 08:56:48 +01:00
Gwendal Roué 8974360cac ISSUE_TEMPLATE.md 2017-11-22 08:24:21 +01:00
Gwendal Roué 6e48cc1524 Reminder: enable sanitizers when running tests 2017-11-11 06:43:59 +01:00
Gwendal Roué a1ea75ca34 TODO.md 2017-11-10 12:58:04 +01:00
Gwendal Roué 81d2f21093 Cleanup 2017-11-10 08:45:05 +01:00
Gwendal Roué fd73a31abc Fix failing tests and faulty assert 2017-11-09 14:29:59 +01:00
Gwendal Roué 1583ac0c08 Add failing test for Database.execute() 2017-11-09 14:29:35 +01:00
54 changed files with 6558 additions and 4227 deletions

No files matched your search

+40
View File
@@ -1,6 +1,46 @@
Release Notes
=============
## 2.4.2
Released January 6, 2018 • [diff](https://github.com/groue/GRDB.swift/compare/v2.4.1...v2.4.2)
**Fixed**
- When using a database pool, the schema introspection methods could return wrong values whenever the database schema was concurrently read and modified. This has been fixed.
- `DatabasePool.readFromCurrentState` no longer accepts to spawn a reader when a transaction is currently opened on the writer connection.
## 2.4.1
Released December 16, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.4.0...v2.4.1)
**Fixed**
- [#284](https://github.com/groue/GRDB.swift/pull/284): fixes a misuse of the sqlite3_config() function when configuring the global SQLite [Error Log](https://github.com/groue/GRDB.swift/blob/master/README.md#error-log)
## 2.4.0
Released December 3, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.3.1...v2.4.0)
**New**
- [#280](https://github.com/groue/GRDB.swift/pull/280): It is now possible to add an untyped column to an existing table.
```swift
try db.alter(table: "players") { t in
t.add(column: "score")
}
```
- [#281](https://github.com/groue/GRDB.swift/pull/280): The `Database.dropFTS4SynchronizationTriggers` & `Database.dropFTS5SynchronizationTriggers` method help cleaning up synchronized full-text table ([documentation](https://github.com/groue/GRDB.swift/blob/master/README.md#deleting-synchronized-full-text-tables))
**Breaking Change**
- [#282](https://github.com/groue/GRDB.swift/issues/282): This version comes with a breaking change that affects users who manually embed the GRDBCipher and GRDBCustom frameworks in their projects. This change does not affect users of the GRDB framework, or users of GRDBCipher through CocoaPods. Now, instead of embedding the GRDB.xcodeproj project, you have to embed the GRDBCipher.xcodeproj or GRDBCustom.xcodeproj. Please have a look at the updated [Encryption](https://github.com/groue/GRDB.swift/blob/master/README.md#encryption) and [Custom SQLite Builds](https://github.com/groue/GRDB.swift/blob/master/Documentation/CustomSQLiteBuilds.md) documentation chapters.
## 2.3.1
Released November 8, 2017 • [diff](https://github.com/groue/GRDB.swift/compare/v2.3.0...v2.3.1)
+3 -3
View File
@@ -15,7 +15,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
```sh
cd [GRDB directory]
git checkout v2.3.1
git checkout v2.4.2
git submodule update --init SQLiteCustom/src
````
@@ -60,7 +60,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
# !! MODIFY THESE TO MATCH YOUR PROJECT HIERARCHY !!
#######################################################
# The path to the folder containing GRDB.xcodeproj:
# The path to the folder containing GRDBCustom.xcodeproj:
GRDB_SOURCE_PATH="${PROJECT_DIR}/GRDB"
# The path to your custom "SQLiteLib-USER.xcconfig":
@@ -107,7 +107,7 @@ GRDB builds SQLite with [swiftlyfalling/SQLiteLib](https://github.com/swiftlyfal
Modify the top of `GRDBCustomSQLite-INSTALL.sh` file so that it contains correct paths.
5. Embed the `GRDB.xcodeproj` project in your own project.
5. Embed the `GRDBCustom.xcodeproj` project in your own project.
6. Add the `GRDBCustomSQLiteOSX` or `GRDBCustomSQLiteiOS` target in the **Target Dependencies** section of the **Build Phases** tab of your **application target**.
+2 -2
View File
@@ -497,7 +497,7 @@ Build a `value BETWEEN min AND max` expression from Swift ranges:
#### The COUNT Function
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.3/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.3/Functions.html) functions:
Build a `COUNT(...)` expression from the [count](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) and [count(distinct:)](http://groue.github.io/GRDB.swift/docs/2.4/Functions.html) functions:
```swift
// SQLExpression: COUNT(email)
@@ -588,4 +588,4 @@ You may want to compare it to another protocol, SQLSpecificExpressible, which ha
> :point_up: **Note**: whenever you extend GRDB with a Swift function, method, or operator, you should generally make sure that its signature contains at least one GRDB-specific type. In the `cast` function, it is Database.ColumnType.
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/SQLExpression.html) protocol.
**If SQLExpressionLiteral reveals too limited for your purpose**, you may have to implement a new type that adopts the [SQLExpression](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/SQLExpression.html) protocol.
+3
View File
@@ -30,3 +30,6 @@ To release a new GRDB version:
- `make doc`, and update index.html in the `gh-pages` branch
- Update http://github.com/groue/GRDBDemo
- Update http://github.com/groue/WWDCCompanion
- Update [performance comparison](https://github.com/groue/GRDB.swift/wiki/Performance):
`make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb`
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDB.swift'
s.version = '2.3.1'
s.version = '2.4.2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A Swift application toolkit for SQLite databases.'
File diff suppressed because it is too large. Load diff
+21
View File
@@ -23,9 +23,30 @@
location = "group:MyPlayground.playground">
</FileRef>
</Group>
<FileRef
location = "group:CHANGELOG.md">
</FileRef>
<FileRef
location = "group:README.md">
</FileRef>
<FileRef
location = "group:TODO.md">
</FileRef>
<FileRef
location = "group:Documentation/ReleaseProcess.md">
</FileRef>
<FileRef
location = "group:Makefile">
</FileRef>
<FileRef
location = "group:GRDB.xcodeproj">
</FileRef>
<FileRef
location = "group:GRDBCustom.xcodeproj">
</FileRef>
<FileRef
location = "group:GRDBCipher.xcodeproj">
</FileRef>
<FileRef
location = "group:Tests/Performance/GRDBProfiling/GRDBProfiling.xcodeproj">
</FileRef>
+4 -39
View File
@@ -14,7 +14,7 @@ extension Database {
/// - returns: A SelectStatement.
/// - throws: A DatabaseError whenever SQLite could not parse the sql query.
public func makeSelectStatement(_ sql: String) throws -> SelectStatement {
return try makeStatement(sql, prepFlags: 0)
return try makeSelectStatement(sql, prepFlags: 0)
}
/// Returns a new prepared statement that can be reused.
@@ -29,7 +29,7 @@ extension Database {
/// - returns: A SelectStatement.
/// - throws: A DatabaseError whenever SQLite could not parse the sql query.
func makeSelectStatement(_ sql: String, prepFlags: Int32) throws -> SelectStatement {
return try makeStatement(sql, prepFlags: prepFlags)
return try SelectStatement.prepare(sql: sql, prepFlags: prepFlags, in: self)
}
/// Returns a prepared statement that can be reused.
@@ -63,7 +63,7 @@ extension Database {
/// - returns: An UpdateStatement.
/// - throws: A DatabaseError whenever SQLite could not parse the sql query.
public func makeUpdateStatement(_ sql: String) throws -> UpdateStatement {
return try makeStatement(sql, prepFlags: 0)
return try makeUpdateStatement(sql, prepFlags: 0)
}
/// Returns a new prepared statement that can be reused.
@@ -78,7 +78,7 @@ extension Database {
/// - returns: An UpdateStatement.
/// - throws: A DatabaseError whenever SQLite could not parse the sql query.
func makeUpdateStatement(_ sql: String, prepFlags: Int32) throws -> UpdateStatement {
return try makeStatement(sql, prepFlags: prepFlags)
return try UpdateStatement.prepare(sql: sql, prepFlags: prepFlags, in: self)
}
/// Returns a prepared statement that can be reused.
@@ -185,41 +185,6 @@ extension Database {
// arguments that do not match the statement.
try! validateRemainingArguments() // throws if there are remaining arguments.
}
private func makeStatement<Statement: AuthorizedStatement>(_ sql: String, prepFlags: Int32) throws -> Statement {
let statementCompilationAuthorizer = StatementCompilationAuthorizer()
authorizer = statementCompilationAuthorizer
defer { authorizer = nil }
var statement: Statement? = nil
let sqlCodeUnits = sql.utf8CString
var remainingSQL = ""
try sqlCodeUnits.withUnsafeBufferPointer { codeUnits in
let statementStart = UnsafePointer<Int8>(codeUnits.baseAddress)!
var statementEnd: UnsafePointer<Int8>? = nil
do {
statement = try Statement(
database: self,
statementStart: statementStart,
statementEnd: &statementEnd,
prepFlags: prepFlags,
authorizer: statementCompilationAuthorizer)
} catch is EmptyStatementError {
throw DatabaseError(resultCode: .SQLITE_ERROR, message: "empty statement", sql: sql, arguments: nil)
}
let remainingData = Data(
bytesNoCopy: UnsafeMutableRawPointer(mutating: statementEnd!),
count: statementStart + sqlCodeUnits.count - statementEnd! - 1,
deallocator: .none)
remainingSQL = String(data: remainingData, encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines)
}
guard remainingSQL.isEmpty else {
throw DatabaseError(resultCode: .SQLITE_MISUSE, message: "Multiple statements found. To execute multiple statements, use Database.execute() instead.", sql: sql, arguments: nil)
}
return statement!
}
}
extension Database {
+14 -24
View File
@@ -46,7 +46,20 @@ public final class Database {
/// > advantage of the error logging facility of SQLite in their products,
/// > as it is very low CPU and memory cost but can be a huge aid
/// > for debugging.
public static var logError: LogErrorFunction? = nil
public static var logError: LogErrorFunction? = nil {
didSet {
if logError != nil {
registerErrorLogCallback { (_, code, message) in
guard let logError = Database.logError else { return }
guard let message = message.map({ String(cString: $0) }) else { return }
let resultCode = ResultCode(rawValue: code)
logError(resultCode, message)
}
} else {
registerErrorLogCallback(nil)
}
}
}
/// The database configuration
public let configuration: Configuration
@@ -145,9 +158,6 @@ public final class Database {
// MARK: - Initializer
init(path: String, configuration: Configuration, schemaCache: DatabaseSchemaCache) throws {
// Setup the global SQLite error log before connecting to the database.
Database.setupGlobalErrorLog()
let sqliteConnection = try Database.openConnection(path: path, flags: configuration.SQLiteOpenFlags)
do {
try Database.activateExtendedCodes(sqliteConnection)
@@ -179,26 +189,6 @@ extension Database {
// MARK: - Database Opening
/// Registers the public Database.logError function as the global SQLite
/// error log, with sqlite3_config(SQLITE_CONFIG_LOG).
///
/// See https://sqlite.org/c3ref/c_config_covering_index_scan.html#sqliteconfiglog
private static func setupGlobalErrorLog() {
// We use a Swift static variable as a way to ensure that the error log
// is registered once and only once.
struct Impl {
static let setupErrorLog: () = {
registerErrorLogCallback { (_, code, message) in
guard let log = Database.logError else { return }
guard let message = message.map({ String(cString: $0) }) else { return }
let resultCode = ResultCode(rawValue: code)
log(resultCode, message)
}
}()
}
Impl.setupErrorLog
}
private static func openConnection(path: String, flags: Int32) throws -> SQLiteConnection {
// See https://www.sqlite.org/c3ref/open.html
var sqliteConnection: SQLiteConnection? = nil
+25 -10
View File
@@ -44,14 +44,11 @@ public final class DatabasePool {
public init(path: String, configuration: Configuration = Configuration()) throws {
GRDBPrecondition(configuration.maximumReaderCount > 0, "configuration.maximumReaderCount must be at least 1")
// Writer and readers share the same database schema cache
let sharedSchemaCache = SharedDatabaseSchemaCache()
// Writer
writer = try SerializedDatabase(
path: path,
configuration: configuration,
schemaCache: sharedSchemaCache)
schemaCache: SimpleDatabaseSchemaCache())
// Activate WAL Mode unless readonly
if !configuration.readonly {
@@ -84,7 +81,7 @@ public final class DatabasePool {
let reader = try SerializedDatabase(
path: path,
configuration: self.readerConfig,
schemaCache: sharedSchemaCache)
schemaCache: SimpleDatabaseSchemaCache())
reader.sync { db in
for function in self.functions {
@@ -250,6 +247,8 @@ extension DatabasePool : DatabaseReader {
// The block isolation comes from the DEFERRED transaction.
// See DatabasePoolTests.testReadMethodIsolationOfBlock().
try db.inTransaction(.deferred) {
// Reset the schema cache before running user code in snapshot isolation
db.schemaCache = SimpleDatabaseSchemaCache()
result = try block(db)
return .commit
}
@@ -287,7 +286,11 @@ extension DatabasePool : DatabaseReader {
public func unsafeRead<T>(_ block: (Database) throws -> T) throws -> T {
GRDBPrecondition(currentReader == nil, "Database methods are not reentrant.")
return try readerPool.get { reader in
try reader.sync(block)
try reader.sync { db in
// No schema cache when snapshot isolation is not established
db.schemaCache = EmptyDatabaseSchemaCache()
return try block(db)
}
}
}
@@ -323,7 +326,11 @@ extension DatabasePool : DatabaseReader {
return try reader.reentrantSync(block)
} else {
return try readerPool.get { reader in
try reader.sync(block)
try reader.sync { db in
// No schema cache when snapshot isolation is not established
db.schemaCache = EmptyDatabaseSchemaCache()
return try block(db)
}
}
}
}
@@ -504,7 +511,8 @@ extension DatabasePool : DatabaseWriter {
/// Asynchronously executes a read-only block in a protected dispatch queue,
/// wrapped in a deferred transaction.
///
/// This method must be called from the writing dispatch queue.
/// This method must be called from the writing dispatch queue, outside of a
/// transaction. You'll get a fatal error otherwise.
///
/// The *block* argument is guaranteed to see the database in the last
/// committed state at the moment this method is called. Eventual concurrent
@@ -570,8 +578,11 @@ extension DatabasePool : DatabaseWriter {
// UPDATE ...
// Here the change is not visible by GRDB user
// This method must be called from the writing dispatch queue:
writer.preconditionValidQueue()
// Check that we're on the writer queue...
writer.execute { db in
// ... and that no transaction is opened.
GRDBPrecondition(!db.isInsideTransaction, "readFromCurrentState must not be called from inside a transaction.")
}
// The semaphore that blocks the writing dispatch queue until snapshot
// isolation has been established:
@@ -590,7 +601,11 @@ extension DatabasePool : DatabaseWriter {
return
}
semaphore.signal() // We can release the writer queue now that we are isolated for good
// Reset the schema cache before running user code in snapshot isolation
db.schemaCache = SimpleDatabaseSchemaCache()
block(db)
_ = try? db.commit() // Ignore commit error
}
}
+20 -12
View File
@@ -296,20 +296,28 @@ extension DatabaseQueue : DatabaseWriter {
/// SQLCipher, attempts to write in the database throw a DatabaseError whose
/// resultCode is `SQLITE_READONLY`.
///
/// This method must be called from the protected database dispatch queue.
/// This method must be called from the protected database dispatch queue,
/// outside of a transaction. You'll get a fatal error otherwise.
///
/// See `DatabaseWriter.readFromCurrentState`.
public func readFromCurrentState(_ block: @escaping (Database) -> Void) {
// query_only pragma was added in SQLite 3.8.0 http://www.sqlite.org/changes.html#version_3_8_0
// It is available from iOS 8.2 and OS X 10.10 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
serializedDatabase.execute { readOnly($0, block) }
#else
if #available(iOS 8.2, OSX 10.10, *) {
serializedDatabase.execute { readOnly($0, block) }
} else {
serializedDatabase.execute(block)
}
#endif
// Check that we're on the correct queue...
serializedDatabase.execute { db in
// ... and that no transaction is opened.
GRDBPrecondition(!db.isInsideTransaction, "readFromCurrentState must not be called from inside a transaction.")
// query_only pragma was added in SQLite 3.8.0 http://www.sqlite.org/changes.html#version_3_8_0
// It is available from iOS 8.2 and OS X 10.10 https://github.com/yapstudios/YapDatabase/wiki/SQLite-version-(bundled-with-OS)
#if GRDBCUSTOMSQLITE || GRDBCIPHER
readOnly(db, block)
#else
if #available(iOS 8.2, OSX 10.10, *) {
readOnly(db, block)
} else {
block(db)
}
#endif
}
}
/// Synchronously executes a block in a protected dispatch queue, and
+18 -47
View File
@@ -1,9 +1,4 @@
/// The protocol for schema cache.
///
/// This protocol must not contain values that are valid for a single connection
/// only, because several connections can share the same schema cache.
///
/// Statements can't be cached here, for example.
/// The protocol for database schema cache.
protocol DatabaseSchemaCache {
mutating func clear()
@@ -21,13 +16,13 @@ protocol DatabaseSchemaCache {
}
/// A thread-unsafe database schema cache
final class SimpleDatabaseSchemaCache: DatabaseSchemaCache {
struct SimpleDatabaseSchemaCache: DatabaseSchemaCache {
private var primaryKeys: [String: PrimaryKeyInfo] = [:]
private var columns: [String: [ColumnInfo]] = [:]
private var indexes: [String: [IndexInfo]] = [:]
private var foreignKeys: [String: [ForeignKeyInfo]] = [:]
func clear() {
mutating func clear() {
primaryKeys = [:]
columns = [:]
indexes = [:]
@@ -38,7 +33,7 @@ final class SimpleDatabaseSchemaCache: DatabaseSchemaCache {
return primaryKeys[table]
}
func set(primaryKey: PrimaryKeyInfo, forTable table: String) {
mutating func set(primaryKey: PrimaryKeyInfo, forTable table: String) {
primaryKeys[table] = primaryKey
}
@@ -46,7 +41,7 @@ final class SimpleDatabaseSchemaCache: DatabaseSchemaCache {
return columns[table]
}
func set(columns: [ColumnInfo], forTable table: String) {
mutating func set(columns: [ColumnInfo], forTable table: String) {
self.columns[table] = columns
}
@@ -54,7 +49,7 @@ final class SimpleDatabaseSchemaCache: DatabaseSchemaCache {
return indexes[table]
}
func set(indexes: [IndexInfo], forTable table: String) {
mutating func set(indexes: [IndexInfo], forTable table: String) {
self.indexes[table] = indexes
}
@@ -62,48 +57,24 @@ final class SimpleDatabaseSchemaCache: DatabaseSchemaCache {
return foreignKeys[table]
}
func set(foreignKeys: [ForeignKeyInfo], forTable table: String) {
mutating func set(foreignKeys: [ForeignKeyInfo], forTable table: String) {
self.foreignKeys[table] = foreignKeys
}
}
/// A thread-safe database schema cache
final class SharedDatabaseSchemaCache: DatabaseSchemaCache {
private let cache = ReadWriteBox(SimpleDatabaseSchemaCache())
/// An always empty database schema cache
struct EmptyDatabaseSchemaCache: DatabaseSchemaCache {
func clear() { }
func clear() {
cache.write { $0.clear() }
}
func primaryKey(_ table: String) -> PrimaryKeyInfo? { return nil }
mutating func set(primaryKey: PrimaryKeyInfo, forTable table: String) { }
func primaryKey(_ table: String) -> PrimaryKeyInfo? {
return cache.read { $0.primaryKey(table) }
}
func columns(in table: String) -> [ColumnInfo]? { return nil }
mutating func set(columns: [ColumnInfo], forTable table: String) { }
func set(primaryKey: PrimaryKeyInfo, forTable table: String) {
cache.write { $0.set(primaryKey: primaryKey, forTable: table) }
}
func indexes(on table: String) -> [IndexInfo]? { return nil }
mutating func set(indexes: [IndexInfo], forTable table: String) { }
func columns(in table: String) -> [ColumnInfo]? {
return cache.read { $0.columns(in: table) }
}
func set(columns: [ColumnInfo], forTable table: String) {
cache.write { $0.set(columns: columns, forTable: table) }
}
func indexes(on table: String) -> [IndexInfo]? {
return cache.read { $0.indexes(on: table) }
}
func set(indexes: [IndexInfo], forTable table: String) {
cache.write { $0.set(indexes: indexes, forTable: table) }
}
func foreignKeys(on table: String) -> [ForeignKeyInfo]? {
return cache.read { $0.foreignKeys(on: table) }
}
func set(foreignKeys: [ForeignKeyInfo], forTable table: String) {
cache.write { $0.set(foreignKeys: foreignKeys, forTable: table) }
}
func foreignKeys(on table: String) -> [ForeignKeyInfo]? { return nil }
mutating func set(foreignKeys: [ForeignKeyInfo], forTable table: String) { }
}
+12 -54
View File
@@ -41,65 +41,23 @@ public protocol DatabaseWriter : DatabaseReader {
/// Synchronously or asynchronously executes a read-only block that takes a
/// database connection.
///
/// This method must be called from a writing dispatch queue.
/// This method must be called from a writing dispatch queue, outside of any
/// transaction. You'll get a fatal error otherwise.
///
/// The *block* argument is guaranteed to see the database in the state it
/// has at the moment this method is called (see below). Eventual concurrent
/// The *block* argument is guaranteed to see the database in the last
/// committed state at the moment this method is called. Eventual concurrent
/// database updates are *not visible* inside the block.
///
/// What is the "current state" of the database?
/// For example:
///
/// - When this method is called outside of any transaction, the current
/// state is the last committed state.
///
/// try writer.write { db in
/// try db.execute("DELETE FROM players")
/// try writer.readFromCurrentState { db in
/// // Guaranteed to be zero
/// try Int.fetchOne(db, "SELECT COUNT(*) FROM players")!
/// }
/// try db.execute("INSERT INTO players ...")
/// try writer.write { db in
/// try db.execute("DELETE FROM players")
/// try writer.readFromCurrentState { db in
/// // Guaranteed to be zero
/// try Int.fetchOne(db, "SELECT COUNT(*) FROM players")!
/// }
///
/// - When this method is called inside an uncommitted transation, the
/// current state depends on the caller:
///
/// DatabasePool.readFromCurrentState runs *block* asynchronously in a
/// concurrent reader dispatch queue, and release the writing dispatch
/// queue early, before the block has finished. In the example below,
/// the insertion runs concurrently with the select, and the select sees
/// the database in its last committed state.
///
/// try dbPool.write { db in
/// try db.execute("DELETE FROM players")
/// db.inTransaction {
/// try db.execute("INSERT INTO players ...")
/// try dbPool.readFromCurrentState { db in
/// // Zero
/// try Int.fetchOne(db, "SELECT COUNT(*) FROM players")!
/// }
/// return .commit
/// }
/// }
///
/// DatabaseQueue.readFromCurrentState simply runs *block* synchronously,
/// and returns when the block has completed. In the example below, the
/// select sees the uncommitted state of the database, and the insertion
/// is run after the select.
///
/// try dbQueue.write { db in
/// try db.execute("DELETE FROM players")
/// db.inTransaction {
/// try db.execute("INSERT INTO players ...")
/// try dbQueue.readFromCurrentState { db in
/// // One
/// try Int.fetchOne(db, "SELECT COUNT(*) FROM players")!
/// }
/// return .commit
/// }
/// }
///
/// This method is *not* reentrant.
/// try db.execute("INSERT INTO players ...")
/// }
func readFromCurrentState(_ block: @escaping (Database) -> Void) throws
}
+71 -15
View File
@@ -8,20 +8,13 @@ import Foundation
/// A raw SQLite statement, suitable for the SQLite C API.
public typealias SQLiteStatement = OpaquePointer
/// Statements are separated by semicolons and white spaces
let statementSeparatorCharacterSet = CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines)
/// An error emitted when one tries to compile an empty statement.
struct EmptyStatementError : Error {
}
/// A common protocol for UpdateStatement and SelectStatement
protocol AuthorizedStatement {
init(
database: Database,
statementStart: UnsafePointer<Int8>,
statementEnd: UnsafeMutablePointer<UnsafePointer<Int8>?>,
prepFlags: Int32,
authorizer: StatementCompilationAuthorizer) throws
}
/// A statement represents an SQL query.
///
/// It is the base class of UpdateStatement that executes *update statements*,
@@ -35,10 +28,9 @@ public class Statement {
public var sql: String {
// trim white space and semicolumn for homogeneous output
return String(cString: sqlite3_sql(sqliteStatement))
.trimmingCharacters(in: CharacterSet(charactersIn: ";").union(.whitespacesAndNewlines))
.trimmingCharacters(in: statementSeparatorCharacterSet)
}
/// The database
unowned let database: Database
/// Creates a prepared statement.
@@ -73,9 +65,6 @@ public class Statement {
}
guard let statement = sqliteStatement else {
// Sanity check: verify that the string contains only whitespace
assert(String(data: Data(bytesNoCopy: UnsafeMutableRawPointer(mutating: statementStart), count: statementEnd.pointee! - statementStart, deallocator: .none), encoding: .utf8)!.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
// I wish we could simply return nil, and make this initializer failable.
//
// Unfortunately, there is a Swift bug with failable+throwing initializers:
@@ -223,6 +212,73 @@ public class Statement {
}
}
// MARK: - AuthorizedStatement
/// A common protocol for UpdateStatement and SelectStatement
protocol AuthorizedStatement {
// This initializer should be a required initializer of Statement.
//
// But Swift requires this required initializer to be public:
// https://bugs.swift.org/browse/SR-2347
//
// We work around SR-2347 with this internal protocol.
init(
database: Database,
statementStart: UnsafePointer<Int8>,
statementEnd: UnsafeMutablePointer<UnsafePointer<Int8>?>,
prepFlags: Int32,
authorizer: StatementCompilationAuthorizer) throws
}
extension AuthorizedStatement {
// Static function instead of an initializer because initializer doesn't
// compile due to the "capturing of an uninitialized self" in
// `sqlCodeUnits.withUnsafeBufferPointer`.
static func prepare(sql: String, prepFlags: Int32, in database: Database) throws -> Self {
let authorizer = StatementCompilationAuthorizer()
database.authorizer = authorizer
defer { database.authorizer = nil }
let sqlCodeUnits = sql.utf8CString
return try sqlCodeUnits.withUnsafeBufferPointer { codeUnits in
let statementStart = UnsafePointer<Int8>(codeUnits.baseAddress)!
var statementEnd: UnsafePointer<Int8>? = nil
let statement: Self
do {
statement = try self.init(
database: database,
statementStart: statementStart,
statementEnd: &statementEnd,
prepFlags: prepFlags,
authorizer: authorizer)
} catch is EmptyStatementError {
throw DatabaseError(
resultCode: .SQLITE_ERROR,
message: "empty statement",
sql: sql,
arguments: nil)
}
let remainingData = Data(
bytesNoCopy: UnsafeMutableRawPointer(mutating: statementEnd!),
count: statementStart + sqlCodeUnits.count - statementEnd! - 1,
deallocator: .none)
let remainingSQL = String(data: remainingData, encoding: .utf8)!
.trimmingCharacters(in: statementSeparatorCharacterSet)
guard remainingSQL.isEmpty else {
throw DatabaseError(
resultCode: .SQLITE_MISUSE,
message: "Multiple statements found. To execute multiple statements, use Database.execute() instead.",
sql: sql,
arguments: nil)
}
return statement
}
}
}
// MARK: - SelectStatement
+16 -4
View File
@@ -111,16 +111,16 @@ public struct FTS4 : VirtualTableModule {
let oldRowID = "old.\(rowIDColumn.quotedDatabaseIdentifier)"
try db.execute("""
CREATE TRIGGER \("__\(contentTable)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_bu".quotedDatabaseIdentifier) BEFORE UPDATE ON \(content) BEGIN
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
END;
CREATE TRIGGER \("__\(contentTable)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_bd".quotedDatabaseIdentifier) BEFORE DELETE ON \(content) BEGIN
DELETE FROM \(ftsTable) WHERE docid=\(oldRowID);
END;
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES(\(newContentColumns));
END;
""")
@@ -313,3 +313,15 @@ public final class FTS4ColumnDefinition {
return self
}
}
extension Database {
/// Deletes the synchronization triggers for a synchronized FTS4 table
public func dropFTS4SynchronizationTriggers(forTable tableName: String) throws {
try execute("""
DROP TRIGGER IF EXISTS \("__\(tableName)_bu".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_bd".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
""")
}
}
+14 -3
View File
@@ -111,13 +111,13 @@
.joined(separator: ", ")
try db.execute("""
CREATE TRIGGER \("__\(contentTable)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ai".quotedDatabaseIdentifier) AFTER INSERT ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_ad".quotedDatabaseIdentifier) AFTER DELETE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
END;
CREATE TRIGGER \("__\(contentTable)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
CREATE TRIGGER \("__\(tableName)_au".quotedDatabaseIdentifier) AFTER UPDATE ON \(content) BEGIN
INSERT INTO \(ftsTable)(\(ftsTable), \(ftsColumns)) VALUES('delete', \(oldContentColumns));
INSERT INTO \(ftsTable)(\(ftsColumns)) VALUES (\(newContentColumns));
END;
@@ -319,4 +319,15 @@
/// The FTS5 rank column
public static let rank = Column("rank")
}
extension Database {
/// Deletes the synchronization triggers for a synchronized FTS5 table
public func dropFTS5SynchronizationTriggers(forTable tableName: String) throws {
try execute("""
DROP TRIGGER IF EXISTS \("__\(tableName)_ai".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_ad".quotedDatabaseIdentifier);
DROP TRIGGER IF EXISTS \("__\(tableName)_au".quotedDatabaseIdentifier);
""")
}
}
#endif
+1 -1
View File
@@ -495,7 +495,7 @@ public final class TableAlteration {
/// - returns: An ColumnDefinition that allows you to refine the
/// column definition.
@discardableResult
public func add(column name: String, _ type: Database.ColumnType) -> ColumnDefinition {
public func add(column name: String, _ type: Database.ColumnType? = nil) -> ColumnDefinition {
let column = ColumnDefinition(name: name, type: type)
addedColumns.append(column)
return column
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'GRDBCipher'
s.version = '2.3.1'
s.version = '2.4.2'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.summary = 'A Swift application toolkit for SQLite databases.'
+3091
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBCipher.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -17,7 +17,35 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
BuildableName = "GRDBCipherOSXTests.xctest"
BlueprintName = "GRDBCipherOSXTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "567156191CB16729007DC145"
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
BlueprintName = "GRDBCipherOSXEncryptedTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +64,7 @@
BlueprintIdentifier = "560FC55D1CB00B880014AA8E"
BuildableName = "GRDBCipherOSXTests.xctest"
BlueprintName = "GRDBCipherOSXTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
@@ -45,7 +74,7 @@
BlueprintIdentifier = "567156191CB16729007DC145"
BuildableName = "GRDBCipherOSXEncryptedTests.xctest"
BlueprintName = "GRDBCipherOSXEncryptedTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -55,7 +84,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -65,6 +94,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -77,7 +107,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -95,7 +125,7 @@
BlueprintIdentifier = "560FC5191CB003810014AA8E"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipherOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0900"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -17,7 +17,35 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
BlueprintName = "GRDBCipheriOSEncryptedTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
BuildableName = "GRDBCipheriOSTests.xctest"
BlueprintName = "GRDBCipheriOSTests"
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +64,7 @@
BlueprintIdentifier = "56AFCA2B1CB1AA9900F48B96"
BuildableName = "GRDBCipheriOSTests.xctest"
BlueprintName = "GRDBCipheriOSTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
@@ -45,7 +74,7 @@
BlueprintIdentifier = "56AFCA841CB1ABC800F48B96"
BuildableName = "GRDBCipheriOSEncryptedTests.xctest"
BlueprintName = "GRDBCipheriOSEncryptedTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -55,7 +84,7 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -65,6 +94,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -77,7 +107,7 @@
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCipher.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -89,15 +119,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "56AFC9EE1CB1A8BB00F48B96"
BuildableName = "GRDBCipher.framework"
BlueprintName = "GRDBCipheriOS"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
+2446
View File
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:GRDBCustom.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>
@@ -17,7 +17,21 @@
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
BlueprintName = "GRDBCustomSQLiteOSXTests"
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -26,6 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@@ -35,7 +50,7 @@
BlueprintIdentifier = "F3BA809A1CFB2F6F003DC1BA"
BuildableName = "GRDBCustomSQLiteOSXTests.xctest"
BlueprintName = "GRDBCustomSQLiteOSXTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -45,7 +60,7 @@
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -55,21 +70,13 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
@@ -79,15 +86,6 @@
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80591CFB2BB2003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteOSX"
ReferencedContainer = "container:GRDB.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
@@ -17,7 +17,21 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
BlueprintName = "GRDBCustomSQLiteiOSTests"
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
@@ -36,7 +50,7 @@
BlueprintIdentifier = "F3BA80401CFB2AD7003DC1BA"
BuildableName = "GRDBCustomSQLiteiOSTests.xctest"
BlueprintName = "GRDBCustomSQLiteiOSTests"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
@@ -46,7 +60,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -69,7 +83,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
@@ -87,7 +101,7 @@
BlueprintIdentifier = "F3BA7FFD1CFB25E4003DC1BA"
BuildableName = "GRDBCustomSQLite.framework"
BlueprintName = "GRDBCustomSQLiteiOS"
ReferencedContainer = "container:GRDB.xcodeproj">
ReferencedContainer = "container:GRDBCustom.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
+29
View File
@@ -0,0 +1,29 @@
> ℹ We use Github issues for bug reports, feature requests, general support, and questions about the library.
>
> Please fill out this template when filing an issue, and remove this header before submitting.
## What did you do?
> Please replace this with what you did.
## What did you expect to happen?
> Please replace this with what you expected to happen.
## What happened instead?
> Please replace this with of what happened instead.
## Environment
**GRDB flavor(s):** (GRDB, GRDBCipher, GRDBCustom?)
**GRDB version:**
**Installation method:** (CocoaPods, SPM, manual?)
**Xcode version:**
**Swift version:**
**Platform(s) running GRDB:** (iOS, macOS, watchOS?)
**macOS version running Xcode:**
## Demo Project
> Please link to or upload a project we can download that reproduces the issue.
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (C) 2017 Gwendal Roué
Copyright (C) 2018 Gwendal Roué
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+12 -11
View File
@@ -130,7 +130,7 @@ test_framework_GRDBiOS_minTarget:
test_framework_GRDBCustomSQLiteOSX: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteOSX \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -139,7 +139,7 @@ test_framework_GRDBCustomSQLiteiOS: test_framework_GRDBCustomSQLiteiOS_maxTarget
test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MAX_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -147,7 +147,7 @@ test_framework_GRDBCustomSQLiteiOS_maxTarget: SQLiteCustom
test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCustom.xcodeproj \
-scheme GRDBCustomSQLiteiOS \
-destination $(MIN_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -155,7 +155,7 @@ test_framework_GRDBCustomSQLiteiOS_minTarget: SQLiteCustom
test_framework_GRDBCipherOSX: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipherOSX \
$(TEST_ACTIONS) \
$(XCPRETTY)
@@ -164,7 +164,7 @@ test_framework_GRDBCipheriOS: test_framework_GRDBCipheriOS_maxTarget test_framew
test_framework_GRDBCipheriOS_maxTarget: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MAX_IOS_DESTINATION) \
$(TEST_ACTIONS) \
@@ -172,13 +172,14 @@ test_framework_GRDBCipheriOS_maxTarget: SQLCipher
test_framework_GRDBCipheriOS_minTarget: SQLCipher
$(XCODEBUILD) \
-project GRDB.xcodeproj \
-project GRDBCipher.xcodeproj \
-scheme GRDBCipheriOS \
-destination $(MIN_IOS_DESTINATION) \
$(TEST_ACTIONS) \
$(XCPRETTY)
test_SPM:
# Add sanitizers when available: https://twitter.com/simjp/status/929140877540278272
$(SWIFT) package clean
$(SWIFT) build
$(SWIFT) build -c release
@@ -243,10 +244,10 @@ test_performance: Realm FMDB SQLite.swift
-scheme GRDBOSXPerformanceComparisonTests \
build-for-testing test-without-building
Realm: Tests/Performance/Realm/build/osx/swift-4.0/RealmSwift.framework
Realm: Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework
# Makes sure the Tests/Performance/Realm submodule has been downloaded, and Realm framework has been built.
Tests/Performance/Realm/build/osx/swift-4.0/RealmSwift.framework:
Tests/Performance/Realm/build/osx/swift-4.0.3/RealmSwift.framework:
$(GIT) submodule update --init --recursive Tests/Performance/Realm
cd Tests/Performance/Realm && sh build.sh osx-swift
@@ -295,10 +296,10 @@ ifdef JAZZY
--author 'Gwendal Roué' \
--author_url https://github.com/groue \
--github_url https://github.com/groue/GRDB.swift \
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.3.0 \
--module-version 2.3 \
--github-file-prefix https://github.com/groue/GRDB.swift/tree/v2.4.2 \
--module-version 2.4 \
--module GRDB \
--root-url http://groue.github.io/GRDB.swift/docs/2.3/ \
--root-url http://groue.github.io/GRDB.swift/docs/2.4/ \
--output Documentation/Reference \
--podspec GRDB.swift.podspec
else
+70 -33
View File
@@ -3,7 +3,7 @@ GRDB 2 [![Swift](https://img.shields.io/badge/swift-4-orange.svg?style=flat)](ht
### A toolkit for SQLite databases, with a focus on application development
**Latest release**: November 8, 2017 • version 2.3.1 • [CHANGELOG](CHANGELOG.md)
**Latest release**: January 5, 2018 • version 2.4.2 • [CHANGELOG](CHANGELOG.md)
**Requirements**: iOS 8.0+ / OSX 10.9+ / watchOS 2.0+ &bull; Swift 4.0 / Xcode 9+
@@ -14,7 +14,7 @@ GRDB 2 [![Swift](https://img.shields.io/badge/swift-4-orange.svg?style=flat)](ht
| Swift 3 | [v1.0](https://github.com/groue/GRDB.swift/tree/v1.0) |
| Swift 3.1 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| Swift 3.2 | [v1.3.0](https://github.com/groue/GRDB.swift/tree/v1.3.0) |
| **Swift 4** | **v2.3.1** |
| **Swift 4** | **v2.4.2** |
Follow [@groue](http://twitter.com/groue) on Twitter for release announcements and usage tips.
@@ -197,7 +197,7 @@ Documentation
**Reference**
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.3/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
- [GRDB Reference](http://groue.github.io/GRDB.swift/docs/2.4/index.html) (generated by [Jazzy](https://github.com/realm/jazzy))
**Getting Started**
@@ -265,7 +265,7 @@ The [Swift Package Manager](https://swift.org/package-manager/) automates the di
```swift
let package = Package(
dependencies: [
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.3.1")
.package(url: "https://github.com/groue/GRDB.swift.git", from: "2.4.2")
]
)
```
@@ -282,7 +282,7 @@ If you decide to use Carthage despite this warning, and get any Carthage-related
## Manually
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.3.1) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.3.1` command.
1. [Download](https://github.com/groue/GRDB.swift/releases/tag/v2.4.2) a copy of GRDB, or clone its repository and make sure you use the latest tagged version with the `git checkout v2.4.2` command.
2. Embed the `GRDB.xcodeproj` project in your own project.
@@ -379,7 +379,7 @@ let dbQueue = try DatabaseQueue(
configuration: config)
```
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html) for more details.
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
## Database Pools
@@ -460,7 +460,7 @@ let dbPool = try DatabasePool(
configuration: config)
```
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html) for more details.
See [Configuration](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html) for more details.
Database pools are more memory-hungry than database queues. See [Memory Management](#memory-management) for more information.
@@ -650,7 +650,7 @@ Both arrays and cursors can iterate over database results. How do you choose one
- Cursors can not be used on any thread: you must consume them in a protected database queue.
- Cursors iterate database results in a lazy fashion, and don't consume much memory.
- Cursors can be iterated only one time.
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/StatementColumnConvertible.html) protocol.
- Cursors are granted with direct access to SQLite: you can especially expect the best performance from cursors of raw database rows and some primitive types like `Int`, `String`, or `Bool` that adopt the [StatementColumnConvertible](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/StatementColumnConvertible.html) protocol.
If you don't see, or don't care about the difference, use arrays. If you care about memory and performance, use cursors when appropriate.
@@ -663,7 +663,7 @@ Date.fetchCursor(...) // DatabaseValueCursor<Date>
Player.fetchCursor(...) // RecordCursor<Player>
```
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift. As such, cursors come with many methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
All cursor types adopt the [Cursor](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/Cursor.html) protocol, which looks a lot like standard [lazy sequences](https://developer.apple.com/reference/swift/lazysequenceprotocol) of Swift. As such, cursors come with many methods: `contains`, `enumerated`, `filter`, `first`, `flatMap`, `forEach`, `joined`, `map`, `reduce`:
```swift
// Iterate all Github links
@@ -734,7 +734,7 @@ let rows = try Row.fetchAll(db,
arguments: ["name": "Arthur"])
```
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
See [Values](#values) for more information on supported arguments types (Bool, Int, String, Date, Swift enums, etc.), and [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) for a detailed documentation of SQLite arguments.
Unlike row arrays that contain copies of the database rows, row cursors are close to the SQLite metal, and require a little care:
@@ -1005,7 +1005,7 @@ GRDB ships with built-in support for the following value types:
- Generally speaking, all types that adopt the [DatabaseValueConvertible](#custom-value-types) protocol.
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
Values can be used as [statement arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let url: URL = ...
@@ -1397,7 +1397,7 @@ try dbQueue.inDatabase { db in
}
```
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
The `?` and colon-prefixed keys like `:name` in the SQL query are the statement arguments. You set them with arrays or dictionaries (arguments are actually of type [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html), which happens to adopt the ExpressibleByArrayLiteral and ExpressibleByDictionaryLiteral protocols).
```swift
updateStatement.arguments = ["name": "Arthur", "score": 1000]
@@ -1659,7 +1659,7 @@ row["consumed"] // "Hello"
row["produced"] // nil
```
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
Row adapters are values that adopt the [RowAdapter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/RowAdapter.html) protocol. You can implement your own custom adapters ([**:fire: EXPERIMENTAL**](#what-are-experimental-features)), or use one of the four built-in adapters:
### ColumnMapping
@@ -1786,8 +1786,8 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
- `sqlite3_aggregate_context`, `sqlite3_create_function_v2`, `sqlite3_result_blob`, `sqlite3_result_double`, `sqlite3_result_error`, `sqlite3_result_error_code`, `sqlite3_result_int64`, `sqlite3_result_null`, `sqlite3_result_text`, `sqlite3_user_data`, `sqlite3_value_blob`, `sqlite3_value_bytes`, `sqlite3_value_double`, `sqlite3_value_int64`, `sqlite3_value_text`, `sqlite3_value_type`: see [Custom SQL Functions and Aggregates](#custom-sql-functions-and-aggregates)
- `sqlite3_backup_finish`, `sqlite3_backup_init`, `sqlite3_backup_step`: see [Backup](#backup)
- `sqlite3_bind_blob`, `sqlite3_bind_double`, `sqlite3_bind_int64`, `sqlite3_bind_null`, `sqlite3_bind_parameter_count`, `sqlite3_bind_parameter_name`, `sqlite3_bind_text`, `sqlite3_clear_bindings`, `sqlite3_column_blob`, `sqlite3_column_bytes`, `sqlite3_column_count`, `sqlite3_column_double`, `sqlite3_column_int64`, `sqlite3_column_name`, `sqlite3_column_text`, `sqlite3_column_type`, `sqlite3_exec`, `sqlite3_finalize`, `sqlite3_prepare_v2`, `sqlite3_reset`, `sqlite3_step`: see [Executing Updates](#executing-updates), [Fetch Queries](#fetch-queries), [Prepared Statements](#prepared-statements), [Values](#values)
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.3/Classes/Database.html)
- `sqlite3_busy_handler`, `sqlite3_busy_timeout`: see [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- `sqlite3_changes`, `sqlite3_total_changes`: see [Database.changesCount and Database.totalChangesCount](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Database.html)
- `sqlite3_close`, `sqlite3_close_v2`, `sqlite3_next_stmt`, `sqlite3_open_v2`: see [Database Connections](#database-connections)
- `sqlite3_commit_hook`, `sqlite3_rollback_hook`, `sqlite3_update_hook`: see [TransactionObserver Protocol](#transactionobserver-protocol), [FetchedRecordsController](#fetchedrecordscontroller)
- `sqlite3_config`: see [Error Log](#error-log)
@@ -1798,9 +1798,9 @@ Before jumping in the low-level wagon, here is the list of all SQLite APIs used
- `sqlite3_last_insert_rowid`: see [Executing Updates](#executing-updates)
- `sqlite3_preupdate_count`, `sqlite3_preupdate_depth`, `sqlite3_preupdate_hook`, `sqlite3_preupdate_new`, `sqlite3_preupdate_old`: see [Support for SQLite Pre-Update Hooks](#support-for-sqlite-pre-update-hooks)
- `sqlite3_set_authorizer`: **reserved by GRDB**
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.3/Classes/Statement.html)
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.3/Classes/DatabasePool.html)
- `sqlite3_sql`: see [Statement.sql](http://groue.github.io/GRDB.swift/docs/2.4/Classes/Statement.html)
- `sqlite3_trace`: see [Configuration.trace](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- `sqlite3_wal_checkpoint_v2`: see [DatabasePool.checkpoint](http://groue.github.io/GRDB.swift/docs/2.4/Classes/DatabasePool.html)
Records
@@ -2125,7 +2125,7 @@ try Place.fetchAll(db, "SELECT ...", arguments:...) // [Place]
try Place.fetchOne(db, "SELECT ...", arguments:...) // Place?
```
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) for more information about the query arguments.
See [fetching methods](#fetching-methods) for information about the `fetchCursor`, `fetchAll` and `fetchOne` methods. See [StatementArguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) for more information about the query arguments.
## TableMapping Protocol
@@ -3189,7 +3189,7 @@ Player // SELECT * FROM players
```
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
Raw SQL snippets are also accepted, with eventual [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
// SELECT DATE(creationDate), COUNT(*) FROM players WHERE name = 'Arthur' GROUP BY date(creationDate)
@@ -3658,9 +3658,9 @@ try request.fetchOne(db) // Player?
**To build custom requests**, you can create your own type that adopts the protocols, or derive requests from other requests, or use one of the built-in concrete types:
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/SQLRequest.html): a Request built from raw SQL
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyRequest.html): a type-erased Request
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.3/Structs/AnyTypedRequest.html): a type-erased TypedRequest
- [SQLRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/SQLRequest.html): a Request built from raw SQL
- [AnyRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyRequest.html): a type-erased Request
- [AnyTypedRequest](http://groue.github.io/GRDB.swift/docs/2.4/Structs/AnyTypedRequest.html): a type-erased TypedRequest
Use the `asRequest(of:)` method to define the type fetched by the request:
@@ -4090,7 +4090,7 @@ let pattern = FTS3Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS3Pattern(matchingAnyTokenIn: "*") // nil
```
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
FTS3Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
@@ -4303,7 +4303,7 @@ let pattern = FTS5Pattern(matchingAnyTokenIn: "") // nil
let pattern = FTS5Pattern(matchingAnyTokenIn: "*") // nil
```
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html):
FTS5Pattern are regular [values](#values). You can use them as query [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html):
```swift
let documents = try Document.fetchAll(db,
@@ -4363,13 +4363,49 @@ try db.create(virtualTable: "books_ft", using: FTS4()) { t in // or FTS5()
}
```
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index by the mean of SQL triggers.
The eventual content already present in the regular table is indexed, and every insert, update or delete that happens in the regular table is automatically applied to the full-text index.
For more information, see the SQLite documentation about external content tables: [FTS4](https://www.sqlite.org/fts3.html#_external_content_fts4_tables_), [FTS5](https://sqlite.org/fts5.html#external_content_tables).
See also [WWDC Companion](https://github.com/groue/WWDCCompanion), a sample app that uses external content tables to store, display, and let the user search the WWDC sessions.
#### Deleting Synchronized Full-Text Tables
Synchronization of full-text tables with their content table happens by the mean of SQL triggers.
SQLite automatically deletes those triggers when the content (not full-text) table is dropped.
However, those triggers remain after the full-text table has been dropped. Unless they are dropped too, they will prevent future insertion, updates, and deletions in the content table, and the creation of a new full-text table.
To drop those triggers, use the `dropFTS4SynchronizationTriggers` or `dropFTS5SynchronizationTriggers` methods:
```swift
// Create tables
try db.create(table: "books") { t in
...
}
try db.create(virtualTable: "books_ft", using: FTS4()) { t in
t.synchronize(withTable: "books")
...
}
// Drop full-text table
try db.drop(table: "books_ft")
try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
```
> :warning: **Warning**: there was a bug in GRDB up to version 2.3.1 included, which created triggers with a wrong name. If it is possible that the full-text table was created by an old version of GRDB, then delete the synchronization triggers **twice**: once with the name of the deleted full-text table, and once with the name of the content table:
>
> ```swift
> // Drop full-text table
> try db.drop(table: "books_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "books_ft")
> try db.dropFTS4SynchronizationTriggers(forTable: "books") // Support for GRDB <= 2.3.1
> ```
#### Querying External Content Full-Text Tables
When you need to perform a full-text search, and the external content table contains all the data you need, you can simply query the full-text table.
@@ -5094,11 +5130,11 @@ Alternatively, perform a manual installation of GRDB and SQLCipher:
```sh
cd [GRDB directory]
git checkout v2.3.1
git checkout v2.4.2
git submodule update --init SQLCipher/src
```
2. Embed the `GRDB.xcodeproj` project in your own project.
2. Embed the `GRDBCipher.xcodeproj` project in your own project.
3. Add the `GRDBCipherOSX` or `GRDBCipheriOS` target in the **Target Dependencies** section of the **Build Phases** tab of your application target.
@@ -5201,7 +5237,7 @@ DROP TABLE students;
--' WHERE id = 1
```
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.3/Structs/StatementArguments.html) to your SQL queries:
To avoid those problems, **never embed raw values in your SQL queries**. The only correct technique is to provide [arguments](http://groue.github.io/GRDB.swift/docs/2.4/Structs/StatementArguments.html) to your SQL queries:
```swift
// Good
@@ -5430,7 +5466,7 @@ See [prepared statements](#prepared-statements) and [DatabaseValue](#databaseval
**SQLite can be configured to invoke a callback function containing an error code and a terse error message whenever anomalies occur.**
It is recommended that you setup, early in the lifetime of your application, the error logging callback:
This global error callback must be configured early in the lifetime of your application:
```swift
Database.logError = { (resultCode, message) in
@@ -5438,6 +5474,8 @@ Database.logError = { (resultCode, message) in
}
```
> :warning: **Warning**: Database.logError must be set before any database connection is opened. This includes the connections that your application opens with GRDB, but also connections opened by other tools, such as third-party libraries. Setting it after a connection has been opened is an SQLite misuse, and has no effect.
See [The Error And Warning Log](https://sqlite.org/errlog.html) for more information.
@@ -5780,7 +5818,7 @@ try dbPool.write { db in
### DatabaseWriter and DatabaseReader Protocols
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseWriter.html) protocols.
Both DatabaseQueue and DatabasePool adopt the [DatabaseReader](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseReader.html) and [DatabaseWriter](http://groue.github.io/GRDB.swift/docs/2.4/Protocols/DatabaseWriter.html) protocols.
These protocols provide a unified API that lets you write safe concurrent code that targets both classes.
@@ -5788,7 +5826,6 @@ However, database queues are not database pools, and DatabaseReader and Database
- Pools are less forgiving than queues when one overlooks a transaction (see [concurrency rule 3](#guarantees-and-rules)).
- DatabaseWriter.readFromCurrentState is synchronous, or asynchronous, depending on whether it is run by a queue or a pool (see [advanced DatabasePool](#advanced-databasepool)). It thus requires higher libDispatch skills, and more complex synchronization code.
- The definition of "current state" in DatabaseWriter.readFromCurrentState is [delicate](http://groue.github.io/GRDB.swift/docs/2.3/Protocols/DatabaseWriter.html#/s:FP4GRDB14DatabaseWriter20readFromCurrentStateFzFCS_8DatabaseT_T_).
DatabaseReader and DatabaseWriter are not a tool for applications that hesitate between DatabaseQueue and DatabasePool, and look for a common API. As seen above, the protocols actually make applications harder to write correctly. Instead, they target generic code that has *both* queues and pools in mind. The built-in AnyDatabaseReader and AnyDatabaseWriter type erasers serve the same purpose.
@@ -5875,7 +5912,7 @@ If you absolutely need multiple connections, then:
- Read about [isolation in SQLite](https://www.sqlite.org/isolation.html)
- Learn about [locks and transactions](https://www.sqlite.org/lang_transaction.html)
- Become a master of the [WAL mode](https://www.sqlite.org/wal.html)
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.3/Structs/Configuration.html)
- Prepare to setup a [busy handler](https://www.sqlite.org/c3ref/busy_handler.html) with [Configuration.busyMode](http://groue.github.io/GRDB.swift/docs/2.4/Structs/Configuration.html)
- [Ask questions](https://github.com/groue/GRDB.swift/issues)
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>2.3.1</string>
<string>2.4.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+4 -14
View File
@@ -1,7 +1,5 @@
- [ ] We share the database cache between database pool writers and readers. But what if a writer modifies the database schema within a transaction, and a concurrent reader reads the cache? Bad things, isn't it? Write failing tests first, and fix the bug.
- [ ] Attach databases. Interesting question: what happens when one attaches a non-WAL db to a databasePool?
- [ ] SQLCipher: sqlite3_rekey is discouraged (https://github.com/ccgus/fmdb/issues/547#issuecomment-259219320)
- [ ] What is the behavior inTransaction and inSavepoint behaviors in case of commit error? Code looks like we do not rollback, leaving the app in a weird state (out of Swift transaction block with a SQLite transaction that may still be opened).
- [ ] Query builder
- [ ] SELECT readers.*, books.* FROM ... JOIN ...
- [ ] date functions
@@ -12,16 +10,15 @@
- [ ] REGEXP https://www.sqlite.org/lang_expr.html
- [ ] CASE x WHEN w1 THEN r1 WHEN w2 THEN r2 ELSE r3 END https://www.sqlite.org/lang_expr.html
- [ ] Write regression tests for #156 and #157
- [ ] Truncate optimization: tests for drop temp table, drop view, drop temp view
- [ ] "Documents" and "Application Support" directories: see https://github.com/ccgus/fmdb/commit/7ebbfd055c48d75dfb0119abbd9b5fc2f9001b9f#diff-2f831b88cf9e6758355acd8f88f7d996R16
GRDB 3.0
- [ ] Rename Request to DatabaseRequest, SQLiteRequest, SQLRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
- [ ] Rename Request to FetchRequest, because Request is a bad name: https://github.com/swift-server/http/pull/7#issuecomment-308448528
- [ ] Rename RowConvertible, TableMapping, MutablePersistable and Persistable so that their names contain Record: FetchableRecord, TableRecord, MutablePersistableRecord, PersistableRecord?
- [ ] Not sure: Consider introducing RowDecodable and RowEncodable on top of FetchableRecord and MutablePersistableRecord. This would allow keeping fetching and persistence methods private in some files.
Not sure
- [ ] Support for resource values (see https://developer.apple.com/library/ios/qa/qa1719/_index.html)
- [ ] Think about supporting Cursor's underestimatedCount, which could speed up Array(cursor) and fetchAll()
- [ ] Support for OR ROLLBACK, and mismatch between the Swift depth and the SQLite depth of nested transactions/savepoint:
@@ -63,14 +60,6 @@ Not sure
}
```
- [ ] Support for NSColor/UIColor. Beware UIColor components can go beyond [0, 1.0] in iOS10.
- [ ] Store dates as timestamp (https://twitter.com/gloparco/status/780948021613912064, https://github.com/groue/GRDB.swift/issues/97)
Require changes in the Swift language:
- [ ] Specific and optimized Optional<StatementColumnConvertible>.fetch... methods when http://openradar.appspot.com/22852669 is fixed.
Requires recompilation of SQLite:
@@ -98,3 +87,4 @@ Reading list:
- React oddity: http://stackoverflow.com/questions/41721769/realm-update-object-without-updating-lists
- File protection: https://github.com/ccgus/fmdb/issues/262
- File protection: https://lists.apple.com/archives/cocoa-dev/2012/Aug/msg00527.html
- [iOS apps are terminated every time they enter the background if they share an encrypted database with an app extension](https://github.com/sqlcipher/sqlcipher/issues/255)
@@ -7,147 +7,70 @@
objects = {
/* Begin PBXBuildFile section */
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; };
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56288F7D1FD424A40091310B /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B0372B1E8E31D0003B6DA4 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372A1E8E31D0003B6DA4 /* AppDelegate.swift */; };
56B0372D1E8E31D0003B6DA4 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0372C1E8E31D0003B6DA4 /* ViewController.swift */; };
56B037301E8E31D0003B6DA4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B0372E1E8E31D0003B6DA4 /* Main.storyboard */; };
56B037321E8E31D0003B6DA4 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 56B037311E8E31D0003B6DA4 /* Assets.xcassets */; };
56B037351E8E31D0003B6DA4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 56B037331E8E31D0003B6DA4 /* LaunchScreen.storyboard */; };
56B0373D1E8E3219003B6DA4 /* Database.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0373C1E8E3219003B6DA4 /* Database.swift */; };
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; };
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
56B0377F1E8E32B9003B6DA4 /* Person.swift in Sources */ = {isa = PBXBuildFile; fileRef = 56B0377E1E8E32B9003B6DA4 /* Person.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F761FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = DC3773F319C8CBB3004FCF85;
remoteInfo = GRDBOSX;
};
56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7F91B4D422D00430942;
remoteInfo = GRDBOSXTests;
};
56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560C981A1C0E22D300BF8471;
remoteInfo = GRDBOSXPerformanceTests;
};
56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56553C181C3E906C00522B5C;
remoteInfo = GRDBOSXCrashTests;
};
56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC54D1CB003810014AA8E;
remoteInfo = GRDBCipherOSX;
};
56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F781FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 560FC5B01CB00B880014AA8E;
remoteInfo = GRDBCipherOSXTests;
};
56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7A1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 5671566C1CB16729007DC145;
remoteInfo = GRDBCipherOSXEncryptedTests;
};
56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7C1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA805A1CFB2BB2003DC1BA;
remoteInfo = GRDBCustomSQLiteOSX;
};
56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA809B1CFB2F6F003DC1BA;
remoteInfo = GRDBCustomSQLiteOSXTests;
};
56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7CA1B4D3FED00430942;
remoteInfo = GRDBiOS;
};
56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56E5D7D31B4D3FEE00430942;
remoteInfo = GRDBiOSTests;
};
56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA231CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
};
56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F7E1FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCA7F1CB1AA9900F48B96;
remoteInfo = GRDBCipheriOSTests;
};
56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F801FD424A40091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 56AFCAD71CB1ABC800F48B96;
remoteInfo = GRDBCipheriOSEncryptedTests;
};
56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
56288F821FD424AD0091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA7FFE1CFB25E4003DC1BA;
remoteInfo = GRDBCustomSQLiteiOS;
};
56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = F3BA80411CFB2AD7003DC1BA;
remoteInfo = GRDBCustomSQLiteiOSTests;
};
56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 565490A01D5A4798005622CB;
remoteInfo = GRDBWatchOS;
};
56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
};
56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */ = {
56288F861FD4256C0091310B /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
containerPortal = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 56AFC9EE1CB1A8BB00F48B96;
remoteInfo = GRDBCipheriOS;
@@ -161,7 +84,7 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
56B0377A1E8E328C003B6DA4 /* GRDBCipher.framework in Embed Frameworks */,
56288F851FD4256C0091310B /* GRDBCipher.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -177,7 +100,7 @@
56B037341E8E31D0003B6DA4 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
56B037361E8E31D0003B6DA4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
56B0373C1E8E3219003B6DA4 /* Database.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Database.swift; sourceTree = "<group>"; };
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDB.xcodeproj; path = ../../../GRDB.xcodeproj; sourceTree = "<group>"; };
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = GRDBCipher.xcodeproj; path = ../../../GRDBCipher.xcodeproj; sourceTree = "<group>"; };
56B0377E1E8E32B9003B6DA4 /* Person.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Person.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -186,17 +109,30 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
56B037791E8E328C003B6DA4 /* GRDBCipher.framework in Frameworks */,
56288F841FD4256C0091310B /* GRDBCipher.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
56288F6E1FD424A40091310B /* Products */ = {
isa = PBXGroup;
children = (
56288F771FD424A40091310B /* GRDBCipher.framework */,
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */,
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */,
56288F7D1FD424A40091310B /* GRDBCipher.framework */,
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */,
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
56B0371E1E8E31D0003B6DA4 = {
isa = PBXGroup;
children = (
56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */,
56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */,
56B037291E8E31D0003B6DA4 /* GRDBiOS */,
56B037281E8E31D0003B6DA4 /* Products */,
);
@@ -225,30 +161,6 @@
path = GRDBiOS;
sourceTree = "<group>";
};
56B0373F1E8E3250003B6DA4 /* Products */ = {
isa = PBXGroup;
children = (
56B037561E8E3250003B6DA4 /* GRDB.framework */,
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */,
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */,
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */,
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */,
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */,
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */,
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */,
56B037681E8E3250003B6DA4 /* GRDB.framework */,
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */,
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */,
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */,
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */,
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */,
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */,
56B037761E8E3250003B6DA4 /* GRDB.framework */,
);
name = Products;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -264,8 +176,8 @@
buildRules = (
);
dependencies = (
56B037781E8E3263003B6DA4 /* PBXTargetDependency */,
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */,
56288F831FD424AD0091310B /* PBXTargetDependency */,
56288F871FD4256C0091310B /* PBXTargetDependency */,
);
name = GRDBiOS;
productName = GRDBiOS;
@@ -279,7 +191,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0830;
LastUpgradeCheck = 0830;
LastUpgradeCheck = 0910;
ORGANIZATIONNAME = "Gwendal Roué";
TargetAttributes = {
56B037261E8E31D0003B6DA4 = {
@@ -302,8 +214,8 @@
projectDirPath = "";
projectReferences = (
{
ProductGroup = 56B0373F1E8E3250003B6DA4 /* Products */;
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDB.xcodeproj */;
ProductGroup = 56288F6E1FD424A40091310B /* Products */;
ProjectRef = 56B0373E1E8E3250003B6DA4 /* GRDBCipher.xcodeproj */;
},
);
projectRoot = "";
@@ -314,123 +226,46 @@
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
56B037561E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037551E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037581E8E3250003B6DA4 /* GRDBOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXTests.xctest;
remoteRef = 56B037571E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375A1E8E3250003B6DA4 /* GRDBOSXPerformanceTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXPerformanceTests.xctest;
remoteRef = 56B037591E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375C1E8E3250003B6DA4 /* GRDBOSXCrashTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBOSXCrashTests.xctest;
remoteRef = 56B0375B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0375E1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
56288F771FD424A40091310B /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B0375D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F761FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037601E8E3250003B6DA4 /* GRDBCipherOSXTests.xctest */ = {
56288F791FD424A40091310B /* GRDBCipherOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXTests.xctest;
remoteRef = 56B0375F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F781FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037621E8E3250003B6DA4 /* GRDBCipherOSXEncryptedTests.xctest */ = {
56288F7B1FD424A40091310B /* GRDBCipherOSXEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipherOSXEncryptedTests.xctest;
remoteRef = 56B037611E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7A1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037641E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B037631E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037661E8E3250003B6DA4 /* GRDBCustomSQLiteOSXTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteOSXTests.xctest;
remoteRef = 56B037651E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037681E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037671E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376A1E8E3250003B6DA4 /* GRDBiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBiOSTests.xctest;
remoteRef = 56B037691E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376C1E8E3250003B6DA4 /* GRDBCipher.framework */ = {
56288F7D1FD424A40091310B /* GRDBCipher.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCipher.framework;
remoteRef = 56B0376B1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7C1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B0376E1E8E3250003B6DA4 /* GRDBCipheriOSTests.xctest */ = {
56288F7F1FD424A40091310B /* GRDBCipheriOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSTests.xctest;
remoteRef = 56B0376D1E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F7E1FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037701E8E3250003B6DA4 /* GRDBCipheriOSEncryptedTests.xctest */ = {
56288F811FD424A40091310B /* GRDBCipheriOSEncryptedTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCipheriOSEncryptedTests.xctest;
remoteRef = 56B0376F1E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037721E8E3250003B6DA4 /* GRDBCustomSQLite.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDBCustomSQLite.framework;
remoteRef = 56B037711E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037741E8E3250003B6DA4 /* GRDBCustomSQLiteiOSTests.xctest */ = {
isa = PBXReferenceProxy;
fileType = wrapper.cfbundle;
path = GRDBCustomSQLiteiOSTests.xctest;
remoteRef = 56B037731E8E3250003B6DA4 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
56B037761E8E3250003B6DA4 /* GRDB.framework */ = {
isa = PBXReferenceProxy;
fileType = wrapper.framework;
path = GRDB.framework;
remoteRef = 56B037751E8E3250003B6DA4 /* PBXContainerItemProxy */;
remoteRef = 56288F801FD424A40091310B /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
@@ -463,15 +298,15 @@
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
56B037781E8E3263003B6DA4 /* PBXTargetDependency */ = {
56288F831FD424AD0091310B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBCipheriOS;
targetProxy = 56B037771E8E3263003B6DA4 /* PBXContainerItemProxy */;
targetProxy = 56288F821FD424AD0091310B /* PBXContainerItemProxy */;
};
56B0377C1E8E328C003B6DA4 /* PBXTargetDependency */ = {
56288F871FD4256C0091310B /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = GRDBCipheriOS;
targetProxy = 56B0377B1E8E328C003B6DA4 /* PBXContainerItemProxy */;
targetProxy = 56288F861FD4256C0091310B /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
@@ -505,7 +340,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -513,7 +350,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -536,7 +377,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -555,7 +396,9 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
@@ -563,7 +406,11 @@
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
@@ -580,7 +427,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 11.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
@@ -598,7 +445,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
@@ -612,7 +459,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.github.groue.GRDBiOS;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_VERSION = 4.0;
};
name = Release;
};
@@ -635,6 +482,7 @@
56B0373B1E8E31D0003B6DA4 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0830"
LastUpgradeVersion = "0910"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
@@ -45,6 +46,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
@@ -10,23 +10,11 @@ import XCTest
class DatabaseLogErrorTests: GRDBTestCase {
func testErrorLog() throws {
// Remember current log function
let currentLogError = Database.logError
var lastResultCode: ResultCode? = nil
var lastMessage: String? = nil
Database.logError = { (resultCode, message) in
lastResultCode = resultCode
lastMessage = message
}
let dbQueue = try makeDatabaseQueue()
dbQueue.inDatabase { db in
_ = try? db.execute("That's not SQL.")
}
XCTAssertEqual(lastResultCode!, ResultCode.SQLITE_ERROR)
XCTAssertEqual(lastMessage!, "near \"That\": syntax error")
// Restore current log function
Database.logError = currentLogError
}
}
@@ -33,28 +33,9 @@ class DatabasePoolSchemaCacheTests : GRDBTestCase {
try dbPool.read { db in
// Warm cache in a reader
let primaryKey = try db.primaryKey("items")
XCTAssertEqual(primaryKey.rowIDColumn, "id")
let columns = try db.columns(in: "items")
XCTAssertEqual(columns.count, 4)
XCTAssertEqual(columns[0].name, "id")
XCTAssertEqual(columns[1].name, "email")
XCTAssertEqual(columns[2].name, "foo")
XCTAssertEqual(columns[3].name, "bar")
let indexes = try db.indexes(on: "items")
XCTAssertEqual(indexes.count, 2)
for index in indexes {
switch index.name {
case "foobar":
XCTAssertEqual(index.columns, ["foo", "bar"])
XCTAssertFalse(index.isUnique)
default:
XCTAssertEqual(index.columns, ["email"])
XCTAssertTrue(index.isUnique)
}
}
_ = try db.primaryKey("items")
_ = try db.columns(in: "items")
_ = try db.indexes(on: "items")
// Assert that reader cache is warmed
XCTAssertTrue(db.schemaCache.primaryKey("items") != nil)
@@ -62,7 +43,12 @@ class DatabasePoolSchemaCacheTests : GRDBTestCase {
XCTAssertTrue(db.schemaCache.indexes(on: "items") != nil)
}
dbPool.write { db in
try dbPool.write { db in
// Warm cache in the writer
_ = try db.primaryKey("items")
_ = try db.columns(in: "items")
_ = try db.indexes(on: "items")
// Assert that writer cache is warmed
XCTAssertTrue(db.schemaCache.primaryKey("items") != nil)
XCTAssertTrue(db.schemaCache.columns(in: "items") != nil)
@@ -137,4 +123,95 @@ class DatabasePoolSchemaCacheTests : GRDBTestCase {
blocks[index]()
}
}
func testCacheSnapshotIsolation() throws {
// This test checks that the schema cache follows snapshot isolation.
// and that writer and readers do not naively share the same cache.
dbConfiguration.trace = { print($0) }
let dbPool = try makeDatabasePool()
// writer reader
// CREATE TABLE foo
// table exists: true
// >
let s1 = DispatchSemaphore(value: 0)
// table exists: true
// <
let s2 = DispatchSemaphore(value: 0)
// DROP TABLE foo
// table exists: false
// >
let s3 = DispatchSemaphore(value: 0)
// table exists: true
// <
let s4 = DispatchSemaphore(value: 0)
// table exists: false
let block1 = { () in
try! dbPool.write { db in
try db.execute("CREATE TABLE foo(id INTEGER PRIMARY KEY)")
// warm cache
_ = try db.primaryKey("foo")
// cache contains the primary key
XCTAssertNotNil(db.schemaCache.primaryKey("foo"))
s1.signal()
_ = s2.wait(timeout: .distantFuture)
try db.execute("DROP TABLE foo")
// cache does not contain the primary key
XCTAssertNil(db.schemaCache.primaryKey("foo"))
s3.signal()
_ = s4.wait(timeout: .distantFuture)
// cache does not contain the primary key
XCTAssertNil(db.schemaCache.primaryKey("foo"))
}
}
let block2 = { () in
_ = s1.wait(timeout: .distantFuture)
try! dbPool.read { db in
// activate snapshot isolation so that foo table is visible during the whole read. Any read is enough.
try db.makeSelectStatement("SELECT * FROM sqlite_master").cursor().next()
// warm cache
_ = try db.primaryKey("foo")
// cache contains the primary key
XCTAssertNotNil(db.schemaCache.primaryKey("foo"))
s2.signal()
_ = s3.wait(timeout: .distantFuture)
// cache contains the primary key
XCTAssertNotNil(db.schemaCache.primaryKey("foo"))
// warm cache if needed
_ = try db.primaryKey("foo")
s4.signal()
}
}
let blocks = [block1, block2]
DispatchQueue.concurrentPerform(iterations: blocks.count) { index in
blocks[index]()
}
}
func testUnsafeReaderHasNoDatabaseCache() throws {
let dbPool = try makeDatabasePool()
try dbPool.write { db in
try db.execute("CREATE TABLE items (id INTEGER PRIMARY KEY, email TEXT UNIQUE, foo INT, bar DOUBLE)")
try db.execute("CREATE INDEX foobar ON items(foo, bar)")
}
try dbPool.unsafeRead { db in
// Assert that a cache is empty
XCTAssertTrue(db.schemaCache.primaryKey("items") == nil)
XCTAssertTrue(db.schemaCache.columns(in: "items") == nil)
XCTAssertTrue(db.schemaCache.indexes(on: "items") == nil)
// Warm cache in a reader
_ = try db.primaryKey("items")
_ = try db.columns(in: "items")
_ = try db.indexes(on: "items")
// Assert that a reader cache is still empty
XCTAssertTrue(db.schemaCache.primaryKey("items") == nil)
XCTAssertTrue(db.schemaCache.columns(in: "items") == nil)
XCTAssertTrue(db.schemaCache.indexes(on: "items") == nil)
}
}
}
@@ -229,4 +229,63 @@ class FTS4TableBuilderTests: GRDBTestCase {
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
}
}
func testFTS4SynchronizationCleanup() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
func testFTS4SynchronizationCleanupWithLegacySupport() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS4SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
try db.dropFTS4SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS4()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
}
@@ -219,5 +219,64 @@ class FTS5TableBuilderTests: GRDBTestCase {
XCTAssertEqual(try Int.fetchOne(db, "SELECT COUNT(*) FROM ft_documents WHERE ft_documents MATCH ?", arguments: ["bar"])!, 1)
}
}
func testFTS5SynchronizationCleanup() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
func testFTS5SynchronizationCleanupWithLegacySupport() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.create(table: "documents") { t in
t.column("id", .integer).primaryKey()
t.column("content", .text)
}
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
try db.drop(table: "ft_documents")
try db.dropFTS5SynchronizationTriggers(forTable: "documents") // legacy GRDB <= 2.3.1
try db.dropFTS5SynchronizationTriggers(forTable: "ft_documents")
// It is possible to modify the content table
try db.execute("UPDATE documents SET content = ?", arguments: ["bar"])
try db.execute("INSERT INTO documents (content) VALUES (?)", arguments: ["foo"])
try db.execute("DELETE FROM documents WHERE content = ?", arguments: ["foo"])
// It is possible to recreate the FT table
try db.create(virtualTable: "ft_documents", using: FTS5()) { t in
t.synchronize(withTable: "documents")
t.column("content")
}
}
}
}
#endif
+10
View File
@@ -12,6 +12,10 @@ import XCTest
@testable import GRDB // @testable so that we have access to SQLiteConnectionWillClose
#endif
// Support for Database.logError
var lastResultCode: ResultCode? = nil
var lastMessage: String? = nil
class GRDBTestCase: XCTestCase {
// The default configuration for tests
var dbConfiguration: Configuration!
@@ -53,6 +57,12 @@ class GRDBTestCase: XCTestCase {
override func setUp() {
super.setUp()
// Must be set prior to any databaase connection
Database.logError = { (resultCode, message) in
lastResultCode = resultCode
lastMessage = message
}
let dbPoolDirectoryName = "GRDBTestCase-\(ProcessInfo.processInfo.globallyUniqueString)"
dbDirectoryPath = (NSTemporaryDirectory() as NSString).appendingPathComponent(dbPoolDirectoryName)
do { try FileManager.default.removeItem(atPath: dbDirectoryPath) } catch { }
+6 -4
View File
@@ -462,14 +462,16 @@ class TableDefinitionTests: GRDBTestCase {
t.add(column: "b", .text)
t.add(column: "c", .integer).notNull().defaults(to: 1)
t.add(column: "d", .text).references("alt")
t.add(column: "e")
}
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
assertEqualSQL(sqlQueries[sqlQueries.count - 4], "ALTER TABLE \"test\" ADD COLUMN \"b\" TEXT")
assertEqualSQL(sqlQueries[sqlQueries.count - 3], "ALTER TABLE \"test\" ADD COLUMN \"c\" INTEGER NOT NULL DEFAULT 1")
assertEqualSQL(sqlQueries[sqlQueries.count - 2], "ALTER TABLE \"test\" ADD COLUMN \"d\" TEXT REFERENCES \"alt\"(\"rowid\")")
assertEqualSQL(sqlQueries[sqlQueries.count - 1], "ALTER TABLE \"test\" ADD COLUMN \"e\"")
}
}
func testDropTable() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
+32 -1
View File
@@ -28,7 +28,7 @@ class UpdateStatementTests : GRDBTestCase {
try dbQueue.inTransaction { db in
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Arthur');").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Barbara')\n \t").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig');").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Craig'); ; ;").execute()
try db.makeUpdateStatement("INSERT INTO persons (name) VALUES ('Daniel');\n \t").execute()
return .commit
}
@@ -182,6 +182,19 @@ class UpdateStatementTests : GRDBTestCase {
XCTAssertEqual(index, 3 + 3)
}
func testExecuteNothing() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("")
try db.execute(" ")
try db.execute(";")
try db.execute(";;")
try db.execute(" \n;\t; ")
try db.execute("-- comment")
try db.execute("-- comment\\n; -----ignored")
}
}
func testExecuteMultipleStatement() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
@@ -209,6 +222,24 @@ class UpdateStatementTests : GRDBTestCase {
}
}
func testExecuteMultipleStatementWithPlentyOfSemicolonsAndWhiteSpaceAndComments() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inDatabase { db in
try db.execute("""
;;
CREATE TABLE wines ( -- create a table
name TEXT, -- the name
color INT);
;\t;
-- create another table
CREATE TABLE books (name TEXT, age INT); \
\t; ;
""")
XCTAssertTrue(try db.tableExists("wines"))
XCTAssertTrue(try db.tableExists("books"))
}
}
func testExecuteMultipleStatementWithNamedArguments() throws {
let dbQueue = try makeDatabaseQueue()
try dbQueue.inTransaction { db in
@@ -41,7 +41,7 @@ class FetchNamedValuesTests: XCTestCase {
#if GRDB_COMPARE
func testFMDB() {
let databasePath = Bundle(for: type(of: self)).path(forResource: "PerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)!
measure {
var count = 0
@@ -83,7 +83,7 @@ class FetchPositionalValuesTests: XCTestCase {
#if GRDB_COMPARE
func testFMDB() {
let databasePath = Bundle(for: type(of: self)).path(forResource: "PerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)!
measure {
var count = 0
@@ -86,7 +86,7 @@ class FetchRecordStructTests: XCTestCase {
// Here we test the loading of an array of Records.
let databasePath = Bundle(for: type(of: self)).path(forResource: "PerformanceTests", ofType: "sqlite")!
let dbQueue = FMDatabaseQueue(path: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)!
measure {
var items = [ItemStruct]()
@@ -57,7 +57,7 @@ class InsertNamedValuesTests: XCTestCase {
measure {
_ = try? FileManager.default.removeItem(atPath: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)!
dbQueue.inDatabase { db in
db.executeStatements("CREATE TABLE items (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
}
@@ -102,7 +102,7 @@ class InsertPositionalValuesTests: XCTestCase {
measure {
_ = try? FileManager.default.removeItem(atPath: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)
let dbQueue = FMDatabaseQueue(path: databasePath)!
dbQueue.inDatabase { db in
db.executeStatements("CREATE TABLE items (i0 INT, i1 INT, i2 INT, i3 INT, i4 INT, i5 INT, i6 INT, i7 INT, i8 INT, i9 INT)")
}
+123
View File
@@ -0,0 +1,123 @@
#!/usr/bin/env ruby
gem 'json'
require 'json'
require 'date'
require 'rexml/document'
# Extract CFBundleShortVersionString from a plist file
def info_plist_version(path)
REXML::Document.new(File.read(path))
.root
.elements["//key[text()='CFBundleShortVersionString']"]
.next_element
.text
end
def formatted_sample(samples, test, lib)
sample = samples["#{test}Tests"]["test#{lib}"]
return '¹' unless sample # n/a
'%.2f' % sample
end
def formatted_samples(samples, test)
libs = %w{GRDB SQLite FMDB SQLiteSwift CoreData Realm}
libs.map { |lib| formatted_sample(samples, test, lib) || '¹' }
end
samples = JSON.parse(STDIN.read)
grdb_version = info_plist_version('Support/Info.plist')
fmdb_version = info_plist_version('Tests/Performance/fmdb/src/fmdb/Info.plist')
sqlite_swift_version = info_plist_version('Tests/Performance/SQLite.swift/Sources/SQLite/Info.plist')
realm_version = info_plist_version('Tests/Performance/Realm/build/osx/Realm.framework/Versions/A/Resources/Info.plist')
puts <<-REPORT
# Comparing the Performances of Swift SQLite libraries
*Last updated #{Date.today.strftime('%B %-d, %Y')}*
Below are performance benchmarks made on for [GRDB #{grdb_version}](https://github.com/groue/GRDB.swift), [FMDB #{fmdb_version}](https://github.com/ccgus/fmdb), and [SQLite.swift #{sqlite_swift_version}](https://github.com/stephencelis/SQLite.swift). They are compared to Core Data, [Realm #{realm_version}](https://realm.io) and the raw use of the SQLite C API from Swift.
This report was generated on a MacBook Pro (15-inch, Late 2016), with Xcode 9.2, by running the following command:
```sh
make test_performance | Tests/parsePerformanceTests.rb | Tests/generatePerformanceReport.rb
```
All tests use the default settings of each library. For each library, we:
- Build and consume database rows with raw SQL and column indexes (aiming at the best performance)
- Build and consume database rows with column names (sacrificing performance for maintainability)
- Build and consume records values to and from database rows (aiming at the shortest code from database to records)
- Build and consume records values to and from database rows, with [change tracking](https://github.com/groue/GRDB.swift#changes-tracking) (records know if they have unsaved changes)
As a bottom line, the raw SQLite C API is used as efficiently as possible, without any error checking.
| | GRDB | Raw SQLite | FMDB | SQLite.swift | Core Data | Realm |
|:-------------------------------- | ----:| ----------:| ----:| ------------:| ---------:| -----:|
| **Column indexes** | | | | | | |
| Fetch | #{formatted_samples(samples, 'FetchPositionalValues').join(" | ")} |
| Insert | #{formatted_samples(samples, 'InsertPositionalValues').join(" | ")} |
| **Column names** | | | | | | |
| Fetch | #{formatted_samples(samples, 'FetchNamedValues').join(" | ")} |
| Insert | #{formatted_samples(samples, 'InsertNamedValues').join(" | ")} |
| **Records** | | | | | | |
| Fetch | #{formatted_samples(samples, 'FetchRecordStruct').join(" | ")} |
| Insert | #{formatted_samples(samples, 'InsertRecordStruct').join(" | ")} |
| **Records with change tracking** | | | | | | |
| Fetch | #{formatted_samples(samples, 'FetchRecordClass').join(" | ")} |
| Insert | #{formatted_samples(samples, 'InsertRecordClass').join(" | ")} |
¹ Not applicable
- **Column indexes**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchPositionalValuesTests.swift))
This test fetches 100000 rows of 10 ints and extracts each int given its position in the row.
It uses FMDB's `-[FMResultSet longForColumnIndex:]`, GRDB's `Row.value(atIndex:)`, and the low-level SQL API of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertPositionalValuesTests.swift))
This test inserts 20000 rows of 10 ints, by setting query arguments given their position.
It uses FMDB's `-[FMDatabase executeUpdate:withArgumentsInArray:]` with statement caching, GRDB's `UpdateStatement.execute(arguments:Array)`, and the low-level SQL API of SQLite.swift.
- **Column names**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchNamedValuesTests.swift))
This test fetches 100000 rows of 10 ints and extracts each int given its column name.
It uses FMDB's `-[FMResultSet longForColumn:]`, GRDB's `Row.value(named:)`, and the high-level query builder of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertNamedValuesTests.swift))
This test inserts 20000 rows of 10 ints, by setting query arguments given their argument name.
It uses FMDB's `-[FMDatabase executeUpdate:withParameterDictionary:]` with statement caching, GRDB's `UpdateStatement.execute(arguments:Dictionary)`, and the high-level query builder of SQLite.swift.
- **Records**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchRecordStructTests.swift))
This test fetches an array of 100000 record objects initiated from rows of 10 ints.
It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [RowConvertible](https://github.com/groue/GRDB.swift#rowconvertible-protocol) protocol, and the values returned by the high-level query builder of SQLite.swift.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertRecordStructTests.swift))
This tests inserts 20000 records with the persistence method provided by GRDB's [Persistable](https://github.com/groue/GRDB.swift#persistable-protocol) protocol.
- **Records with change tracking**:
- **Fetch** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/FetchRecordClassTests.swift))
This test fetches an array of 100000 record objects initiated from rows of 10 ints.
It builds records from FMDB's `-[FMResultSet resultDictionary]`, GRDB's built-in [Record](https://github.com/groue/GRDB.swift#record-class) class.
- **Insert** ([source](https://github.com/groue/GRDB.swift/blob/master/Tests/Performance/InsertRecordClassTests.swift))
This tests inserts 20000 records with the persistence method provided by GRDB's [Record](https://github.com/groue/GRDB.swift#record-class) class.
REPORT
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby
gem 'json'
require 'json'
tests = {}
STDIN.each do |line|
if line =~ /\.([^ ]*) ([^ ]*)\]' measured \[Time, seconds\] average: ([\d.]+)/
class_name = $1
test_name = $2
time = $3
tests[class_name] ||= {}
tests[class_name][test_name] = time.to_f
end
end
puts tests.to_json
-10
View File
@@ -1,10 +0,0 @@
#/bin/sh
#
# Outputs the compilation time of all methods.
# To get the 20 slowest methods, run ./slow_methods.sh | head -20
set -e
PROJECT=GRDB.xcodeproj
TARGET=GRDBiOS
OTHER_SWIFT_FLAGS='-Xfrontend -debug-time-function-bodies' xcodebuild -project $PROJECT -target $TARGET 2>&1 clean build | grep '^[0-9][0-9.]*.*\t' | sort -nr