Skip to content
Permalink
Browse files
backport [MSSQL] Fix update/insert with timestamp columns
  • Loading branch information
NathanW2 committed Apr 12, 2017
1 parent 6e0ca9b commit 544e19e242db13d63c7085614befb9f81ffa5094
Showing with 16 additions and 4 deletions.
  1. +16 −4 src/providers/mssql/qgsmssqlprovider.cpp
@@ -810,7 +810,10 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
{
QgsField fld = mAttributeFields.at( i );

if ( fld.typeName().endsWith( " identity", Qt::CaseInsensitive ) )
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

if ( fld.name().isEmpty() )
@@ -881,7 +884,10 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
{
QgsField fld = mAttributeFields.at( i );

if ( fld.typeName().endsWith( " identity", Qt::CaseInsensitive ) )
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

if ( fld.name().isEmpty() )
@@ -1111,7 +1117,10 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap &att
{
QgsField fld = mAttributeFields.at( it2.key() );

if ( fld.typeName().endsWith( " identity", Qt::CaseInsensitive ) )
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

if ( fld.name().isEmpty() )
@@ -1142,7 +1151,10 @@ bool QgsMssqlProvider::changeAttributeValues( const QgsChangedAttributesMap &att
{
QgsField fld = mAttributeFields.at( it2.key() );

if ( fld.typeName().endsWith( " identity", Qt::CaseInsensitive ) )
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

if ( fld.name().isEmpty() )

0 comments on commit 544e19e

Please sign in to comment.