Skip to content
Permalink
Browse files

close connection when deleting oracle transaction

  • Loading branch information
troopa81 authored and nyalldawson committed Oct 21, 2019
1 parent 94d0b06 commit 00d0a062d341d66aed6e73704d59d93dc52fd853
@@ -201,6 +201,7 @@ void QgsOracleConn::reconnect()

void QgsOracleConn::unref()
{
QMutexLocker locker( &mLock );
if ( --mRef > 0 )
return;

@@ -218,7 +219,9 @@ void QgsOracleConn::unref()
}
}

deleteLater();
// to avoid destroying locked mutex
locker.unlock();
delete this;
}

bool QgsOracleConn::exec( QSqlQuery &qry, const QString &sql, const QVariantList &params )
@@ -29,6 +29,12 @@ QgsOracleTransaction::QgsOracleTransaction( const QString &connString )

}

QgsOracleTransaction::~QgsOracleTransaction()
{
if ( mConn )
mConn->unref();
}

bool QgsOracleTransaction::beginTransaction( QString &, int /* statementTimeout */ )
{
mConn = QgsOracleConn::connectDb( mConnString, true /*transaction*/ );
@@ -33,6 +33,8 @@ class QgsOracleTransaction : public QgsTransaction
public:
explicit QgsOracleTransaction( const QString &connString );

~QgsOracleTransaction() override;

bool executeSql( const QString &sql, QString &error, bool isDirty = false, const QString &name = QString() ) override;

QgsOracleConn *connection() const { return mConn; }

0 comments on commit 00d0a06

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