Skip to content

Commit

Permalink
swift 5 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Mar 26, 2019
1 parent 4f5e173 commit 314d9cd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/SQLite/Database/SQLiteStatement.swift
Expand Up @@ -24,8 +24,9 @@ internal struct SQLiteStatement {
switch bind {
case .blob(let value):
let count = Int32(value.count)
let pointer: UnsafePointer<UInt8> = value.withUnsafeBytes { $0 }
let ret = sqlite3_bind_blob(c, i, UnsafeRawPointer(pointer), count, SQLITE_TRANSIENT)
let ret = value.withUnsafeBytes { pointer in
return sqlite3_bind_blob(c, i, UnsafeRawPointer(pointer), count, SQLITE_TRANSIENT)
}
guard ret == SQLITE_OK else {
throw SQLiteError(statusCode: ret, connection: connection, source: .capture())
}
Expand Down
13 changes: 13 additions & 0 deletions Sources/SQLite/Row/SQLiteColumn.swift
Expand Up @@ -33,8 +33,21 @@ extension SQLiteColumn: ExpressibleByStringLiteral {
}

extension SQLiteColumn: Hashable {
// #if compiler(>=4.2)
#if swift(>=4.1.50)
/// See `Hashable`.
public func hash(into hasher: inout Hasher) {
hasher.combine(self._hashValue)
}
#else
/// See `Hashable`.
public var hashValue: Int {
return self._hashValue
}
#endif

/// See `Hashable`.
private var _hashValue: Int {
if let table = table {
return table.hashValue &+ name.hashValue
} else {
Expand Down

0 comments on commit 314d9cd

Please sign in to comment.