commit error update:

- push commit errors in PostgreSQL, OGR and SpatiaLite provider
- add provider errors to commit error
- postgres provider: improve handling of geography columns
This commit is contained in:
Juergen E. Fischer 2012-01-17 00:47:03 +01:00
parent 0c9e60fb69
commit 98876da998
7 changed files with 100 additions and 64 deletions

View File

@ -3800,10 +3800,15 @@ bool QgsVectorLayer::commitChanges()
mAddedFeatures.clear();
}
else
{
mCommitErrors << tr( "ERROR: %n feature(s) not added.", "not added features count", mAddedFeatures.size() );
success = false;
}
}
else
{
mCommitErrors << tr( "ERROR: %n feature(s) not added.", "not added features count", mAddedFeatures.size() );
mCommitErrors << tr( "ERROR: %n feature(s) not added - provider doesn't support adding features.", "not added features count", mAddedFeatures.size() );
success = false;
}
}
@ -3854,6 +3859,17 @@ bool QgsVectorLayer::commitChanges()
}
}
if ( !success )
{
if ( mDataProvider->hasErrors() )
{
mCommitErrors << tr( "\n Provider errors:" ) << mDataProvider->errors();
mDataProvider->clearErrors();
}
QgsMessageLog::logMessage( tr( "Commit errors:\n %1" ).arg( mCommitErrors.join( "\n " ) ) );
}
deleteCachedGeometries();
if ( success )
@ -3867,8 +3883,6 @@ bool QgsVectorLayer::commitChanges()
updateFieldMap();
mDataProvider->updateExtents();
QgsMessageLog::logMessage( tr( "Commit errors:\n%1" ).arg( mCommitErrors.join( "\n" ) ) );
return success;
}

View File

@ -358,7 +358,7 @@ bool QgsOgrProvider::setSubsetString( QString theSQL, bool updateFeatureCount )
if ( !ogrLayer )
{
pushError( QString( "OGR[%1] error %2: %3" ).arg( CPLGetLastErrorType() ).arg( CPLGetLastErrorNo() ).arg( CPLGetLastErrorMsg() ) );
pushError( tr( "OGR[%1] error %2: %3" ).arg( CPLGetLastErrorType() ).arg( CPLGetLastErrorNo() ).arg( CPLGetLastErrorMsg() ) );
ogrLayer = prevLayer;
mSubsetString = prevSubsetString;
return false;
@ -962,9 +962,9 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
unsigned char* wkb = f.geometry()->asWkb();
OGRGeometryH geom = NULL;
if ( OGR_G_CreateFromWkb( wkb, NULL, &geom, f.geometry()->wkbSize() )
!= OGRERR_NONE )
if ( OGR_G_CreateFromWkb( wkb, NULL, &geom, f.geometry()->wkbSize() ) != OGRERR_NONE )
{
pushError( tr( "OGR error creating wkb for feature %1: %2" ).arg( f.id() ).arg( CPLGetLastErrorMsg() ) );
return false;
}
@ -1021,7 +1021,7 @@ bool QgsOgrProvider::addFeature( QgsFeature& f )
if ( OGR_L_CreateFeature( ogrLayer, feature ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Writing of the feature %1 failed" ).arg( f.id() ), tr( "OGR" ) );
pushError( tr( "OGR error creating feature %1: %2" ).arg( f.id() ).arg( CPLGetLastErrorMsg() ) );
returnValue = false;
}
else
@ -1078,7 +1078,7 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
type = OFTString;
break;
default:
QgsMessageLog::logMessage( tr( "type %1 for field %2 not found" ).arg( iter->typeName() ).arg( iter->name() ), tr( "OGR" ) );
pushError( tr( "type %1 for field %2 not found" ).arg( iter->typeName() ).arg( iter->name() ) );
returnvalue = false;
continue;
}
@ -1089,7 +1089,7 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
if ( OGR_L_CreateField( ogrLayer, fielddefn, true ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "writing of field %1 failed" ).arg( iter->name() ), tr( "OGR" ) );
pushError( tr( "OGR error creating field %1: %2" ).arg( iter->name() ).arg( CPLGetLastErrorMsg() ) );
returnvalue = false;
}
OGR_Fld_Destroy( fielddefn );
@ -1109,7 +1109,7 @@ bool QgsOgrProvider::deleteAttributes( const QgsAttributeIds &attributes )
{
if ( OGR_L_DeleteField( ogrLayer, attr ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Failed to delete attribute %1" ).arg( attr ), tr( "OGR" ) );
pushError( tr( "OGR error deleting field %1: %2" ).arg( attr ).arg( CPLGetLastErrorMsg() ) );
res = false;
}
}
@ -1117,7 +1117,7 @@ bool QgsOgrProvider::deleteAttributes( const QgsAttributeIds &attributes )
return res;
#else
Q_UNUSED( attributes );
QgsDebugMsg( "Deleting fields is supported only from GDAL >= 1.9.0" );
pushError( tr( "Deleting fields is not supported prior to GDAL 1.9.0" ) );
return false;
#endif
}
@ -1138,7 +1138,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
if ( FID_TO_NUMBER( fid ) > std::numeric_limits<long>::max() )
{
QgsMessageLog::logMessage( tr( "Feature id %1 too large for OGR" ).arg( fid ), tr( "OGR" ) );
pushError( tr( "OGR error on feature %1: id too large" ).arg( fid ) );
continue;
}
@ -1146,7 +1146,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
if ( !of )
{
QgsMessageLog::logMessage( tr( "Feature %1 for attribute update not found." ).arg( fid ), tr( "OGR" ) );
pushError( tr( "Feature %1 for attribute update not found." ).arg( fid ) );
continue;
}
@ -1159,7 +1159,7 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
OGRFieldDefnH fd = OGR_F_GetFieldDefnRef( of, f );
if ( !fd )
{
QgsMessageLog::logMessage( tr( "Field %1 of feature %2 doesn't exist." ).arg( f ).arg( fid ), tr( "OGR" ) );
pushError( tr( "Field %1 of feature %2 doesn't exist." ).arg( f ).arg( fid ) );
continue;
}
@ -1184,16 +1184,15 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
OGR_F_SetFieldString( of, f, mEncoding->fromUnicode( it2->toString() ).constData() );
break;
default:
QgsMessageLog::logMessage( tr( "Type %1 of attribute %2 of feature %3 unknown." ).arg( type ).arg( fid ).arg( f ), tr( "OGR" ) );
pushError( tr( "Type %1 of attribute %2 of feature %3 unknown." ).arg( type ).arg( fid ).arg( f ) );
break;
}
}
}
OGRErr res;
if (( res = OGR_L_SetFeature( ogrLayer, of ) ) != OGRERR_NONE )
if ( OGR_L_SetFeature( ogrLayer, of ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Update of Feature %1 failed: %2" ).arg( fid ).arg( res ), tr( "OGR" ) );
pushError( tr( "OGR error setting feature %1: %2" ).arg( fid ).arg( CPLGetLastErrorMsg() ) );
}
}
@ -1203,7 +1202,6 @@ bool QgsOgrProvider::changeAttributeValues( const QgsChangedAttributesMap & attr
bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
{
OGRErr res;
OGRFeatureH theOGRFeature = 0;
OGRGeometryH theNewGeometry = 0;
@ -1213,14 +1211,14 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
{
if ( FID_TO_NUMBER( it.key() ) > std::numeric_limits<long>::max() )
{
QgsMessageLog::logMessage( tr( "Feature id %1 too large for OGR" ).arg( it.key() ), tr( "OGR" ) );
pushError( tr( "OGR error on feature %1: id too large" ).arg( it.key() ) );
continue;
}
theOGRFeature = OGR_L_GetFeature( ogrLayer, static_cast<long>( FID_TO_NUMBER( it.key() ) ) );
if ( !theOGRFeature )
{
QgsMessageLog::logMessage( tr( "Feature %1 not found for geometry update." ).arg( it.key() ), tr( "OGR" ) );
pushError( tr( "OGR error changing geometry: feature %1 not found" ).arg( it.key() ) );
continue;
}
@ -1230,7 +1228,7 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
&theNewGeometry,
it->wkbSize() ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Creation of new geometry for feature %1 failed." ).arg( it.key() ), tr( "OGR" ) );
pushError( tr( "OGR error creating geometry for feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) );
OGR_G_DestroyGeometry( theNewGeometry );
theNewGeometry = 0;
continue;
@ -1238,23 +1236,23 @@ bool QgsOgrProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
if ( !theNewGeometry )
{
QgsMessageLog::logMessage( tr( "Newly created geometry for feature %1 is null." ).arg( it.key() ), tr( "OGR" ) );
pushError( tr( "OGR error in feature %1: geometry is null" ).arg( it.key() ) );
continue;
}
//set the new geometry
if (( res = OGR_F_SetGeometryDirectly( theOGRFeature, theNewGeometry ) ) != OGRERR_NONE )
if ( OGR_F_SetGeometryDirectly( theOGRFeature, theNewGeometry ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Geometry update for feature %1 failed: %2" ).arg( it.key() ).arg( res ), tr( "OGR" ) );
pushError( tr( "OGR error setting geometry of feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) );
OGR_G_DestroyGeometry( theNewGeometry );
theNewGeometry = 0;
continue;
}
if (( res = OGR_L_SetFeature( ogrLayer, theOGRFeature ) ) != OGRERR_NONE )
if ( OGR_L_SetFeature( ogrLayer, theOGRFeature ) != OGRERR_NONE )
{
QgsMessageLog::logMessage( tr( "Update of feature %1 failed: %2" ).arg( it.key() ).arg( res ), tr( "OGR" ) );
pushError( tr( "OGR error setting feature %1: %2" ).arg( it.key() ).arg( CPLGetLastErrorMsg() ) );
OGR_G_DestroyGeometry( theNewGeometry );
theNewGeometry = 0;
continue;
@ -1336,11 +1334,17 @@ bool QgsOgrProvider::deleteFeature( QgsFeatureId id )
{
if ( FID_TO_NUMBER( id ) > std::numeric_limits<long>::max() )
{
QgsMessageLog::logMessage( tr( "id %1 too large for OGR" ).arg( id ), tr( "OGR" ) );
pushError( tr( "OGR error on feature %1: id too large" ).arg( id ) );
return false;
}
return OGR_L_DeleteFeature( ogrLayer, FID_TO_NUMBER( id ) ) == OGRERR_NONE;
if ( OGR_L_DeleteFeature( ogrLayer, FID_TO_NUMBER( id ) ) != OGRERR_NONE )
{
pushError( tr( "OGR error deleting feature %1: %2" ).arg( id ).arg( CPLGetLastErrorMsg() ) );
return false;
}
return true;
}
int QgsOgrProvider::capabilities() const

View File

@ -662,10 +662,13 @@ QString QgsPostgresConn::postgisVersion()
return mPostgisVersionInfo;
}
QString QgsPostgresConn::quotedIdentifier( QString ident )
QString QgsPostgresConn::quotedIdentifier( QString ident, bool isGeography )
{
ident.replace( '"', "\"\"" );
return ident.prepend( "\"" ).append( "\"" );
ident = ident.prepend( "\"" ).append( "\"" );
if ( isGeography )
ident += "::geometry";
return ident;
}
QString QgsPostgresConn::quotedValue( QVariant value )
@ -694,22 +697,31 @@ PGresult *QgsPostgresConn::PQexec( QString query, bool logError )
QgsDebugMsgLevel( QString( "Executing SQL: %1" ).arg( query ), 3 );
PGresult *res = ::PQexec( mConn, query.toUtf8() );
if ( logError )
if ( res )
{
if ( res )
int errorStatus = PQresultStatus( res );
if ( errorStatus != PGRES_COMMAND_OK && errorStatus != PGRES_TUPLES_OK )
{
int errorStatus = PQresultStatus( res );
if ( errorStatus != PGRES_COMMAND_OK && errorStatus != PGRES_TUPLES_OK )
if ( logError )
{
QgsMessageLog::logMessage( tr( "Errornous query: %1 returned %2 [%3]" )
.arg( query ).arg( errorStatus ).arg( PQresultErrorMessage( res ) ),
tr( "PostGIS" ) );
}
else
{
QgsDebugMsg( QString( "Not logged errornous query: %1 returned %2 [%3]" )
.arg( query ).arg( errorStatus ).arg( PQresultErrorMessage( res ) ) );
}
}
else
{
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: %2" ).arg( query ), tr( "PostGIS" ) );
}
}
else if ( logError )
{
QgsMessageLog::logMessage( tr( "Query failed: %1\nError: no result buffer" ).arg( query ) );
}
else
{
QgsDebugMsg( tr( "Not logged query failed: %1\nError: no result buffer" ).arg( query ) );
}
return res;
@ -742,7 +754,7 @@ bool QgsPostgresConn::closeCursor( QString cursorName )
bool QgsPostgresConn::PQexecNR( QString query, bool retry )
{
QgsPostgresResult res = ::PQexec( mConn, query.toUtf8() );
QgsPostgresResult res = PQexec( query, false );
ExecStatusType errorStatus = res.PQresultStatus();
if ( errorStatus == PGRES_COMMAND_OK )
@ -849,6 +861,7 @@ QString QgsPostgresConn::PQerrorMessage()
int QgsPostgresConn::PQsendQuery( QString query )
{
Q_ASSERT( mConn );
return ::PQsendQuery( mConn, query.toUtf8() );
}
@ -1027,7 +1040,7 @@ void QgsPostgresConn::retrieveLayerTypes( QgsPostgresLayerProperty &layerPropert
.arg( postgisTypeFilter( layerProperty.geometryColName, QGis::Line, layerProperty.isGeography ) )
.arg( postgisTypeFilter( layerProperty.geometryColName, QGis::Polygon, layerProperty.isGeography ) )
.arg( majorVersion() < 2 ? "srid" : "st_srid" )
.arg( quotedIdentifier( layerProperty.geometryColName ) )
.arg( quotedIdentifier( layerProperty.geometryColName, layerProperty.isGeography ) )
.arg( table );
QgsDebugMsg( "Retrieving geometry types: " + query );
@ -1119,9 +1132,7 @@ QString QgsPostgresConn::postgisWkbTypeName( QGis::WkbType wkbType )
QString QgsPostgresConn::postgisTypeFilter( QString geomCol, QGis::GeometryType geomType, bool isGeography )
{
geomCol = quotedIdentifier( geomCol );
if ( isGeography )
geomCol += "::geometry";
geomCol = quotedIdentifier( geomCol, isGeography );
switch ( geomType )
{

View File

@ -134,7 +134,7 @@ class QgsPostgresConn : public QObject
/** Double quote a PostgreSQL identifier for placement in a SQL string.
*/
static QString quotedIdentifier( QString ident );
static QString quotedIdentifier( QString ident, bool isGeography = false );
/** Quote a value for placement in a SQL string.
*/

View File

@ -254,10 +254,10 @@ bool QgsPostgresProvider::declareCursor(
if ( fetchGeometry )
{
query += QString( "%1(%2(%3::geometry),'%4')" )
query += QString( "%1(%2(%3),'%4')" )
.arg( mConnectionRO->majorVersion() < 2 ? "asbinary" : "st_asbinary" )
.arg( mConnectionRO->majorVersion() < 2 ? "force_2d" : "st_force_2d" )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( quotedIdentifier( mGeometryColumn, mIsGeography ) )
.arg( endianString() );
delim = ",";
}
@ -557,7 +557,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
{
whereClause += QString( " AND %1(%2,%3)" )
.arg( mConnectionRO->majorVersion() < 2 ? "intersects" : "st_intersects" )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( quotedIdentifier( mGeometryColumn, mIsGeography ) )
.arg( qBox );
}
}
@ -566,7 +566,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRectangle
{
whereClause += QString( " AND %1(%2)=%3" )
.arg( mConnectionRO->majorVersion() < 2 ? "srid" : "st_srid" )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( quotedIdentifier( mGeometryColumn, mIsGeography ) )
.arg( mRequestedSrid );
}
@ -626,6 +626,12 @@ bool QgsPostgresProvider::nextFeature( QgsFeature& feature )
if ( !queryResult.result() )
break;
if ( queryResult.PQresultStatus() != PGRES_TUPLES_OK )
{
QgsMessageLog::logMessage( tr( "Fetching from cursor %1 failed\nDatabase error: %2" ).arg( cursorName ).arg( mConnectionRO->PQerrorMessage() ), tr( "PostGIS" ) );
break;
}
int rows = queryResult.PQntuples();
if ( rows == 0 )
continue;
@ -853,7 +859,7 @@ bool QgsPostgresProvider::featureAtId( QgsFeatureId featureId, QgsFeature& featu
if ( !declareCursor( cursorName, fetchAttributes, fetchGeometry, whereClause( featureId ) ) )
return false;
QgsPostgresResult queryResult = mConnectionRO->PQexec( QString( "fetch forward 1 from %1" ).arg( cursorName ) );
QgsPostgresResult queryResult = mConnectionRO->PQexec( QString( "FETCH FORWARD 1 FROM %1" ).arg( cursorName ) );
int rows = queryResult.PQntuples();
if ( rows == 0 )
@ -1961,7 +1967,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while adding features.\nError: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while adding features: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
mConnectionRW->PQexecNR( "DEALLOCATE addfeatures" );
returnvalue = false;
@ -2007,7 +2013,7 @@ bool QgsPostgresProvider::deleteFeatures( const QgsFeatureIds & id )
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while deleting features.\nError: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while deleting features: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
returnvalue = false;
}
@ -2070,7 +2076,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while adding attributes. Error: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while adding attributes: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
returnvalue = false;
}
@ -2117,7 +2123,7 @@ bool QgsPostgresProvider::deleteAttributes( const QgsAttributeIds& ids )
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while deleting attributes.\nError: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while deleting attributes: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
returnvalue = false;
}
@ -2222,7 +2228,7 @@ bool QgsPostgresProvider::changeAttributeValues( const QgsChangedAttributesMap &
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while changing attributes.\nError: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while changing attributes: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
returnvalue = false;
}
@ -2305,7 +2311,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
}
catch ( PGException &e )
{
QgsMessageLog::logMessage( tr( "Error while changing geometry values.\nError: %1" ).arg( e.errorMessage() ), tr( "PostGIS" ) );
pushError( tr( "PostGIS error while changing geometry values: %1" ).arg( e.errorMessage() ) );
mConnectionRW->PQexecNR( "ROLLBACK" );
mConnectionRW->PQexecNR( "DEALLOCATE updatefeatures" );
returnvalue = false;
@ -2624,6 +2630,7 @@ bool QgsPostgresProvider::getGeometryDetails()
layerProperty.schemaName = mSchemaName;
layerProperty.tableName = mTableName;
layerProperty.geometryColName = mGeometryColumn;
layerProperty.isGeography = mIsGeography;
QString delim = "";
@ -2644,7 +2651,7 @@ bool QgsPostgresProvider::getGeometryDetails()
layerProperty.sql += QString( "%1%2(%3)=%4" )
.arg( delim )
.arg( mConnectionRO->majorVersion() < 2 ? "srid" : "st_srid" )
.arg( quotedIdentifier( mGeometryColumn ) )
.arg( quotedIdentifier( mGeometryColumn, mIsGeography ) )
.arg( mRequestedSrid );
delim = " AND ";
}

View File

@ -488,7 +488,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
void disconnectDb();
static QString quotedIdentifier( QString ident ) { return QgsPostgresConn::quotedIdentifier( ident ); }
static QString quotedIdentifier( QString ident, bool isGeography = false ) { return QgsPostgresConn::quotedIdentifier( ident, isGeography ); }
static QString quotedValue( QVariant value ) { return QgsPostgresConn::quotedValue( value ); }
static int sProviderIds;

View File

@ -3725,7 +3725,7 @@ bool QgsSpatiaLiteProvider::addFeatures( QgsFeatureList & flist )
return true;
abort:
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ) );
if ( errMsg )
{
sqlite3_free( errMsg );
@ -3761,7 +3761,7 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds &id )
if ( sqlite3_prepare_v2( sqliteHandle, sql.toUtf8().constData(), -1, &stmt, NULL ) != SQLITE_OK )
{
// some error occurred
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( sqlite3_errmsg( sqliteHandle ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( sqlite3_errmsg( sqliteHandle ) ) );
return false;
}
@ -3803,7 +3803,7 @@ bool QgsSpatiaLiteProvider::deleteFeatures( const QgsFeatureIds &id )
return true;
abort:
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ) );
if ( errMsg )
{
sqlite3_free( errMsg );
@ -3859,7 +3859,7 @@ bool QgsSpatiaLiteProvider::addAttributes( const QList<QgsField> &attributes )
return true;
abort:
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ) );
if ( errMsg )
{
sqlite3_free( errMsg );
@ -3954,7 +3954,7 @@ bool QgsSpatiaLiteProvider::changeAttributeValues( const QgsChangedAttributesMap
return true;
abort:
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ) );
if ( errMsg )
{
sqlite3_free( errMsg );
@ -4046,7 +4046,7 @@ bool QgsSpatiaLiteProvider::changeGeometryValues( QgsGeometryMap & geometry_map
return true;
abort:
QgsMessageLog::logMessage( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ), tr( "SpatiaLite" ) );
pushError( tr( "SQLite error: %2\nSQL: %1" ).arg( sql ).arg( errMsg ? errMsg : tr( "unknown cause" ) ) );
if ( errMsg )
{
sqlite3_free( errMsg );