Navigation Menu

Skip to content

Commit

Permalink
only accept crs matches if there's only one (improved #5066)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Sep 1, 2012
1 parent 31d1b95 commit 42a9d01
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/core/qgscoordinatereferencesystem.cpp
Expand Up @@ -694,8 +694,7 @@ QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord(
QFileInfo myInfo( myDatabaseFileName );
if ( !myInfo.exists() )
{
QgsDebugMsg( "failed : " + myDatabaseFileName +
" does not exist!" );
QgsDebugMsg( "failed : " + myDatabaseFileName + " does not exist!" );
return myMap;
}

Expand All @@ -719,8 +718,18 @@ QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord(
myFieldValue = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, myColNo ) );
myMap[myFieldName] = myFieldValue;
}
if ( sqlite3_step( myPreparedStatement ) != SQLITE_DONE )
{
QgsDebugMsg( "Multiple records found in srs.db" );
myMap.clear();
}
}
else
{
QgsDebugMsg( "failed : " + theSql );
}

if ( myMap.empty() )
{
QgsDebugMsg( "trying user qgis.db" );
sqlite3_finalize( myPreparedStatement );
Expand Down Expand Up @@ -754,11 +763,16 @@ QgsCoordinateReferenceSystem::RecordMap QgsCoordinateReferenceSystem::getRecord(
myFieldValue = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, myColNo ) );
myMap[myFieldName] = myFieldValue;
}

if ( sqlite3_step( myPreparedStatement ) != SQLITE_DONE )
{
QgsDebugMsg( "Multiple records found in srs.db" );
myMap.clear();
}
}
else
{
QgsDebugMsg( "failed : " + theSql );

}
}
sqlite3_finalize( myPreparedStatement );
Expand Down

0 comments on commit 42a9d01

Please sign in to comment.