Skip to content

Commit 1b663bb

Browse files
committedMar 28, 2013
Get fid of newly added feature in mssql provider
1 parent 22debea commit 1b663bb

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎src/providers/mssql/qgsmssqlprovider.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,26 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
854854
return false;
855855
}
856856
}
857+
858+
859+
if ( mSchemaName.isEmpty() )
860+
statement = QString( "SELECT IDENT_CURRENT('dbo.%1')" ).arg( mTableName );
861+
else
862+
statement = QString( "SELECT IDENT_CURRENT('%1.%2')" ).arg( mSchemaName, mTableName );
863+
864+
if ( !query.exec( statement ) )
865+
{
866+
QString msg = query.lastError().text();
867+
QgsDebugMsg( msg );
868+
if ( !mSkipFailures )
869+
{
870+
pushError( msg );
871+
return false;
872+
}
873+
}
874+
875+
query.next();
876+
it->setFeatureId( query.value( 0 ).toLongLong() );
857877
}
858878

859879
return true;

0 commit comments

Comments
 (0)
Please sign in to comment.