Skip to content
Permalink
Browse files

Revert oracle server-side simplication

(reverts 6f70953 and 772dc1d)
  • Loading branch information
jef-n committed Feb 1, 2016
1 parent 87887e4 commit 5ba6e682a7eb1e9238b459ea2ad8b97e18e52940
@@ -59,7 +59,6 @@ QgsOracleConn::QgsOracleConn( QgsDataSourceURI uri )
: mRef( 1 )
, mCurrentUser( QString::null )
, mHasSpatial( -1 )
, mMajorVersion( -1 )
{
QgsDebugMsg( QString( "New Oracle connection for " ) + uri.connectionInfo() );

@@ -774,21 +773,6 @@ QString QgsOracleConn::databaseName( QString database, QString host, QString por
return db;
}

int QgsOracleConn::majorVersion()
{
if ( mMajorVersion == -1 )
{
QSqlQuery qry( mDatabase );
if ( exec( qry, "SELECT banner FROM v$version WHERE banner LIKE 'Oracle Database%'" ) && qry.next() )
{
QRegExp vers( "([0-9]+)\\.[0-9\\.]+[0-9]" );
if ( vers.indexIn( qry.value( 0 ).toString() ) >= 0 )
mMajorVersion = vers.cap( 1 ).toInt();
}
}
return mMajorVersion;
}

bool QgsOracleConn::hasSpatial()
{
if ( mHasSpatial == -1 )
@@ -139,7 +139,6 @@ class QgsOracleConn : public QObject
QString currentUser();

bool hasSpatial();
int majorVersion();

static const int sGeomTypeSelectLimit;

@@ -178,9 +177,6 @@ class QgsOracleConn : public QObject
//! has spatial
int mHasSpatial;

//! major database version
int mMajorVersion;

QSqlDatabase mDatabase;
QSqlQuery mQuery;

@@ -148,27 +148,6 @@ bool QgsOracleFeatureIterator::nextFeatureFilterExpression( QgsFeature& f )
return fetchFeature( f );
}

bool QgsOracleFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod )
{
// setup simplification of geometries to fetch
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) &&
simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification &&
!simplifyMethod.forceLocalOptimization() )
{
QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType();

if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
{
return true;
}
else
{
QgsDebugMsg( QString( "Simplification method type (%1) is not recognised by OracleFeatureIterator" ).arg( methodType ) );
}
}
return QgsAbstractFeatureIterator::prepareSimplification( simplifyMethod );
}

bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
{
feature.setValid( false );
@@ -337,20 +316,7 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )

if (( mRequest.flags() & QgsFeatureRequest::NoGeometry ) == 0 && !mSource->mGeometryColumn.isNull() )
{
if ( !mRequest.simplifyMethod().forceLocalOptimization() &&
mRequest.simplifyMethod().methodType() == QgsSimplifyMethod::OptimizeForRendering &&
QGis::flatType( QGis::singleType( mSource->mRequestedGeomType != QGis::WKBUnknown
? mSource->mRequestedGeomType
: mSource->mDetectedGeomType ) ) != QGis::WKBPoint )
{
query += QString( "SDO_UTIL.SIMPLIFY( %1, %2 )" )
.arg( QgsOracleProvider::quotedIdentifier( mSource->mGeometryColumn ) )
.arg( mRequest.simplifyMethod().tolerance() * 0.7 ); //-> We use a smaller tolerance than pre-filtering to be on the safe side
}
else
{
query += QgsOracleProvider::quotedIdentifier( mSource->mGeometryColumn );
}
query += QgsOracleProvider::quotedIdentifier( mSource->mGeometryColumn );
delim = ",";
}

@@ -411,11 +377,6 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )
return true;
}

bool QgsOracleFeatureIterator::providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const
{
return ( mConnection->majorVersion() > 10 || mConnection->hasSpatial() ) && methodType == QgsSimplifyMethod::OptimizeForRendering;
}

// -----------

QgsOracleFeatureSource::QgsOracleFeatureSource( const QgsOracleProvider* p )
@@ -76,20 +76,13 @@ class QgsOracleFeatureIterator : public QgsAbstractFeatureIteratorFromSource<Qgs
//! fetch next feature filter expression
bool nextFeatureFilterExpression( QgsFeature& f ) override;

//! Setup the simplification of geometries to fetch using the specified simplify method
virtual bool prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) override;

bool openQuery( QString whereClause );

QgsOracleConn *mConnection;
QSqlQuery mQry;
bool mRewind;
bool mExpressionCompiled;
QgsAttributeList mAttributeList;

private:
//! returns whether the iterator supports simplify geometries on provider side
virtual bool providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const override;
};

#endif // QGSORACLEFEATUREITERATOR_H
@@ -747,13 +747,6 @@ bool QgsOracleProvider::hasSufficientPermsAndCapabilities()

mEnabledCapabilities = QgsVectorDataProvider::SelectAtId | QgsVectorDataProvider::SelectGeometryAtId;

if ( mConnection->majorVersion() > 10 || mConnection->hasSpatial() )
{
// 10g doesn't support SDO_UTIL in Oracle Locator
// supports geometry simplification on provider side
mEnabledCapabilities |= QgsVectorDataProvider::SimplifyGeometries;
}

QSqlQuery qry( *mConnection );
if ( !mIsQuery )
{

0 comments on commit 5ba6e68

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