File tree Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Expand file tree Collapse file tree 1 file changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -364,30 +364,28 @@ void QgsMssqlProvider::loadFields()
364
364
if ( mQuery .next () )
365
365
{
366
366
mFidColName = mQuery .value ( 3 ).toString ();
367
+ return ;
367
368
}
368
- else
369
+ }
370
+ foreach ( QString pk, pkCandidates )
371
+ {
372
+ mQuery .clear ();
373
+ if (!mQuery .exec ( QString ( " select count(distinct [%1]), count([%1]) from [%2].[%3]" )
374
+ .arg ( pk )
375
+ .arg ( mSchemaName )
376
+ .arg ( mTableName ) ))
369
377
{
370
- foreach ( QString pk, pkCandidates )
378
+ QString msg = mQuery .lastError ().text ();
379
+ QgsDebugMsg ( msg );
380
+ }
381
+ if ( mQuery .isActive () )
382
+ {
383
+ if ( mQuery .next () )
371
384
{
372
- mQuery .clear ();
373
- if (!mQuery .exec ( QString ( " select count(distinct [%1]), count([%1]) from [%2].[%3]" )
374
- .arg ( pk )
375
- .arg ( mSchemaName )
376
- .arg ( mTableName ) ))
377
- {
378
- QString msg = mQuery .lastError ().text ();
379
- QgsDebugMsg ( msg );
380
- }
381
- if ( mQuery .isActive () )
385
+ if (mQuery .value ( 0 ).toInt () == mQuery .value ( 1 ).toInt ())
382
386
{
383
- if ( mQuery .next () )
384
- {
385
- if (mQuery .value ( 0 ).toInt () == mQuery .value ( 1 ).toInt ())
386
- {
387
- mFidColName = pk;
388
- break ;
389
- }
390
- }
387
+ mFidColName = pk;
388
+ return ;
391
389
}
392
390
}
393
391
}
You can’t perform that action at this time.
0 commit comments