Skip to content
Permalink
Browse files
[MSSQL] Close database and delete query on close
  • Loading branch information
NathanW2 committed Mar 26, 2014
1 parent d047ea0 commit 8c4bfa3
Showing 1 changed file with 9 additions and 6 deletions.
@@ -55,12 +55,6 @@ QgsMssqlFeatureIterator::QgsMssqlFeatureIterator( QgsMssqlFeatureSource* source,
QgsMssqlFeatureIterator::~QgsMssqlFeatureIterator()
{
close();

if ( mQuery )
delete mQuery;

if (mDatabase.isOpen())
mDatabase.close();
}

void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest& request )
@@ -224,6 +218,9 @@ bool QgsMssqlFeatureIterator::fetchFeature( QgsFeature& feature )

bool QgsMssqlFeatureIterator::rewind()
{
if ( mClosed )
return false;

if ( mStatement.isEmpty() )
{
QgsDebugMsg( "QgsMssqlFeatureIterator::rewind on empty statement" );
@@ -260,6 +257,12 @@ bool QgsMssqlFeatureIterator::close()
mQuery->finish();
}

if ( mQuery )
delete mQuery;

if (mDatabase.isOpen())
mDatabase.close();

iteratorClosed();

mClosed = true;

0 comments on commit 8c4bfa3

Please sign in to comment.