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 2222// THE SOFTWARE.
2323//
2424
25- import Foundation
26-
2725/// Binding is a protocol that SQLite.swift uses internally to directly map
2826/// SQLite types to Swift types.
2927///
@@ -47,30 +45,37 @@ public protocol Value {
4745
4846}
4947
50- public struct Blob {
51-
52- private let data : NSData
48+ public struct Blob : Equatable {
5349
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
5654 }
57-
58- public var length : Int {
59- return data. length
60- }
61-
55+
6256 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+ ) )
6461 }
6562
6663}
6764
68- extension Blob : Equatable { }
69-
7065public func == ( lhs: Blob , rhs: Blob ) -> Bool {
7166 return lhs. data == rhs. data
7267}
7368
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+
7479extension Blob : Binding , Value {
7580
7681 public static var declaredDatatype = " BLOB "
You can’t perform that action at this time.
0 commit comments