Created
May 22, 2018 18:21
-
-
Save ryansgot/617080835d8881c6108e6484045e8228 to your computer and use it in GitHub Desktop.
Quickstart Soft Deletion Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// java version | |
// the below assumes use of forsuredbandroid-contentprovider | |
// as the platform integration library. SaveResult would be | |
// parameterized with DirectLocator if using | |
// forsuredbandroid-directdb or forsuredbjdbc | |
SaveResult<Uri> saveResult = ForSure.employeesTable() | |
.find().byFirstName("Some") | |
.then() | |
.set() | |
.softDelete() | |
var msg = "SaveResult{exception: ${saveResult.exception()}" // <-- null when upsert succeeds | |
msg += "; inserted: ${saveResult.inserted()}" // <-- null on update, non-null on insert | |
msg += "; rowsAffected: ${saveResult.rowsAffected()}}" // <-- 1 or more on update, 1 on insert | |
Log.i("forsuredb-example", msg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// kotlin version | |
var saveResult = ForSure.employeesTable() | |
.find().byFirstName("Some") | |
.then() | |
.set() | |
.softDelete() | |
var msg = "SaveResult{exception: ${saveResult.exception()}" // <-- null when upsert succeeds | |
msg += "; inserted: ${saveResult.inserted()}" // <-- null on update, non-null on insert | |
msg += "; rowsAffected: ${saveResult.rowsAffected()}}" // <-- 1 or more on update, 1 on insert | |
Log.i("forsuredb-example", msg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment