From 4177014a8e85da24afbcdbbb7baaac070d549fac Mon Sep 17 00:00:00 2001 From: David Dunn Date: Wed, 18 Apr 2018 10:14:26 +0100 Subject: [PATCH] fix: use PQStatus during isConnected check (#49) --- Sources/SwiftKueryPostgreSQL/PostgreSQLConnection.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SwiftKueryPostgreSQL/PostgreSQLConnection.swift b/Sources/SwiftKueryPostgreSQL/PostgreSQLConnection.swift index 3752237..856d149 100644 --- a/Sources/SwiftKueryPostgreSQL/PostgreSQLConnection.swift +++ b/Sources/SwiftKueryPostgreSQL/PostgreSQLConnection.swift @@ -42,7 +42,7 @@ public class PostgreSQLConnection: Connection { /// An indication whether there is a connection to the database. public var isConnected: Bool { - return connection != nil + return connection != nil && PQstatus(connection) == CONNECTION_OK } /// The `QueryBuilder` with PostgreSQL specific substitutions.