vendredi 17 avril 2015

INSERT OR IGNORE inserting duplicate statements

So I'm having issues with my SQL queries, first I run this to make sure that the entry is in the database:



"INSERT OR IGNORE INTO `scores` (`uuid`) VALUES ('" + stat.player + "')"


Next I run:



"UPDATE scores SET uuid = '" + stat.player + "', level = '"
+ stat.level + "', xp = '" + stat.xp
+ "', xpToNextLevel = '" + stat.xpToNextLevel
+ "', attackPoints = '" + stat.attackPoints
+ "', defencePoints = '" + stat.defencePoints
+ "', kills = '" + stat.kills + "', deaths = '"
+ stat.deaths + "', monsterKills = '" + stat.monsterKills
+ "' WHERE uuid = '" + stat.player + "'"\


My problem is that running the "INSERT OR IGNORE" isn't ignoring if there is a duplicate value. It will insert a new row with the same uuid every time I run it, and update all the rows with the same uuid.


I'm guessing I'm probably missing something, if you could help out I would really appreciate it ;) (been working on trying to fix this for 2 days)


Aucun commentaire:

Enregistrer un commentaire