Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Delight 1.0 rc2 #135

Merged
merged 1 commit into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildscript {
'retrofit': '2.4.0',
'kotshi': '1.0.4',
'dagger': '2.16', // TODO https://issuetracker.google.com/issues/115738511
'sqldelight': '1.0.0-rc1',
'sqldelight': '1.0.0-rc2',
]

ext.deps = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ internal class SqlItemStore @Inject constructor(
override suspend fun updateItems(items: List<Item>) {
db.transaction {
for (item in items) {
val affected = db.updateItem(item.deprecated, item.link, item.packageName, item.className)
if (affected == 0L) {
db.updateItem(item.deprecated, item.link, item.packageName, item.className)
if (db.changes().executeAsOne() == 0L) {
db.insertItem(item.packageName, item.className, item.deprecated, item.link)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ WHERE packageName = ?1
AND className = ?2
;

changes:
SELECT changes()
;

count:
SELECT COUNT(id)
FROM item
Expand Down