Ticket #4694 (new defect)

Opened 12 months ago

Last modified 11 months ago

Oracle driver writes to metadata table when reading

Reported by: marcbria Owned by: warmerdam
Priority: normal Milestone:
Component: OGR_SF Version: svn-trunk
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.

Attachments

ogrocitablelayer.patch Download (347 bytes) - added by nicsim 11 months ago.

Change History

Changed 12 months ago by marcbria

  • description modified (diff)

Changed 12 months ago by warmerdam

  • cc ilucena, andersmoe added
  • component changed from default to OGR_SF

The offending change seems to have been related to #4079.

I'm not sure that I will have time to work on this, so anyone else is welcome to take a crack at it.

Changed 12 months ago by ilucena

If you want to send your changes as a patch we could integrate it on trunk.

Changed 11 months ago by nicsim

Here is a patch for the constructor

Changed 11 months ago by nicsim

Note: See TracTickets for help on using tickets.