Skip to content

Commit d5de652

Browse files
authored
Merge pull request #2 from PerfectlySoft/master
Updated for 8-04
2 parents c5a7173 + e43d9a8 commit d5de652

File tree

4 files changed

+2
-23
lines changed

4 files changed

+2
-23
lines changed

.swift-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
DEVELOPMENT-SNAPSHOT-2016-07-25-a
1+
DEVELOPMENT-SNAPSHOT-2016-08-04-a

Sources/PostgreSQL/PostgreSQL.swift

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,9 @@ public final class PGResult {
109109

110110
/// Field name for index value
111111
public func fieldName(index: Int) -> String? {
112-
#if swift(>=3.0)
113112
if let fn = PQfname(self.res!, Int32(index)) {
114113
return String(validatingUTF8: fn) ?? ""
115114
}
116-
#else
117-
let fn = PQfname(self.res!, Int32(index))
118-
if nil != fn {
119-
return String(validatingUTF8: fn) ?? ""
120-
}
121-
#endif
122115
return nil
123116
}
124117

@@ -143,16 +136,9 @@ public final class PGResult {
143136

144137
/// return value for String field type with row and field indexes provided
145138
public func getFieldString(tupleIndex: Int, fieldIndex: Int) -> String? {
146-
#if swift(>=3.0)
147139
guard let v = PQgetvalue(self.res, Int32(tupleIndex), Int32(fieldIndex)) else {
148140
return nil
149141
}
150-
#else
151-
let v = PQgetvalue(self.res!, Int32(tupleIndex), Int32(fieldIndex))
152-
guard nil != v else {
153-
return nil
154-
}
155-
#endif
156142
return String(validatingUTF8: v)
157143
}
158144

@@ -222,16 +208,9 @@ public final class PGResult {
222208

223209
/// return value for Blob field type with row and field indexes provided
224210
public func getFieldBlob(tupleIndex: Int, fieldIndex: Int) -> [Int8]? {
225-
#if swift(>=3.0)
226211
guard let ip = UnsafePointer<Int8>(PQgetvalue(self.res!, Int32(tupleIndex), Int32(fieldIndex))) else {
227212
return nil
228213
}
229-
#else
230-
let ip = UnsafePointer<Int8>(PQgetvalue(self.res!, Int32(tupleIndex), Int32(fieldIndex)))
231-
guard nil != ip else {
232-
return nil
233-
}
234-
#endif
235214
let length = Int(PQgetlength(self.res!, Int32(tupleIndex), Int32(fieldIndex)))
236215
var ret = [Int8]()
237216
for idx in 0..<length {
@@ -317,7 +296,7 @@ public final class PGConnection {
317296
var aa = Array<UInt8>(utf8)
318297
aa.append(0)
319298
temps.append(aa)
320-
values[idx] = UnsafePointer<Int8>(temps.last!)
299+
values[idx] = UnsafePointer<Int8>(OpaquePointer(temps.last!))
321300
}
322301

323302
let r = PQexecParams(self.conn, statement, Int32(count), nil, values, nil, nil, Int32(0))

0 commit comments

Comments
 (0)