From 3587ae435cf5da615f4d065171a8069daaf76cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Mon, 6 Jul 2015 12:31:43 +0200 Subject: [PATCH] Hide Database.configuration behind DatabaseQueue.configuration --- GRDB/Database.swift | 9 +++------ GRDB/DatabaseQueue.swift | 6 ++++++ TODO.md | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/GRDB/Database.swift b/GRDB/Database.swift index 07c50bad4..17478f60e 100644 --- a/GRDB/Database.swift +++ b/GRDB/Database.swift @@ -36,12 +36,6 @@ You don't create a database directly. Instead, you use a DatabaseQueue: */ public final class Database { - // MARK: - Configuration - - /// The database configuration - public let configuration: Configuration - - // MARK: - Select Statements /** @@ -144,6 +138,9 @@ public final class Database { // MARK: - Non public + /// The database configuration + let configuration: Configuration + /// The SQLite connection handle let sqliteConnection = SQLiteConnection() diff --git a/GRDB/DatabaseQueue.swift b/GRDB/DatabaseQueue.swift index 0e69a9f07..50f7b4506 100644 --- a/GRDB/DatabaseQueue.swift +++ b/GRDB/DatabaseQueue.swift @@ -27,6 +27,12 @@ A Database Queue serializes access to an SQLite database. */ public final class DatabaseQueue { + // MARK: - Configuration + + /// The database configuration + public var configuration: Configuration { return database.configuration } + + // MARK: - Initializers /** diff --git a/TODO.md b/TODO.md index 0c73d9b20..ab230f37b 100644 --- a/TODO.md +++ b/TODO.md @@ -5,4 +5,4 @@ - [ ] Add bindings to SQLiteError, so that one known the value that could not be updated/inserted. - [ ] Document why execute and fetch methods will never be added to DatabaseQueue, and one always has to execute a block. It is because code like `dbQueue.execute("INSERT..."); let id = dbQueue.lastInsertedRowID` would be *unsafe*. - [ ] Pierlo complains that databaseDictionary returns a dictionary of values when updateFromDatabaseRow eats a Row. See if we can do something about that. -- [ ] db.fetch(RowModel.type, primaryKey: Bindings) in unsafe because there are chances that array bindings don't match the order of primary key columns. Rethink fetching by primary key for RowModels with primary keys that span accross multiple columns. \ No newline at end of file +- [ ] db.fetch(RowModel.type, primaryKey: Bindings) in unsafe because there are chances that array bindings don't match the order of primary key columns. Rethink fetching by primary key for RowModels with primary keys that span accross multiple columns.