Skip to content

Commit 683570f

Browse files
committed
chore(core): make sure to update query status after executing it in SQLiteExecutor.kt
1 parent b8b3391 commit 683570f

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
allprojects {
99
group = "org.sayandev"
10-
version = "1.9.1"
10+
version = "1.9.1.5"
1111
description = "A modular Kotlin framework for Minecraft: JE"
1212

1313
plugins.apply("maven-publish")

stickynote-core/src/main/kotlin/org/sayandev/stickynote/core/database/sqlite/SQLiteExecutor.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ abstract class SQLiteExecutor protected constructor(protected val dbFile: File,
8888
}
8989

9090
fun executeQuerySync(query: Query): QueryResult {
91-
val connection = getConnection() ?: return QueryResult(Query.StatusCode.FAILED, null)
91+
val connection = getConnection() ?: let {
92+
query.statusCode = Query.StatusCode.FAILED
93+
return QueryResult(Query.StatusCode.FAILED, null)
94+
}
9295

9396
try {
9497
connection.use { conn ->
@@ -111,6 +114,7 @@ abstract class SQLiteExecutor protected constructor(protected val dbFile: File,
111114
query.complete(resultSet)
112115
}
113116

117+
query.statusCode = Query.StatusCode.FINISHED
114118
return QueryResult(Query.StatusCode.FINISHED, resultSet)
115119
}
116120
} catch (e: SQLException) {
@@ -120,9 +124,11 @@ abstract class SQLiteExecutor protected constructor(protected val dbFile: File,
120124
query.increaseFailedAttempts()
121125
if (query.failedAttempts > failAttemptRemoval) {
122126
onQueryRemoveDueToFail(query)
127+
query.statusCode = Query.StatusCode.FINISHED
123128
return QueryResult(Query.StatusCode.FINISHED, null)
124129
}
125130
}
131+
query.statusCode = Query.StatusCode.FAILED
126132
return QueryResult(Query.StatusCode.FAILED, null)
127133
}
128134

0 commit comments

Comments
 (0)