Skip to content
Permalink
Browse files

Replace use of deprecated methods

  • Loading branch information
nyalldawson committed Aug 18, 2018
1 parent aa51263 commit 1d62de3f1b764b918f405338e724a6c919a9ccef
@@ -3605,7 +3605,7 @@ static QVariant fcnGetFeatureById( const QVariantList &values, const QgsExpressi

QgsFeatureRequest req;
req.setFilterFid( fid );
req.setConnectionTimeout( 10000 );
req.setTimeout( 10000 );
req.setRequestMayBeNested( true );
QgsFeatureIterator fIt = vl->getFeatures( req );

@@ -3648,7 +3648,7 @@ static QVariant fcnGetFeature( const QVariantList &values, const QgsExpressionCo
req.setFilterExpression( QStringLiteral( "%1=%2" ).arg( QgsExpression::quotedColumnRef( attribute ),
QgsExpression::quotedString( attVal.toString() ) ) );
req.setLimit( 1 );
req.setConnectionTimeout( 10000 );
req.setTimeout( 10000 );
req.setRequestMayBeNested( true );
if ( !parent->needsGeometry() )
{
@@ -46,7 +46,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
, mSharedDS( source->mSharedDS )
{
// Since connection timeout for OGR connections is problematic and can lead to crashes, disable for now.
mRequest.setConnectionTimeout( -1 );
mRequest.setTimeout( -1 );
if ( mSharedDS )
{
mOgrLayer = mSharedDS->createSQLResultLayer( mSource->mEncoding, mSource->mLayerName, mSource->mLayerIndex );
@@ -58,7 +58,7 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource *source, bool
else
{
//QgsDebugMsg( "Feature iterator of " + mSource->mLayerName + ": acquiring connection");
mConn = QgsOgrConnPool::instance()->acquireConnection( QgsOgrProviderUtils::connectionPoolId( mSource->mDataSource ), mRequest.connectionTimeout(), mRequest.requestMayBeNested() );
mConn = QgsOgrConnPool::instance()->acquireConnection( QgsOgrProviderUtils::connectionPoolId( mSource->mDataSource ), mRequest.timeout(), mRequest.requestMayBeNested() );
if ( !mConn || !mConn->ds )
{
return;
@@ -38,7 +38,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource

if ( !source->mTransactionConnection )
{
mConn = QgsPostgresConnPool::instance()->acquireConnection( mSource->mConnInfo, request.connectionTimeout(), request.requestMayBeNested() );
mConn = QgsPostgresConnPool::instance()->acquireConnection( mSource->mConnInfo, request.timeout(), request.requestMayBeNested() );
mIsTransactionConnection = false;
}
else
@@ -29,7 +29,7 @@
QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeatureSource *source, bool ownSource, const QgsFeatureRequest &request )
: QgsAbstractFeatureIteratorFromSource<QgsSpatiaLiteFeatureSource>( source, ownSource, request )
{
mHandle = QgsSpatiaLiteConnPool::instance()->acquireConnection( mSource->mSqlitePath, request.connectionTimeout(), request.requestMayBeNested() );
mHandle = QgsSpatiaLiteConnPool::instance()->acquireConnection( mSource->mSqlitePath, request.timeout(), request.requestMayBeNested() );

mFetchGeometry = !mSource->mGeometryColumn.isNull() && !( mRequest.flags() & QgsFeatureRequest::NoGeometry );
mHasPrimaryKey = !mSource->mPrimaryKey.isEmpty();
@@ -1291,10 +1291,10 @@ bool QgsWFSFeatureIterator::fetchFeature( QgsFeature &f )
QTimer timer( this );
timer.start( 50 );
QTimer requestTimeout( this );
if ( mRequest.connectionTimeout() > 0 )
if ( mRequest.timeout() > 0 )
{
connect( &requestTimeout, &QTimer::timeout, this, &QgsWFSFeatureIterator::timeout );
requestTimeout.start( mRequest.connectionTimeout() );
requestTimeout.start( mRequest.timeout() );
}
if ( mInterruptionChecker )
connect( &timer, &QTimer::timeout, this, &QgsWFSFeatureIterator::checkInterruption );
@@ -366,7 +366,7 @@ def testTimeout(self):
available in the connection pool
"""
request = QgsFeatureRequest()
request.setConnectionTimeout(1)
request.setTimeout(1)

iterators = list()
for i in range(100):

0 comments on commit 1d62de3

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