@@ -109,16 +109,9 @@ public final class PGResult {
109
109
110
110
/// Field name for index value
111
111
public func fieldName( index: Int ) -> String ? {
112
- #if swift(>=3.0)
113
112
if let fn = PQfname ( self . res!, Int32 ( index) ) {
114
113
return String ( validatingUTF8: fn) ?? " "
115
114
}
116
- #else
117
- let fn = PQfname ( self . res!, Int32 ( index) )
118
- if nil != fn {
119
- return String ( validatingUTF8: fn) ?? " "
120
- }
121
- #endif
122
115
return nil
123
116
}
124
117
@@ -143,16 +136,9 @@ public final class PGResult {
143
136
144
137
/// return value for String field type with row and field indexes provided
145
138
public func getFieldString( tupleIndex: Int , fieldIndex: Int ) -> String ? {
146
- #if swift(>=3.0)
147
139
guard let v = PQgetvalue ( self . res, Int32 ( tupleIndex) , Int32 ( fieldIndex) ) else {
148
140
return nil
149
141
}
150
- #else
151
- let v = PQgetvalue ( self . res!, Int32 ( tupleIndex) , Int32 ( fieldIndex) )
152
- guard nil != v else {
153
- return nil
154
- }
155
- #endif
156
142
return String ( validatingUTF8: v)
157
143
}
158
144
@@ -222,16 +208,9 @@ public final class PGResult {
222
208
223
209
/// return value for Blob field type with row and field indexes provided
224
210
public func getFieldBlob( tupleIndex: Int , fieldIndex: Int ) -> [ Int8 ] ? {
225
- #if swift(>=3.0)
226
211
guard let ip = UnsafePointer < Int8 > ( PQgetvalue ( self . res!, Int32 ( tupleIndex) , Int32 ( fieldIndex) ) ) else {
227
212
return nil
228
213
}
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
235
214
let length = Int ( PQgetlength ( self . res!, Int32 ( tupleIndex) , Int32 ( fieldIndex) ) )
236
215
var ret = [ Int8] ( )
237
216
for idx in 0 ..< length {
@@ -317,7 +296,7 @@ public final class PGConnection {
317
296
var aa = Array < UInt8 > ( utf8)
318
297
aa. append ( 0 )
319
298
temps. append ( aa)
320
- values [ idx] = UnsafePointer < Int8 > ( temps. last!)
299
+ values [ idx] = UnsafePointer < Int8 > ( OpaquePointer ( temps. last!) )
321
300
}
322
301
323
302
let r = PQexecParams ( self . conn, statement, Int32 ( count) , nil , values, nil , nil , Int32 ( 0 ) )
0 commit comments