Skip to content
Permalink
Browse files
Get fid of newly added feature in mssql provider
  • Loading branch information
NathanW2 committed Mar 28, 2013
1 parent 22debea commit 1b663bb7ae88cfe4d38180aa6430284eaa12ba7b
Showing with 20 additions and 0 deletions.
  1. +20 −0 src/providers/mssql/qgsmssqlprovider.cpp
@@ -854,6 +854,26 @@ bool QgsMssqlProvider::addFeatures( QgsFeatureList & flist )
return false;
}
}


if ( mSchemaName.isEmpty() )
statement = QString( "SELECT IDENT_CURRENT('dbo.%1')" ).arg( mTableName );
else
statement = QString( "SELECT IDENT_CURRENT('%1.%2')" ).arg( mSchemaName, mTableName );

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

query.next();
it->setFeatureId( query.value( 0 ).toLongLong() );
}

return true;

0 comments on commit 1b663bb

Please sign in to comment.