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 8c4bfa3f6093f6a2baa6eb0a47ebd0c1a2aa94dd
Showing with 9 additions and 6 deletions.
  1. +9 −6 src/providers/mssql/qgsmssqlfeatureiterator.cpp
@@ -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.
You can’t perform that action at this time.