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 c495b4c commit aebb32bb7097164bc986220dfdc29f133e53f8f9
@@ -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 aebb32b

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