Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Spatialite transactions: better error logging
  • Loading branch information
elpaso committed Apr 1, 2020
1 parent d680db5 commit c52d79e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/providers/spatialite/qgsspatialitetransaction.cpp
Expand Up @@ -55,19 +55,25 @@ bool QgsSpatiaLiteTransaction::executeSql( const QString &sql, QString &errorMsg
return false;
}

QString err;
if ( isDirty )
{
createSavepoint( err );
createSavepoint( errorMsg );
if ( ! errorMsg.isEmpty() )
{
QgsDebugMsg( errorMsg );
return false;
}
}

char *errMsg = nullptr;
if ( sqlite3_exec( mSqliteHandle, sql.toUtf8().constData(), nullptr, nullptr, &errMsg ) != SQLITE_OK )
{
QgsDebugMsg( errorMsg );
if ( isDirty )
{
rollbackToSavepoint( savePoints().last(), err );
rollbackToSavepoint( savePoints().last(), errorMsg );
}
errorMsg = QStringLiteral( "%1\n%2" ).arg( errMsg, errorMsg );
QgsDebugMsg( errMsg );
sqlite3_free( errMsg );
return false;
}
Expand Down

0 comments on commit c52d79e

Please sign in to comment.