File tree Expand file tree Collapse file tree 1 file changed +1
-7
lines changed
library/src/main/java/com/absinthe/rulesbundle Expand file tree Collapse file tree 1 file changed +1
-7
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,12 @@ class RuleDao(context: Context) {
32
32
db.setTransactionSuccessful()
33
33
} finally {
34
34
db.endTransaction()
35
- db.close()
36
35
}
37
36
}
38
37
39
38
fun deleteAllRules () {
40
39
val db = dbHelper.writableDatabase
41
40
db.delete(" rules_table" , null , null )
42
- db.close()
43
41
}
44
42
45
43
suspend fun getRule (name : String ): RuleEntity ? = withContext(Dispatchers .IO ) {
@@ -51,9 +49,7 @@ class RuleDao(context: Context) {
51
49
arrayOf(name),
52
50
null , null , null
53
51
).use { cursor ->
54
- val entity = if (cursor.moveToFirst()) cursorToEntity(cursor) else null
55
- db.close()
56
- entity
52
+ if (cursor.moveToFirst()) cursorToEntity(cursor) else null
57
53
}
58
54
}
59
55
@@ -64,7 +60,6 @@ class RuleDao(context: Context) {
64
60
while (cursor.moveToNext()) {
65
61
list.add(cursorToEntity(cursor))
66
62
}
67
- db.close()
68
63
list
69
64
}
70
65
}
@@ -81,7 +76,6 @@ class RuleDao(context: Context) {
81
76
while (cursor.moveToNext()) {
82
77
list.add(cursorToEntity(cursor))
83
78
}
84
- db.close()
85
79
list
86
80
}
87
81
}
You can’t perform that action at this time.
0 commit comments