This commit is contained in:
Gwendal Roué committed 2016-01-16 15:37:01 +01:00
1 parent 995d3a4493
commit 82cfefc3d9
1 file changed
+4 -5
+4 -5
View File
@@ -4,12 +4,11 @@ import Foundation
extension NSData : DatabaseValueConvertible {
/// Returns a value that can be stored in the database.
public var databaseValue: DatabaseValue {
if length == 0 {
// SQLite cant' store zero-length blobs.
// SQLite cant' store zero-length blobs.
guard length > 0 else {
return .Null
} else {
return DatabaseValue(storage: .Blob(self))
}
return DatabaseValue(storage: .Blob(self))
}
/// Returns an NSData initialized from *databaseValue*, if it contains
@@ -23,7 +22,7 @@ extension NSData : DatabaseValueConvertible {
public static func fromDatabaseValue(databaseValue: DatabaseValue) -> Self? {
switch databaseValue.storage {
case .Blob(let data):
return self.init(data: data) // When Self is NSData, the buffer is not copied.
return self.init(data: data)
default:
return nil
}