GRDB.swift v0.3.0 Release Notes
-
๐ Released July 11, 2015
๐ New
Blob.init?(NSData?)
Creates a Blob from NSData. Returns nil if and only if data is nil or zero-length (SQLite can't store empty blobs).
RowModel.isEdited
A boolean that indicates whether the row model has changes that have not been saved.
This flag is purely informative: it does not alter the behavior the update() method, which executes an UPDATE statement in every cases.
But you can prevent UPDATE statements that are known to be pointless, as in the following example:
let json = ... // Fetches or create a new person given its ID: let person = Person.fetchOne(db, primaryKey: json["id"]) ?? Person() // Apply json payload: person.updateFromJSON(json) // Saves the person if it is edited (fetched then modified, or created): if person.isEdited { person.save(db) // inserts or updates }
RowModel.copyDatabaseValuesFrom(_:)
Updates a row model with values of another one.
DatabaseValue
adopts Equatable.
๐ฅ Breaking changes
RowModelError.UnspecifiedTable
andRowModelError.InvalidDatabaseDictionary
have been replaced with fatal errors because they are programming errors.