Skip to content

Commit

Permalink
Make DatabaseOperations class open with all its methods (#346)
Browse files Browse the repository at this point in the history
Co-authored-by: Rafa Vázquez <rafa.vazsan@gmail.com>
  • Loading branch information
AhmedGamal92 and Sloy authored Aug 19, 2020
1 parent 0fae4c4 commit b10b9cb
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import androidx.test.platform.app.InstrumentationRegistry
import java.io.File
import java.util.ArrayList

class DatabaseOperations {
open class DatabaseOperations {

fun getAllDatabaseFiles(): List<File> {
open fun getAllDatabaseFiles(): List<File> {
return InstrumentationRegistry.getInstrumentation().targetContext
.let { context ->
context.databaseList()
Expand All @@ -16,14 +16,14 @@ class DatabaseOperations {
}
}

fun openDatabase(databaseFile: File): SQLiteDatabase {
open fun openDatabase(databaseFile: File): SQLiteDatabase {
return SQLiteDatabase.openDatabase(
databaseFile.absolutePath,
null /* cursorFactory */,
0 /* flags */)
}

fun getTableNames(sqLiteDatabase: SQLiteDatabase): List<String> {
open fun getTableNames(sqLiteDatabase: SQLiteDatabase): List<String> {
sqLiteDatabase.rawQuery("SELECT name FROM sqlite_master WHERE type IN (?, ?)", arrayOf("table", "view"))
.use { cursor ->
val tableNames = ArrayList<String>()
Expand All @@ -34,7 +34,7 @@ class DatabaseOperations {
}
}

fun deleteTableContent(sqLiteDatabase: SQLiteDatabase, tableName: String) {
open fun deleteTableContent(sqLiteDatabase: SQLiteDatabase, tableName: String) {
sqLiteDatabase.delete(tableName, null, null)
}
}
}

0 comments on commit b10b9cb

Please sign in to comment.