Skip to content

Commit

Permalink
[MSSQL] Fix update/insert with timestamp columns
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Apr 12, 2017
1 parent 49e1ae4 commit 6726214
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/providers/mssql/qgsmssqlprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,9 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist )

QgsField fld = mAttributeFields.at( i );

if ( fld.typeName().toLower() == QLatin1String( "timestamp" ) )
continue; // You can't update timestamp columns they are server only.

if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
continue; // skip identity field

Expand Down Expand Up @@ -897,6 +900,9 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList &flist )

QgsField fld = mAttributeFields.at( i );

if ( fld.typeName().toLower() == QLatin1String( "timestamp" ) )
continue; // You can't update timestamp columns they are server only.

if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
continue; // skip identity field

Expand Down Expand Up @@ -1127,6 +1133,9 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap &att
{
QgsField fld = mAttributeFields.at( it2.key() );

if ( fld.typeName().toLower() == QLatin1String( "timestamp" ) )
continue; // You can't update timestamp columns they are server only.

if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
continue; // skip identity field

Expand Down Expand Up @@ -1158,6 +1167,9 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap &att
{
QgsField fld = mAttributeFields.at( it2.key() );

if ( fld.typeName().toLower() == QLatin1String( "timestamp" ) )
continue; // You can't update timestamp columns they are server only.

if ( fld.typeName().endsWith( QLatin1String( " identity" ), Qt::CaseInsensitive ) )
continue; // skip identity field

Expand Down

0 comments on commit 6726214

Please sign in to comment.