Skip to content

Commit

Permalink
[MSSQL] Correctly raise errors to UI level
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Jun 19, 2017
1 parent a511ecd commit 22ed48f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -377,7 +377,7 @@ void QgsMssqlProvider::loadFields()
// Get computed columns which need to be ignored on insert or update. // Get computed columns which need to be ignored on insert or update.
if ( !query.exec( QStringLiteral( "SELECT name FROM sys.columns WHERE is_computed = 1 AND object_id = OBJECT_ID('[%1].[%2]')" ).arg( mSchemaName, mTableName ) ) ) if ( !query.exec( QStringLiteral( "SELECT name FROM sys.columns WHERE is_computed = 1 AND object_id = OBJECT_ID('[%1].[%2]')" ).arg( mSchemaName, mTableName ) ) )
{ {
QgsDebugMsg( query.lastError().text( ) ); pushError( query.lastError().text( ) );
return; return;
} }


Expand All @@ -391,7 +391,7 @@ void QgsMssqlProvider::loadFields()


if ( !query.exec( QStringLiteral( "exec sp_columns @table_name = N'%1', @table_owner = '%2'" ).arg( mTableName, mSchemaName ) ) ) if ( !query.exec( QStringLiteral( "exec sp_columns @table_name = N'%1', @table_owner = '%2'" ).arg( mTableName, mSchemaName ) ) )
{ {
QgsDebugMsg( query.lastError().text( ) ); pushError( query.lastError().text( ) );
return; return;
} }
if ( query.isActive() ) if ( query.isActive() )
Expand Down Expand Up @@ -1312,7 +1312,7 @@ bool QgsMssqlProvider::changeGeometryValues( const QgsGeometryMap &geometry_map


if ( !query.prepare( statement ) ) if ( !query.prepare( statement ) )
{ {
QgsDebugMsg( query.lastError().text() ); pushError( query.lastError().text() );
return false; return false;
} }


Expand All @@ -1330,7 +1330,7 @@ bool QgsMssqlProvider::changeGeometryValues( const QgsGeometryMap &geometry_map


if ( !query.exec() ) if ( !query.exec() )
{ {
QgsDebugMsg( query.lastError().text() ); pushError( query.lastError().text() );
return false; return false;
} }
} }
Expand Down Expand Up @@ -1364,7 +1364,7 @@ bool QgsMssqlProvider::deleteFeatures( const QgsFeatureIds &id )


if ( !query.exec( statement ) ) if ( !query.exec( statement ) )
{ {
QgsDebugMsg( query.lastError().text() ); pushError( query.lastError().text() );
return false; return false;
} }


Expand Down Expand Up @@ -1421,7 +1421,7 @@ bool QgsMssqlProvider::createSpatialIndex()


if ( !query.exec( statement ) ) if ( !query.exec( statement ) )
{ {
QgsDebugMsg( query.lastError().text() ); pushError( query.lastError().text() );
return false; return false;
} }


Expand All @@ -1440,7 +1440,7 @@ bool QgsMssqlProvider::createAttributeIndex( int field )


if ( field < 0 || field >= mAttributeFields.size() ) if ( field < 0 || field >= mAttributeFields.size() )
{ {
QgsDebugMsg( "createAttributeIndex invalid index" ); pushError( "createAttributeIndex invalid index" );
return false; return false;
} }


Expand All @@ -1449,7 +1449,7 @@ bool QgsMssqlProvider::createAttributeIndex( int field )


if ( !query.exec( statement ) ) if ( !query.exec( statement ) )
{ {
QgsDebugMsg( query.lastError().text() ); pushError( query.lastError().text() );
return false; return false;
} }


Expand Down

0 comments on commit 22ed48f

Please sign in to comment.