Ticket #4694 (new defect)
Oracle driver writes to metadata table when reading
|Reported by:||marcbria||Owned by:||warmerdam|
|Severity:||critical||Keywords:||Oracle, OCI, OGR|
|Cc:||msmitherdc, ilucena, andersmoe|
Description (last modified by marcbria) (diff)
This bug causes two erroneous things to happen:
- Connecting to an Oracle database and then disconnecting causes the Oracle driver to write updated extents information to the SDO_GEOM_METADATA_TABLE table for all detected layers.
- If a user connects using an OCI connection string which specifies a table name but that table either does not exist in the database or is not a spatial layer it is also written to the SDO_GEOM_METADATA_TABLE. If the user subsequently tries to connect and disconnect a duplicate record exception is thrown.
My proposed solution involves modifying ogrocitablelayer.cpp
- Set the boolean flag bExtentUpdated to false during the OGROCITableLayer() constructor. This way when the connection is destroyed and SyncToDisk?() gets called the UpdateLayerExtents?() method will not save updated extents to the SDO_GEOM_METADATA_TABLE unless new features have been added or removed.
- Restore the code in UpdateLayerExtents?() which looks for a degenerate extent and does not update the SDO_GEOM_METADATA_TABLE accordingly.
I've made these modifications on my own and they do not appear to have any adverse effects however I don't have a complete understanding of the OGR drivers and I'm not sure what ramifications it may have.