Unsolved UNIQUE CONSTRAINT FAILED on submitAll()
Hi there, I'm experiencing a rather annoying problem.
Briefly summarized, I have a SQLite3 table with UNIQUE constraint applied over 2 integer fields.
As of now, I'm populating such table with 8 rows using all combinations of ([1-2], [1-4]) for fields A and B respectively. So far, so good.
Problems arise whenever I try to swap rows (that means, reassigning those 2 fields among the 8 rows): even if I check not to make duplicates and the table looks good,
submitAll()fails returning UNIQUE CONSTRAINT FAILED.
I believe this has to do with the way
submitAll()works, which probably tries to update each line individually hence obviously creating a duplicate. If I were to write SQL I would obviously use an INSERT OR REPLACE statement.
I wonder if there's anything I can do to stick with QSql classes and avoid converting a ton of code into SQL statements...