Skip to content

Commit

Permalink
Get fid of newly added feature in mssql provider
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanW2 committed Mar 28, 2013
1 parent 22debea commit 1b663bb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/providers/mssql/qgsmssqlprovider.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 1b663bb

Please sign in to comment.