-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SQLite] Transaction field handling: intial implementation #11609
[SQLite] Transaction field handling: intial implementation #11609
Conversation
23c1cb9
to
fc50c12
Compare
Fix out of sync (not restored) fields after a ROLLBACK.
fc50c12
to
add4a0d
Compare
@@ -1710,6 +1717,13 @@ OGRSQLiteTableLayer::CreateGeomField(const OGRGeomFieldDefn *poGeomFieldIn, | |||
} | |||
} | |||
|
|||
if (m_poDS->IsInTransaction()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bit of dissymetry with the call to AddFieldDefn() in CreateField() having been done before the "if IsInTransation())" logic and here where AddGeomFieldDefn() is done after the IsInTransaction() test (note that if you symmetrize things you need to add/remove a -1 index to GetFieldCount/GetGeomFieldCount)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason for the dissimetry is because poGeomField is (already was) a unique ptr whic would be null after the move. I will add a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment added
eb87b6e
to
90f441a
Compare
In the documentation of RollbackTransaction() (in ogr/ogrsf_frmts/ogrsf_frmts.dox), it should probably be mentioned that OGRFeature* instances acquired or created between the StartTransaction() and RollbackTransaction() should be destroyed before RollbackTransaction() if the field structure has been modified during the transaction.
this must be corrected as:
|
Co-authored-by: Even Rouault <[email protected]>
ogr/ogrsf_frmts/ogrsf_frmts.h
Outdated
{ | ||
ADD, | ||
ALTER, | ||
DELETE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears there must be a #define DELETE somewhere in a Windows system header... So maybe switch to Add/Alter/Delete or add a _FIELD suffix ?
macos_build CI failure unrelated and will be addressed per #11621 |
Fix out of sync (not restored) fields after a ROLLBACK.
See: qgis/QGIS#59797 (comment)
This is an SQLite only fix, if the approach sounds reasonable we should consider supporting more drivers.
Funded by: QGIS.org