Skip to content

Commit 25ea464

Browse files
committed
More renames
1 parent 1972fa7 commit 25ea464

25 files changed

Lines changed: 249 additions & 249 deletions

Sources/Compiler/Gen/SwiftLanguage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public struct SwiftLanguage: Language {
577577
}
578578

579579
writer.unindent()
580-
writer.write(line: ") throws(PureSQL.PureSQLError) {")
580+
writer.write(line: ") throws(PureSQL.SQLError) {")
581581

582582
writer.indent()
583583
var index = 0

Sources/PureSQL/ConnectionPool.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public actor ConnectionPool: Sendable {
3939
migrations: [String]
4040
) throws {
4141
guard limit > 0 else {
42-
throw PureSQLError.poolCannotHaveZeroConnections
42+
throw SQLError.poolCannotHaveZeroConnections
4343
}
4444

4545
self.path = path
@@ -62,7 +62,7 @@ public actor ConnectionPool: Sendable {
6262
/// Starts a transaction.
6363
private func begin(
6464
_ kind: Transaction.Kind
65-
) async throws(PureSQLError) -> sending Transaction {
65+
) async throws(SQLError) -> sending Transaction {
6666
// Writes must be exclusive, make sure to wait on any pending writes.
6767
if kind == .write {
6868
await writeLock.lock()
@@ -82,7 +82,7 @@ public actor ConnectionPool: Sendable {
8282
}
8383

8484
/// Will get, wait or create a connection to the database
85-
private func getConnection() async throws(PureSQLError) -> RawConnection {
85+
private func getConnection() async throws(SQLError) -> RawConnection {
8686
guard availableConnections.isEmpty else {
8787
// Have an available connection, just use it
8888
return availableConnections.removeLast()
@@ -99,7 +99,7 @@ public actor ConnectionPool: Sendable {
9999
}
100100

101101
/// Initializes a new SQL connection
102-
private func newConnection() throws(PureSQLError) -> SQLiteConnection {
102+
private func newConnection() throws(SQLError) -> SQLiteConnection {
103103
assert(count < limit)
104104
count += 1
105105
let connection = try SQLiteConnection(path: path)

Sources/PureSQL/Cursor.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public struct Cursor<Element>: ~Copyable {
1818
self.statement = statement
1919
}
2020

21-
public mutating func nextRow() throws(PureSQLError) -> Row? {
21+
public mutating func nextRow() throws(SQLError) -> Row? {
2222
switch try statement.step() {
2323
case .row: Row(sqliteStatement: statement.raw)
2424
case .done: nil
@@ -28,7 +28,7 @@ public struct Cursor<Element>: ~Copyable {
2828
public mutating func next<Adapter: DatabaseValueAdapter, Storage: DatabasePrimitive>(
2929
adapter: Adapter,
3030
storage: Storage.Type
31-
) throws(PureSQLError) -> Element? where Adapter.Value == Element {
31+
) throws(SQLError) -> Element? where Adapter.Value == Element {
3232
switch try statement.step() {
3333
case .row:
3434
let row = Row(sqliteStatement: statement.raw)
@@ -40,7 +40,7 @@ public struct Cursor<Element>: ~Copyable {
4040
}
4141

4242
extension Cursor where Element: RowDecodable {
43-
public mutating func next() throws(PureSQLError) -> Element? {
43+
public mutating func next() throws(SQLError) -> Element? {
4444
switch try statement.step() {
4545
case .row:
4646
let row = Row(sqliteStatement: statement.raw)
@@ -52,7 +52,7 @@ extension Cursor where Element: RowDecodable {
5252
}
5353

5454
extension Cursor where Element: RowDecodableWithAdapters {
55-
public mutating func next(adapters: Element.Adapters) throws(PureSQLError) -> Element? {
55+
public mutating func next(adapters: Element.Adapters) throws(SQLError) -> Element? {
5656
switch try statement.step() {
5757
case .row:
5858
let row = Row(sqliteStatement: statement.raw)

Sources/PureSQL/DatabasePrimitive.swift

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,115 +19,115 @@ public protocol DatabasePrimitive: RowDecodable {
1919
var sqlAny: SQLAny? { get }
2020

2121
/// Initialize from the row at the column `index`
22-
init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError)
22+
init(from cursor: OpaquePointer, at index: Int32) throws(SQLError)
2323

2424
/// Initializes self using the `adapter`
2525
init<Adapter: DatabaseValueAdapter>(
2626
value: Adapter.Value,
2727
into adapter: Adapter
28-
) throws(PureSQLError)
28+
) throws(SQLError)
2929

3030
/// Bind self to the statement at the given parameter index
31-
func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError)
31+
func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError)
3232

3333
/// Decode self using the `adapter`
3434
func decode<Adapter: DatabaseValueAdapter>(
3535
from adapter: Adapter
36-
) throws(PureSQLError) -> Adapter.Value
36+
) throws(SQLError) -> Adapter.Value
3737
}
3838

3939
public extension DatabasePrimitive {
40-
init(row: borrowing Row, startingAt start: Int32) throws(PureSQLError) {
40+
init(row: borrowing Row, startingAt start: Int32) throws(SQLError) {
4141
self = try row.value(at: start)
4242
}
4343
}
4444

4545
extension String: DatabasePrimitive {
46-
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError) {
46+
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(SQLError) {
4747
guard let ptr = sqlite3_column_text(cursor, index) else {
48-
throw PureSQLError.columnIsNil(index)
48+
throw SQLError.columnIsNil(index)
4949
}
5050

5151
self = String(cString: ptr)
5252
}
5353

54-
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError) {
54+
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError) {
5555
sqlite3_bind_text(statement, index, self, -1, SQLITE_TRANSIENT)
5656
}
5757

5858
@inlinable public init<Adapter: DatabaseValueAdapter>(
5959
value: Adapter.Value,
6060
into adapter: Adapter
61-
) throws(PureSQLError) {
61+
) throws(SQLError) {
6262
self = try adapter.encodeToString(value: value)
6363
}
6464

6565
@inlinable public func decode<Adapter: DatabaseValueAdapter>(
6666
from adapter: Adapter
67-
) throws(PureSQLError) -> Adapter.Value {
67+
) throws(SQLError) -> Adapter.Value {
6868
try adapter.decode(from: self)
6969
}
7070

7171
@inlinable public var sqlAny: SQLAny? { .string(self) }
7272
}
7373

7474
extension Int: DatabasePrimitive {
75-
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError) {
75+
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(SQLError) {
7676
self = Int(sqlite3_column_int64(cursor, index))
7777
}
7878

79-
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError) {
79+
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError) {
8080
sqlite3_bind_int(statement, index, Int32(self))
8181
}
8282

8383
@inlinable public init<Adapter: DatabaseValueAdapter>(
8484
value: Adapter.Value,
8585
into adapter: Adapter
86-
) throws(PureSQLError) {
86+
) throws(SQLError) {
8787
self = try adapter.encodeToInt(value: value)
8888
}
8989

9090
@inlinable public func decode<Adapter: DatabaseValueAdapter>(
9191
from adapter: Adapter
92-
) throws(PureSQLError) -> Adapter.Value {
92+
) throws(SQLError) -> Adapter.Value {
9393
try adapter.decode(from: self)
9494
}
9595

9696
@inlinable public var sqlAny: SQLAny? { .int(self) }
9797
}
9898

9999
extension Double: DatabasePrimitive {
100-
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError) {
100+
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(SQLError) {
101101
self = sqlite3_column_double(cursor, index)
102102
}
103103

104-
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError) {
104+
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError) {
105105
sqlite3_bind_double(statement, index, self)
106106
}
107107

108108
@inlinable public init<Adapter: DatabaseValueAdapter>(
109109
value: Adapter.Value,
110110
into adapter: Adapter
111-
) throws(PureSQLError) {
111+
) throws(SQLError) {
112112
self = try adapter.encodeToDouble(value: value)
113113
}
114114

115115
@inlinable public func decode<Adapter: DatabaseValueAdapter>(
116116
from adapter: Adapter
117-
) throws(PureSQLError) -> Adapter.Value {
117+
) throws(SQLError) -> Adapter.Value {
118118
try adapter.decode(from: self)
119119
}
120120

121121
@inlinable public var sqlAny: SQLAny? { .double(self) }
122122
}
123123

124124
extension Data: DatabasePrimitive {
125-
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError) {
125+
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(SQLError) {
126126
let count = Int(sqlite3_column_bytes(cursor, index))
127127
self = Data(bytes: sqlite3_column_blob(cursor, index), count: count)
128128
}
129129

130-
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError) {
130+
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError) {
131131
_ = withUnsafeBytes {
132132
sqlite3_bind_blob(statement, index, $0.baseAddress, CInt($0.count), SQLITE_TRANSIENT)
133133
}
@@ -136,29 +136,29 @@ extension Data: DatabasePrimitive {
136136
@inlinable public init<Adapter: DatabaseValueAdapter>(
137137
value: Adapter.Value,
138138
into adapter: Adapter
139-
) throws(PureSQLError) {
139+
) throws(SQLError) {
140140
self = try adapter.encodeToData(value: value)
141141
}
142142

143143
@inlinable public func decode<Adapter: DatabaseValueAdapter>(
144144
from adapter: Adapter
145-
) throws(PureSQLError) -> Adapter.Value {
145+
) throws(SQLError) -> Adapter.Value {
146146
try adapter.decode(from: self)
147147
}
148148

149149
@inlinable public var sqlAny: SQLAny? { .data(self) }
150150
}
151151

152152
extension Optional: DatabasePrimitive where Wrapped: DatabasePrimitive {
153-
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(PureSQLError) {
153+
@inlinable public init(from cursor: OpaquePointer, at index: Int32) throws(SQLError) {
154154
if sqlite3_column_type(cursor, index) == SQLITE_NULL {
155155
self = nil
156156
} else {
157157
self = try Wrapped(from: cursor, at: index)
158158
}
159159
}
160160

161-
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(PureSQLError) {
161+
@inlinable public func bind(to statement: OpaquePointer, at index: Int32) throws(SQLError) {
162162
if let value = self {
163163
try value.bind(to: statement, at: index)
164164
} else {
@@ -169,13 +169,13 @@ extension Optional: DatabasePrimitive where Wrapped: DatabasePrimitive {
169169
@inlinable public init<Adapter: DatabaseValueAdapter>(
170170
value: Adapter.Value,
171171
into adapter: Adapter
172-
) throws(PureSQLError) {
172+
) throws(SQLError) {
173173
self = try .some(Wrapped(value: value, into: adapter))
174174
}
175175

176176
@inlinable public func decode<Adapter: DatabaseValueAdapter>(
177177
from adapter: Adapter
178-
) throws(PureSQLError) -> Adapter.Value {
178+
) throws(SQLError) -> Adapter.Value {
179179
guard let value = self else {
180180
assertionFailure("Upstream did not perform nil check")
181181
throw .unexpectedNil

0 commit comments

Comments
 (0)