Skip to content
Permalink
Browse files
Revert "Add connection pool for OGR provider"
This reverts commit a64ffc4.
  • Loading branch information
pka committed May 22, 2015
1 parent e5fcbc3 commit 06ae01e009c1ef7ab99d8e5c107971996493227b
@@ -1,7 +1,7 @@

SET (OGR_SRCS qgsogrprovider.cpp qgsogrdataitems.cpp qgsogrfeatureiterator.cpp qgsogrgeometrysimplifier.cpp qgsogrconnpool.cpp)
SET (OGR_SRCS qgsogrprovider.cpp qgsogrdataitems.cpp qgsogrfeatureiterator.cpp qgsogrgeometrysimplifier.cpp)

SET(OGR_MOC_HDRS qgsogrprovider.h qgsogrdataitems.h qgsogrconnpool.h)
SET(OGR_MOC_HDRS qgsogrprovider.h qgsogrdataitems.h)

########################################################
# Build

This file was deleted.

This file was deleted.

@@ -35,26 +35,27 @@

QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
: QgsAbstractFeatureIteratorFromSource<QgsOgrFeatureSource>( source, ownSource, request )
, ogrDataSource( 0 )
, ogrLayer( 0 )
, mSubsetStringSet( false )
, mGeometrySimplifier( NULL )
{
mFeatureFetched = false;

mConn = QgsOgrConnPool::instance()->acquireConnection( mSource->mFilePath );
ogrDataSource = OGROpen( TO8F( mSource->mFilePath ), false, NULL );

if ( mSource->mLayerName.isNull() )
{
ogrLayer = OGR_DS_GetLayer( mConn->ds, mSource->mLayerIndex );
ogrLayer = OGR_DS_GetLayer( ogrDataSource, mSource->mLayerIndex );
}
else
{
ogrLayer = OGR_DS_GetLayerByName( mConn->ds, TO8( mSource->mLayerName ) );
ogrLayer = OGR_DS_GetLayerByName( ogrDataSource, TO8( mSource->mLayerName ) );
}

if ( !mSource->mSubsetString.isEmpty() )
{
ogrLayer = QgsOgrUtils::setSubsetString( ogrLayer, mConn->ds, mSource->mEncoding, mSource->mSubsetString );
ogrLayer = QgsOgrUtils::setSubsetString( ogrLayer, ogrDataSource, mSource->mEncoding, mSource->mSubsetString );
mSubsetStringSet = true;
}

@@ -217,13 +218,13 @@ bool QgsOgrFeatureIterator::close()

if ( mSubsetStringSet )
{
OGR_DS_ReleaseResultSet( mConn->ds, ogrLayer );
OGR_DS_ReleaseResultSet( ogrDataSource, ogrLayer );
}

QgsOgrConnPool::instance()->releaseConnection( mConn );
mConn = 0;
OGR_DS_Destroy( ogrDataSource );

mClosed = true;
ogrDataSource = 0;
return true;
}

@@ -16,7 +16,6 @@
#define QGSOGRFEATUREITERATOR_H

#include "qgsfeatureiterator.h"
#include "qgsogrconnpool.h"

#include <ogr_api.h>

@@ -72,7 +71,7 @@ class QgsOgrFeatureIterator : public QgsAbstractFeatureIteratorFromSource<QgsOgr

bool mFeatureFetched;

QgsOgrConn* mConn;
OGRDataSourceH ogrDataSource;
OGRLayerH ogrLayer;

bool mSubsetStringSet;

0 comments on commit 06ae01e

Please sign in to comment.