@@ -24,19 +24,11 @@ import vocabletrainer.heinecke.aron.vocabletrainer.trainer.TrainerSettings
24
24
class Database {
25
25
private var db: SQLiteDatabase // pointer to DB used in this class
26
26
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
- */
34
27
/* *
35
28
* Database object
36
29
*
37
30
* @param context
38
31
*/
39
- @JvmOverloads
40
32
constructor (context: Context ? ) {
41
33
if (dbIntern == null ) {
42
34
helper = internalDB(context)
@@ -55,7 +47,6 @@ class Database {
55
47
/* *
56
48
* Retrieve vocable by ID
57
49
* @param vocID
58
- * @param listID
59
50
* @return VEntry with set List<br></br>
60
51
* Null on failure
61
52
*/
@@ -386,7 +377,7 @@ class Database {
386
377
* Update or insert the provided VList data
387
378
*
388
379
* @param list
389
- * @return true on succuess
380
+ * @return true on success
390
381
*/
391
382
fun upsertVList (list : VList , useTransaction : Boolean = true) {
392
383
Log .v(TAG , " upsertVList" )
@@ -776,7 +767,6 @@ class Database {
776
767
* Returns a random entry from the specified table, which matches the trainer settings<br></br>
777
768
* The VEntry is guaranteed to be not the "lastEntry" provided here
778
769
*
779
- * @param list
780
770
* @param ts
781
771
* @param allowRepetition set to true to allow selecting the same vocable as lastEntry again
782
772
* @return null on error
@@ -956,6 +946,7 @@ class Database {
956
946
}
957
947
}
958
948
949
+ @Suppress(" ClassName" )
959
950
internal inner class internalDB (context : Context ? ) : SQLiteOpenHelper(context, DB_NAME_PRODUCTION , null , Companion .DATABASE_VERSION ) {
960
951
private val sqlLists = (" CREATE TABLE " + TBL_LISTS + " ("
961
952
+ KEY_NAME_LIST + " TEXT NOT NULL,"
@@ -1127,12 +1118,13 @@ class Database {
1127
1118
upgrade2to3(db)
1128
1119
}
1129
1120
if (oldVersion < 4 ) {
1130
- upgrade3to4(db);
1121
+ upgrade3to4(db)
1131
1122
}
1132
1123
val duration = System .currentTimeMillis() - start
1133
1124
Log .v(TAG , " upgrade end in $duration ms" )
1134
1125
}
1135
1126
1127
+ @Suppress(" DEPRECATION" )
1136
1128
fun upgrade3to4 (db : SQLiteDatabase ) {
1137
1129
db.execSQL(sqlSession)
1138
1130
db.execSQL(sqlSessionHistory)
@@ -1155,6 +1147,7 @@ class Database {
1155
1147
db.execSQL(" DROP TABLE $TBL_SESSION_V3 " )
1156
1148
}
1157
1149
1150
+ @Suppress(" DEPRECATION" )
1158
1151
fun upgrade2to3 (db : SQLiteDatabase ) {
1159
1152
val sqlSessionLists = (" CREATE TABLE " + TBL_SESSION_LISTS + " ("
1160
1153
+ KEY_LIST + " INTEGER PRIMARY KEY REFERENCES $TBL_LISTS ($KEY_LIST ) ON DELETE CASCADE )" )
@@ -1289,6 +1282,7 @@ class Database {
1289
1282
db.execSQL(" DROP TABLE $TBL_SESSION_VOC " )
1290
1283
}
1291
1284
1285
+ @Suppress(" DEPRECATION" )
1292
1286
fun upgrade1to2 (db : SQLiteDatabase ) {
1293
1287
val sqlOld_a = (" CREATE TABLE " + TBL_TABLES_V2 + " ("
1294
1288
+ KEY_NAME_TBL + " TEXT NOT NULL,"
0 commit comments