jeudi 22 janvier 2015

Java SQLite Update query not working

After hours (basically the entire day) of wriggling around, wrapping my throughts and whatnot, I am baffled as to why my UPDATE statement in SQLite does not want to work. It concerns the following queries:



sql.Update("UPDATE SAVEGAME SET _id = \"save\" WHERE _id = null");
sql.Update("UPDATE SAVEGAME SET WORLD_ONE = \""+finishedLevels+"\" WHERE _id = 'save'");


I've also tried



sql.Update("UPDATE SAVEGAME SET _id = 'save' WHERE _id = null");
sql.Update("UPDATE SAVEGAME SET WORLD_ONE = '"+finishedLevels+"' WHERE _id = 'save'");


but to no avail.


The function I'm calling is this:



public void Update(String query){
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL(query);

db.close();
}


Debugging clearly shows that the functions is being called and stepped through but refuses to work. Any other SQL function I call (e.g. to create new tables etc.) all have their db.close() call present.


I've also tried looking at a different project where the UDPATE statement does work, but I can't find any differences (instance of my SQLLib class, function calls are the same, etc.) It would seem so simple to call an UPDATE statement, but it has a fault somewhere.


Where is this fault? Because I'm at a total loss now.


-Zubaja


Aucun commentaire:

Enregistrer un commentaire