Skip to content

Commit

Permalink
Revert oracle server-side simplication
Browse files Browse the repository at this point in the history
(reverts 6f70953 and 772dc1d)
  • Loading branch information
jef-n committed Feb 1, 2016
1 parent 87887e4 commit 5ba6e68
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 74 deletions.
16 changes: 0 additions & 16 deletions src/providers/oracle/qgsoracleconn.cpp
Expand Up @@ -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() );

Expand Down Expand Up @@ -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 )
Expand Down
4 changes: 0 additions & 4 deletions src/providers/oracle/qgsoracleconn.h
Expand Up @@ -139,7 +139,6 @@ class QgsOracleConn : public QObject
QString currentUser();

bool hasSpatial();
int majorVersion();

static const int sGeomTypeSelectLimit;

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

//! major database version
int mMajorVersion;

QSqlDatabase mDatabase;
QSqlQuery mQuery;

Expand Down
41 changes: 1 addition & 40 deletions src/providers/oracle/qgsoraclefeatureiterator.cpp
Expand Up @@ -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 );
Expand Down Expand Up @@ -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 = ",";
}

Expand Down Expand Up @@ -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 )
Expand Down
7 changes: 0 additions & 7 deletions src/providers/oracle/qgsoraclefeatureiterator.h
Expand Up @@ -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
7 changes: 0 additions & 7 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -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 )
{
Expand Down

0 comments on commit 5ba6e68

Please sign in to comment.