Skip to content
Permalink
Browse files

Do not abort if sp_pkeys is not working

  • Loading branch information
szekerest authored and NathanW2 committed Mar 28, 2012
1 parent 45def21 commit f07b3f9189400d95db64f42dc09a654c9dfe2bdb
Showing with 18 additions and 20 deletions.
  1. +18 −20 src/providers/mssql/qgsmssqlprovider.cpp
@@ -364,30 +364,28 @@ void QgsMssqlProvider::loadFields()
if ( mQuery.next() )
{
mFidColName = mQuery.value( 3 ).toString();
return;
}
else
}
foreach( QString pk, pkCandidates )
{
mQuery.clear();
if (!mQuery.exec( QString( "select count(distinct [%1]), count([%1]) from [%2].[%3]" )
.arg( pk )
.arg( mSchemaName )
.arg( mTableName ) ))
{
foreach( QString pk, pkCandidates )
QString msg = mQuery.lastError().text();
QgsDebugMsg( msg );
}
if ( mQuery.isActive() )
{
if ( mQuery.next() )
{
mQuery.clear();
if (!mQuery.exec( QString( "select count(distinct [%1]), count([%1]) from [%2].[%3]" )
.arg( pk )
.arg( mSchemaName )
.arg( mTableName ) ))
{
QString msg = mQuery.lastError().text();
QgsDebugMsg( msg );
}
if ( mQuery.isActive() )
if (mQuery.value( 0 ).toInt() == mQuery.value( 1 ).toInt())
{
if ( mQuery.next() )
{
if (mQuery.value( 0 ).toInt() == mQuery.value( 1 ).toInt())
{
mFidColName = pk;
break;
}
}
mFidColName = pk;
return;
}
}
}

0 comments on commit f07b3f9

Please sign in to comment.
You can’t perform that action at this time.