Skip to content

Commit 2a5908b

Browse files
committed
Rename DBConnection to DirectConnection
1 parent 18f612f commit 2a5908b

File tree

8 files changed

+33
-33
lines changed

8 files changed

+33
-33
lines changed

SQLite.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
39548A6D1CA63C740003E3B5 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
174174
39548A6F1CA63C740003E3B5 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
175175
A121AC451CA35C79005A31D1 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
176-
AA780B3B1CC201A700E0E95E /* ConnectionPool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionPool.swift; sourceTree = "<group>"; };
176+
AA780B3B1CC201A700E0E95E /* ConnectionPool.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConnectionPool.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
177177
AA780B3C1CC201A700E0E95E /* Dispatcher.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Dispatcher.swift; sourceTree = "<group>"; };
178178
AA780B3F1CC202B000E0E95E /* ConnectionPoolTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionPoolTests.swift; sourceTree = "<group>"; };
179179
EE247AD31C3F04ED00AE3E12 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -182,19 +182,19 @@
182182
EE247ADD1C3F04ED00AE3E12 /* SQLiteTests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SQLiteTests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
183183
EE247AE41C3F04ED00AE3E12 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
184184
EE247AEE1C3F06E900AE3E12 /* Blob.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Blob.swift; sourceTree = "<group>"; };
185-
EE247AEF1C3F06E900AE3E12 /* Connection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Connection.swift; sourceTree = "<group>"; };
185+
EE247AEF1C3F06E900AE3E12 /* Connection.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Connection.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
186186
EE247AF01C3F06E900AE3E12 /* fts3_tokenizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fts3_tokenizer.h; sourceTree = "<group>"; };
187187
EE247AF11C3F06E900AE3E12 /* SQLite-Bridging.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "SQLite-Bridging.m"; sourceTree = "<group>"; };
188-
EE247AF21C3F06E900AE3E12 /* Statement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Statement.swift; sourceTree = "<group>"; };
188+
EE247AF21C3F06E900AE3E12 /* Statement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = Statement.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
189189
EE247AF31C3F06E900AE3E12 /* Value.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Value.swift; sourceTree = "<group>"; };
190-
EE247AF51C3F06E900AE3E12 /* FTS4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FTS4.swift; sourceTree = "<group>"; };
190+
EE247AF51C3F06E900AE3E12 /* FTS4.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = FTS4.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
191191
EE247AF61C3F06E900AE3E12 /* R*Tree.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "R*Tree.swift"; sourceTree = "<group>"; };
192192
EE247AF71C3F06E900AE3E12 /* Foundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Foundation.swift; sourceTree = "<group>"; };
193193
EE247AF81C3F06E900AE3E12 /* Helpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Helpers.swift; sourceTree = "<group>"; };
194194
EE247AFA1C3F06E900AE3E12 /* AggregateFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateFunctions.swift; sourceTree = "<group>"; };
195195
EE247AFB1C3F06E900AE3E12 /* Collation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Collation.swift; sourceTree = "<group>"; };
196196
EE247AFC1C3F06E900AE3E12 /* CoreFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreFunctions.swift; sourceTree = "<group>"; };
197-
EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunctions.swift; sourceTree = "<group>"; };
197+
EE247AFD1C3F06E900AE3E12 /* CustomFunctions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = CustomFunctions.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
198198
EE247AFE1C3F06E900AE3E12 /* Expression.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Expression.swift; sourceTree = "<group>"; };
199199
EE247AFF1C3F06E900AE3E12 /* Operators.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Operators.swift; sourceTree = "<group>"; };
200200
EE247B001C3F06E900AE3E12 /* Query.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Query.swift; sourceTree = "<group>"; };
@@ -204,7 +204,7 @@
204204
EE247B181C3F134A00AE3E12 /* SetterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SetterTests.swift; sourceTree = "<group>"; };
205205
EE247B1A1C3F137700AE3E12 /* AggregateFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AggregateFunctionsTests.swift; sourceTree = "<group>"; };
206206
EE247B1B1C3F137700AE3E12 /* BlobTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlobTests.swift; sourceTree = "<group>"; };
207-
EE247B1D1C3F137700AE3E12 /* ConnectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConnectionTests.swift; sourceTree = "<group>"; };
207+
EE247B1D1C3F137700AE3E12 /* ConnectionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; lineEnding = 0; path = ConnectionTests.swift; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
208208
EE247B1E1C3F137700AE3E12 /* CoreFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreFunctionsTests.swift; sourceTree = "<group>"; };
209209
EE247B1F1C3F137700AE3E12 /* CustomFunctionsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CustomFunctionsTests.swift; sourceTree = "<group>"; };
210210
EE247B201C3F137700AE3E12 /* ExpressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpressionTests.swift; sourceTree = "<group>"; };

SQLite/Core/Connection.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ public protocol Connection {
227227

228228

229229
/// A connection to SQLite.
230-
public final class DBConnection : Connection, Equatable {
230+
public final class DirectConnection : Connection, Equatable {
231231

232232
/// The location of a SQLite database.
233233
public enum Location {
@@ -807,15 +807,15 @@ public final class DBConnection : Connection, Equatable {
807807

808808
}
809809

810-
extension DBConnection : CustomStringConvertible {
810+
extension DirectConnection : CustomStringConvertible {
811811

812812
public var description: String {
813813
return String.fromCString(sqlite3_db_filename(handle, nil))!
814814
}
815815

816816
}
817817

818-
extension DBConnection.Location : CustomStringConvertible {
818+
extension DirectConnection.Location : CustomStringConvertible {
819819

820820
public var description: String {
821821
switch self {
@@ -830,7 +830,7 @@ extension DBConnection.Location : CustomStringConvertible {
830830

831831
}
832832

833-
public func ==(lhs: DBConnection, rhs: DBConnection) -> Bool {
833+
public func ==(lhs: DirectConnection, rhs: DirectConnection) -> Bool {
834834
return lhs === rhs
835835
}
836836

@@ -867,7 +867,7 @@ public enum Result : ErrorType {
867867

868868
case Error(message: String, code: Int32, statement: Statement?)
869869

870-
init?(errorCode: Int32, connection: DBConnection, statement: Statement? = nil) {
870+
init?(errorCode: Int32, connection: DirectConnection, statement: Statement? = nil) {
871871
guard !Result.successCodes.contains(errorCode) else { return nil }
872872

873873
let message = String.fromCString(sqlite3_errmsg(connection.handle))!

SQLite/Core/ConnectionPool.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ public protocol ConnectionPoolDelegate {
4343
// WAL mode.
4444
public final class ConnectionPool {
4545

46-
private let location : DBConnection.Location
47-
private var availableReadConnections = [DBConnection]()
48-
private var unavailableReadConnections = [DBConnection]()
46+
private let location : DirectConnection.Location
47+
private var availableReadConnections = [DirectConnection]()
48+
private var unavailableReadConnections = [DirectConnection]()
4949
private let lockQueue : dispatch_queue_t
50-
private var writeConnection : DBConnection!
50+
private var writeConnection : DirectConnection!
5151

5252
public var delegate : ConnectionPoolDelegate?
5353

54-
public init(_ location: DBConnection.Location) throws {
54+
public init(_ location: DirectConnection.Location) throws {
5555
self.location = location
5656
self.lockQueue = dispatch_queue_create("SQLite.ConnectionPool.Lock", DISPATCH_QUEUE_SERIAL)
5757
try writable.execute("PRAGMA journal_mode = WAL;")
@@ -70,9 +70,9 @@ public final class ConnectionPool {
7070
private class BorrowedConnection : Connection, Equatable {
7171

7272
let pool : ConnectionPool
73-
let connection : DBConnection
73+
let connection : DirectConnection
7474

75-
init(pool: ConnectionPool, connection: DBConnection) {
75+
init(pool: ConnectionPool, connection: DirectConnection) {
7676
self.pool = pool
7777
self.connection = connection
7878
}
@@ -114,13 +114,13 @@ public final class ConnectionPool {
114114

115115

116116
// Acquires a read/write connection to the database
117-
public var writable : DBConnection {
117+
public var writable : DirectConnection {
118118

119119
var writeConnectionInit = dispatch_once_t()
120120
dispatch_once(&writeConnectionInit) {
121121

122122
let flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_WAL | SQLITE_OPEN_NOMUTEX
123-
self.writeConnection = try! DBConnection(self.location, flags: flags, dispatcher: ReentrantDispatcher("SQLite.ConnectionPool.Write"), vfsName: vfsName)
123+
self.writeConnection = try! DirectConnection(self.location, flags: flags, dispatcher: ReentrantDispatcher("SQLite.ConnectionPool.Write"), vfsName: vfsName)
124124
self.writeConnection.busyTimeout = 2
125125

126126
if let delegate = self.delegate {
@@ -140,7 +140,7 @@ public final class ConnectionPool {
140140

141141
dispatch_sync(lockQueue) {
142142

143-
let connection : DBConnection
143+
let connection : DirectConnection
144144

145145
if let availableConnection = self.availableReadConnections.popLast() {
146146
connection = availableConnection
@@ -149,7 +149,7 @@ public final class ConnectionPool {
149149

150150
let flags = SQLITE_OPEN_READONLY | SQLITE_OPEN_WAL | SQLITE_OPEN_NOMUTEX
151151

152-
connection = try! DBConnection(self.location, flags: flags, dispatcher: ImmediateDispatcher(), vfsName: vfsName)
152+
connection = try! DirectConnection(self.location, flags: flags, dispatcher: ImmediateDispatcher(), vfsName: vfsName)
153153
connection.busyTimeout = 2
154154

155155
self.delegate?.pool(self, didAddConnection: connection)

SQLite/Core/Statement.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public final class Statement {
2929

3030
private var handle: COpaquePointer = nil
3131

32-
private let connection: DBConnection
32+
private let connection: DirectConnection
3333

34-
init(_ connection: DBConnection, _ SQL: String) throws {
34+
init(_ connection: DirectConnection, _ SQL: String) throws {
3535
self.connection = connection
3636
try connection.check(sqlite3_prepare_v2(connection.handle, SQL, -1, &handle, nil))
3737
}

SQLite/Extensions/FTS4.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ extension Tokenizer : CustomStringConvertible {
140140

141141
}
142142

143-
extension DBConnection {
143+
extension DirectConnection {
144144

145145
public func registerTokenizer(submoduleName: String, next: String -> (String, Range<String.Index>)?) throws {
146146
try check(_SQLiteRegisterTokenizer(handle, Tokenizer.moduleName, submoduleName) { input, offset, length in

SQLite/Typed/CustomFunctions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// THE SOFTWARE.
2323
//
2424

25-
public extension DBConnection {
25+
public extension DirectConnection {
2626

2727
/// Creates or redefines a custom SQL function.
2828
///

SQLiteTests/ConnectionTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,27 @@ class ConnectionTests : SQLiteTestCase {
1010
}
1111

1212
func test_init_withInMemory_returnsInMemoryConnection() {
13-
let db = try! DBConnection(.InMemory)
13+
let db = try! DirectConnection(.InMemory)
1414
XCTAssertEqual("", db.description)
1515
}
1616

1717
func test_init_returnsInMemoryByDefault() {
18-
let db = try! DBConnection()
18+
let db = try! DirectConnection()
1919
XCTAssertEqual("", db.description)
2020
}
2121

2222
func test_init_withTemporary_returnsTemporaryConnection() {
23-
let db = try! DBConnection(.Temporary)
23+
let db = try! DirectConnection(.Temporary)
2424
XCTAssertEqual("", db.description)
2525
}
2626

2727
func test_init_withURI_returnsURIConnection() {
28-
let db = try! DBConnection(.URI("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3"))
28+
let db = try! DirectConnection(.URI("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3"))
2929
XCTAssertEqual("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3", db.description)
3030
}
3131

3232
func test_init_withString_returnsURIConnection() {
33-
let db = try! DBConnection("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3")
33+
let db = try! DirectConnection("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3")
3434
XCTAssertEqual("\(NSTemporaryDirectory())/SQLite.swift Tests.sqlite3", db.description)
3535
}
3636

@@ -39,7 +39,7 @@ class ConnectionTests : SQLiteTestCase {
3939
}
4040

4141
func test_readonly_returnsTrueOnReadOnlyConnections() {
42-
let db = try! DBConnection(readonly: true)
42+
let db = try! DirectConnection(readonly: true)
4343
XCTAssertTrue(db.readonly)
4444
}
4545

SQLiteTests/TestHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class SQLiteTestCase : XCTestCase {
55

66
var trace = [String: Int]()
77

8-
let db = try! DBConnection()
8+
let db = try! DirectConnection()
99

1010
let users = Table("users")
1111

0 commit comments

Comments
 (0)