Bug report #10091
Oracle provider SRID management
|Affected QGIS version:||2.2.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||18559|
when you open a layer in Oracle Spatial, the first query grabs the list of the tables with their SRID. Then Qgis launch a query per layer to grab the geometry type and SRID also:
SELECT DISTINCT t."COLONNE_GEOMETRIQUE".SDO_GTYPE,t."COLONNE_GEOMETRIQUE".SDO_SRID
FROM (SELECT "GEOM" FROM "SCHEMA"."TABLE_A_INTERROGER" WHERE "COLONNE_GEOMETRIQUE" IS NOT NULL AND rownum<=100) t
WHERE NOT t."COLONNE_GEOMETRIQUE" IS NULL;
When this table specific query is launched, a layerProperty.srids.clear() is made (see src/provider/oracle/qgsoracleconn.cpp). Then the SRID is computed from the results of the query above.
When you have an empty layer, this query returns nothing and then the SRID of the layer is unknown even when it is well declared in USER_SDO_GEOM_METADATA (or ALL_SDO_GEOM_METADATA).
So, I believe that the layerProperty.srids.clear() function should only be launched when there are SRIDs returned by the query above. If no SRIDs are returned, just keep the one that has been returned for the complete tables list query. I think that the layerProperty.srids.clear() statement should be in the bloc code that get the srids (and the geometry). Otherwise it can perhaps be completly removed...