File tree Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Expand file tree Collapse file tree 1 file changed +20
-15
lines changed Original file line number Diff line number Diff line change 22
22
// THE SOFTWARE.
23
23
//
24
24
25
- import Foundation
26
-
27
25
/// Binding is a protocol that SQLite.swift uses internally to directly map
28
26
/// SQLite types to Swift types.
29
27
///
@@ -47,30 +45,37 @@ public protocol Value {
47
45
48
46
}
49
47
50
- public struct Blob {
51
-
52
- private let data : NSData
48
+ public struct Blob : Equatable {
53
49
54
- public var bytes : UnsafePointer < Void > {
55
- return data. bytes
50
+ public let data : [ UInt8 ]
51
+
52
+ public init ( data: [ UInt8 ] ) {
53
+ self . data = data
56
54
}
57
-
58
- public var length : Int {
59
- return data. length
60
- }
61
-
55
+
62
56
public init ( bytes: UnsafePointer < Void > , length: Int ) {
63
- data = NSData ( bytes: bytes, length: length)
57
+ self . data = [ UInt8] ( UnsafeBufferPointer < UInt8 > (
58
+ start: UnsafePointer < UInt8 > ( bytes) ,
59
+ count: length
60
+ ) )
64
61
}
65
62
66
63
}
67
64
68
- extension Blob : Equatable { }
69
-
70
65
public func == ( lhs: Blob , rhs: Blob ) -> Bool {
71
66
return lhs. data == rhs. data
72
67
}
73
68
69
+ extension Blob {
70
+ public var bytes : UnsafePointer < Void > {
71
+ return UnsafePointer < Void > ( data)
72
+ }
73
+
74
+ public var length : Int {
75
+ return data. count
76
+ }
77
+ }
78
+
74
79
extension Blob : Binding , Value {
75
80
76
81
public static var declaredDatatype = " BLOB "
You can’t perform that action at this time.
0 commit comments