Skip to content

Commit 0a11c2c

Browse files
committed
Cleanup database warnings
1 parent 22c10a7 commit 0a11c2c

File tree

1 file changed

+6
-12
lines changed
  • app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/lib

1 file changed

+6
-12
lines changed

app/src/main/java/vocabletrainer/heinecke/aron/vocabletrainer/lib/Database.kt

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,11 @@ import vocabletrainer.heinecke.aron.vocabletrainer.trainer.TrainerSettings
2424
class Database {
2525
private var db: SQLiteDatabase // pointer to DB used in this class
2626
private var helper: internalDB? = null
27-
/**
28-
* Database object, using internal storage for this App (default DB file)
29-
*
30-
* @param context
31-
* @param dev set to true for unit tests<br></br>
32-
* no data will be saved
33-
*/
3427
/**
3528
* Database object
3629
*
3730
* @param context
3831
*/
39-
@JvmOverloads
4032
constructor(context: Context?) {
4133
if (dbIntern == null) {
4234
helper = internalDB(context)
@@ -55,7 +47,6 @@ class Database {
5547
/**
5648
* Retrieve vocable by ID
5749
* @param vocID
58-
* @param listID
5950
* @return VEntry with set List<br></br>
6051
* Null on failure
6152
*/
@@ -386,7 +377,7 @@ class Database {
386377
* Update or insert the provided VList data
387378
*
388379
* @param list
389-
* @return true on succuess
380+
* @return true on success
390381
*/
391382
fun upsertVList(list: VList, useTransaction: Boolean = true) {
392383
Log.v(TAG, "upsertVList")
@@ -776,7 +767,6 @@ class Database {
776767
* Returns a random entry from the specified table, which matches the trainer settings<br></br>
777768
* The VEntry is guaranteed to be not the "lastEntry" provided here
778769
*
779-
* @param list
780770
* @param ts
781771
* @param allowRepetition set to true to allow selecting the same vocable as lastEntry again
782772
* @return null on error
@@ -956,6 +946,7 @@ class Database {
956946
}
957947
}
958948

949+
@Suppress("ClassName")
959950
internal inner class internalDB(context: Context?) : SQLiteOpenHelper(context, DB_NAME_PRODUCTION, null, Companion.DATABASE_VERSION) {
960951
private val sqlLists = ("CREATE TABLE " + TBL_LISTS + " ("
961952
+ KEY_NAME_LIST + " TEXT NOT NULL,"
@@ -1127,12 +1118,13 @@ class Database {
11271118
upgrade2to3(db)
11281119
}
11291120
if (oldVersion < 4) {
1130-
upgrade3to4(db);
1121+
upgrade3to4(db)
11311122
}
11321123
val duration = System.currentTimeMillis() - start
11331124
Log.v(TAG, "upgrade end in $duration ms")
11341125
}
11351126

1127+
@Suppress("DEPRECATION")
11361128
fun upgrade3to4(db: SQLiteDatabase) {
11371129
db.execSQL(sqlSession)
11381130
db.execSQL(sqlSessionHistory)
@@ -1155,6 +1147,7 @@ class Database {
11551147
db.execSQL("DROP TABLE $TBL_SESSION_V3")
11561148
}
11571149

1150+
@Suppress("DEPRECATION")
11581151
fun upgrade2to3(db: SQLiteDatabase) {
11591152
val sqlSessionLists = ("CREATE TABLE " + TBL_SESSION_LISTS + " ("
11601153
+ KEY_LIST + " INTEGER PRIMARY KEY REFERENCES $TBL_LISTS($KEY_LIST) ON DELETE CASCADE )")
@@ -1289,6 +1282,7 @@ class Database {
12891282
db.execSQL("DROP TABLE $TBL_SESSION_VOC")
12901283
}
12911284

1285+
@Suppress("DEPRECATION")
12921286
fun upgrade1to2(db: SQLiteDatabase) {
12931287
val sqlOld_a = ("CREATE TABLE " + TBL_TABLES_V2 + " ("
12941288
+ KEY_NAME_TBL + " TEXT NOT NULL,"

0 commit comments

Comments
 (0)