Skip to content
Permalink
Browse files

oracle provider: fix geometry type/srid detection for queries

  • Loading branch information
jef-n authored and rldhont committed Dec 16, 2015
1 parent 7971d09 commit 2924323b1e4d02d2c8a9d4a832606d02acb57d44
Showing with 29 additions and 14 deletions.
  1. +12 −1 src/providers/oracle/ocispatial/qsql_ocispatial.cpp
  2. +17 −13 src/providers/oracle/qgsoracleprovider.cpp
@@ -3075,7 +3075,18 @@ int QOCISpatialResult::numRowsAffected()
bool QOCISpatialResult::prepare( const QString& query )
{
ENTER
qDebug() << "prepare(" << query << ")";

static int sDebugLevel = -1;
if ( sDebugLevel < 0 )
{
if ( getenv( "QGIS_DEBUG" ) )
sDebugLevel = atoi( getenv( "QGIS_DEBUG" ) );
else
sDebugLevel = 0;
}

if ( sDebugLevel >= 4 )
qDebug() << "prepare(" << query << ")";

int r = 0;
QSqlResult::prepare( query );
@@ -2219,23 +2219,27 @@ bool QgsOracleProvider::getGeometryDetails()
if ( detectedType == QGis::WKBUnknown || detectedSrid <= 0 )
{
QgsOracleLayerProperty layerProperty;
layerProperty.ownerName = ownerName;
layerProperty.tableName = tableName;
layerProperty.geometryColName = mGeometryColumn;
layerProperty.types << detectedType;
layerProperty.srids << detectedSrid;

QString delim = "";

if ( !mSqlWhereClause.isEmpty() )
if ( !mIsQuery )
{
layerProperty.sql += delim + "(" + mSqlWhereClause + ")";
delim = " AND ";
}
layerProperty.ownerName = ownerName;
layerProperty.tableName = tableName;
layerProperty.geometryColName = mGeometryColumn;
layerProperty.types << detectedType;
layerProperty.srids << detectedSrid;

QString delim = "";

mConnection->retrieveLayerTypes( layerProperty, mUseEstimatedMetadata, false );
if ( !mSqlWhereClause.isEmpty() )
{
layerProperty.sql += delim + "(" + mSqlWhereClause + ")";
delim = " AND ";
}

mConnection->retrieveLayerTypes( layerProperty, mUseEstimatedMetadata, false );

Q_ASSERT( layerProperty.types.size() == layerProperty.srids.size() );
Q_ASSERT( layerProperty.types.size() == layerProperty.srids.size() );
}

if ( layerProperty.types.isEmpty() )
{

0 comments on commit 2924323

Please sign in to comment.
You can’t perform that action at this time.