From 41d19c46b44a5b5040e24dafc3e918572925f793 Mon Sep 17 00:00:00 2001 From: Artem Chepurnoy Date: Sat, 20 Jan 2024 12:41:44 +0200 Subject: [PATCH] refactor: Move getLastInsertRowId to the util.sq --- .../wordlist/repo/impl/GeneratorWordlistRepositoryImpl.kt | 2 +- .../commonMain/sqldelight/com/artemchep/keyguard/data/util.sq | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 common/src/commonMain/sqldelight/com/artemchep/keyguard/data/util.sq diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/service/wordlist/repo/impl/GeneratorWordlistRepositoryImpl.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/service/wordlist/repo/impl/GeneratorWordlistRepositoryImpl.kt index 225261a9..f1b91af1 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/common/service/wordlist/repo/impl/GeneratorWordlistRepositoryImpl.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/common/service/wordlist/repo/impl/GeneratorWordlistRepositoryImpl.kt @@ -55,7 +55,7 @@ class GeneratorWordlistRepositoryImpl( name = name, createdAt = now, ) - val wordlistId = db.generatorWordlistQueries + val wordlistId = db.utilQueries .getLastInsertRowId() .executeAsOne() wordlist.forEach { word -> diff --git a/common/src/commonMain/sqldelight/com/artemchep/keyguard/data/util.sq b/common/src/commonMain/sqldelight/com/artemchep/keyguard/data/util.sq new file mode 100644 index 00000000..0cfd5466 --- /dev/null +++ b/common/src/commonMain/sqldelight/com/artemchep/keyguard/data/util.sq @@ -0,0 +1,2 @@ +getLastInsertRowId: +SELECT last_insert_rowid();