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) {
3232            db.setTransactionSuccessful()
3333        } finally  {
3434            db.endTransaction()
35-             db.close()
3635        }
3736    }
3837
3938    fun  deleteAllRules () {
4039        val  db =  dbHelper.writableDatabase
4140        db.delete(" rules_table" null , null )
42-         db.close()
4341    }
4442
4543    suspend  fun  getRule (name :  String ): RuleEntity ?  =  withContext(Dispatchers .IO ) {
@@ -51,9 +49,7 @@ class RuleDao(context: Context) {
5149            arrayOf(name),
5250            null , null , null 
5351        ).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 
5753        }
5854    }
5955
@@ -64,7 +60,6 @@ class RuleDao(context: Context) {
6460            while  (cursor.moveToNext()) {
6561                list.add(cursorToEntity(cursor))
6662            }
67-             db.close()
6863            list
6964        }
7065    }
@@ -81,7 +76,6 @@ class RuleDao(context: Context) {
8176            while  (cursor.moveToNext()) {
8277                list.add(cursorToEntity(cursor))
8378            }
84-             db.close()
8579            list
8680        }
8781    }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments