Skip to content
Permalink
Browse files

add support for FilterFids to oracle provider (followup 0c90f32)

  • Loading branch information
jef-n committed Sep 19, 2013
1 parent df7f39c commit bde81e3bdcf6f2763f4f6340d797ffc164206f0a
@@ -77,6 +77,10 @@ QgsOracleFeatureIterator::QgsOracleFeatureIterator( QgsOracleProvider *p, const
whereClause = P->whereClause( request.filterFid() );
break;

case QgsFeatureRequest::FilterFids:
whereClause = P->whereClause( request.filterFids() );
break;

case QgsFeatureRequest::FilterNone:
break;
}
@@ -105,7 +109,7 @@ QgsOracleFeatureIterator::~QgsOracleFeatureIterator()
close();
}

bool QgsOracleFeatureIterator::nextFeature( QgsFeature& feature )
bool QgsOracleFeatureIterator::fetchFeature( QgsFeature& feature )
{
feature.setValid( false );

@@ -219,6 +223,8 @@ bool QgsOracleFeatureIterator::nextFeature( QgsFeature& feature )
}

feature.setValid( true );
feature.setFields( &P->mAttributeFields ); // allow name-based attribute lookups

return true;
}
}
@@ -32,22 +32,20 @@ class QgsOracleFeatureIterator : public QgsAbstractFeatureIterator

~QgsOracleFeatureIterator();

//! fetch next feature, return true on success
virtual bool nextFeature( QgsFeature& feature );

//! reset the iterator to the starting position
virtual bool rewind();

//! end of iterating: free the resources / lock
virtual bool close();

protected:
//! fetch next feature, return true on success
virtual bool fetchFeature( QgsFeature& feature );

QgsOracleProvider *P;

bool openQuery( QString whereClause );

bool getFeature( QgsFeature &feature );

QSqlQuery mQry;
bool mRewind;
QgsAttributeList mAttributeList;
@@ -464,15 +464,17 @@ QString QgsOracleProvider::whereClause( QgsFeatureId featureId ) const
break;
}

if ( !mSqlWhereClause.isEmpty() )
{
if ( !whereClause.isEmpty() )
whereClause += " AND ";
return whereClause;
}

whereClause += "(" + mSqlWhereClause + ")";
QString QgsOracleProvider::whereClause( QgsFeatureIds featureIds ) const
{
QStringList whereClauses;
foreach ( const QgsFeatureId featureId, featureIds )
{
whereClauses << whereClause( featureId );
}

return whereClause;
return whereClauses.join( " AND " );
}

void QgsOracleProvider::setExtent( QgsRectangle& newExtent )
@@ -262,6 +262,7 @@ class QgsOracleProvider : public QgsVectorDataProvider

private:
QString whereClause( QgsFeatureId featureId ) const;
QString whereClause( QgsFeatureIds featureIds ) const;
QString pkParamWhereClause() const;
QString paramValue( QString fieldvalue, const QString &defaultValue ) const;
void appendGeomParam( const QgsGeometry *geom, QSqlQuery &qry ) const;
@@ -47,8 +47,6 @@ class QgsPostgresFeatureIterator : public QgsAbstractFeatureIterator
void getFeatureAttribute( int idx, QgsPostgresResult& queryResult, int row, int& col, QgsFeature& feature );
bool declareCursor( const QString& whereClause );

bool fetchNextFeature( QgsFeature& feature );

QString mCursorName;

/**

0 comments on commit bde81e3

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