I am trying to loop a insert command, but I keep getting a "A SQLiteConnection object for database was leaked!" error, even though I close the database at the end. I am using Android studio and Java.
For example
SQLiteDatabase db = this.getWritableDatabase();
Iterator<String> it = jsonStats.getJSONObject("ret").keys();
while (it.hasNext())
{
String key = it.next();
Object value = jsonStats.getJSONObject("ret").get(key);
db.execSQL("INSERT INTO " + STATS_TABLE + " VALUES " + "('" + key + "','" + value.toString() + "');");
}
db.close();
This prints out a single leaked error even though the data is added properly to the database.
Aucun commentaire:
Enregistrer un commentaire