Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

Commit

Permalink
Refactored and fixed issues with retrieving the correct error codes f…
Browse files Browse the repository at this point in the history
…or PostgreSQLError in case of failures; Added two unit tests for testing PostgreSQLError and PostgresSQLStatusError. Updated package to use latest CPostgresSQL
  • Loading branch information
sroebert committed May 13, 2017
1 parent 20269ef commit 11c76eb
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 266 deletions.
8 changes: 5 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import PackageDescription

let beta = Version(2,0,0, prereleaseIdentifiers: ["beta"])

let package = Package(
name: "PostgreSQL",
dependencies: [
// Module map for `libpq`
.Package(url: "https://github.com/vapor/cpostgresql.git", Version(2,0,0, prereleaseIdentifiers: ["alpha"])),
.Package(url: "https://github.com/vapor-community/cpostgresql.git", beta),

// Data structure for converting between multiple representations
.Package(url: "https://github.com/vapor/node.git", Version(2,0,0, prereleaseIdentifiers: ["beta"])),
.Package(url: "https://github.com/vapor/node.git", beta),

// Core extensions, type-aliases, and functions that facilitate common tasks
.Package(url: "https://github.com/vapor/core.git", Version(2,0,0, prereleaseIdentifiers: ["beta"])),
.Package(url: "https://github.com/vapor/core.git", beta),
]
)
4 changes: 2 additions & 2 deletions Sources/PostgreSQL/Connection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public final class Connection: ConnInfoInitializable {
lengths.append(Int32(bind.length))
}

let resultPointer: Result.Pointer = PQexecParams(
let resultPointer: Result.Pointer? = PQexecParams(
cConnection,
query,
Int32(binds.count),
Expand All @@ -94,7 +94,7 @@ public final class Connection: ConnInfoInitializable {

private func validateConnection() throws {
guard isConnected else {
throw PostgreSQLError(code: .connection_failure, connection: self)
throw PostgreSQLError(code: .connectionFailure, connection: self)
}
}

Expand Down
Loading

0 comments on commit 11c76eb

Please sign in to comment.