Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.6.2, 6.7.0, 6.8.0
Description
Reproducer included. Build and run with 6.6.x or 6.7.x. Actually, I am not sure if it's bug. But the behavior is kind of counter intuitive. Either a change in behavior or more detailed explanation in doc will be appreciated.
The issue is that the PRIMARY KEY marked by AUTOINCREMENT is not auto-incremented ("id" is always 0) until submitAll by which everything is final and irrevocable. Another observation is that the other column "name" behaves as expected, i.e. it has been the correct value "Julen" even before submitAll. So when you run the reproducer, you may see something like:
Before submit OK QVariant(int, 0) QVariant(QString, "Julen") Last inserted ID: 1 After submit OK QVariant(qlonglong, 1) QVariant(QString, "Julen")
You can see that "id" has not been correctly incremented until submission. Although "name" has always been correct. Also, explicitly marking "id" as "autoValue" does not help here. "id" is marked by AUTOINCREMENT at the time of table creation so I guess "setAutoValue(true)" does not make any difference here.