Skip to content
Permalink
Browse files

only accept crs matches if there's only one (improved #5066)

  • Loading branch information
jef-n committed Sep 1, 2012
1 parent 31d1b95 commit 42a9d0193830cdee979fd53873581d87eef96e75
Showing with 17 additions and 3 deletions.
  1. +17 −3 src/core/qgscoordinatereferencesystem.cpp
@@ -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;
}

@@ -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 );
@@ -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 );

0 comments on commit 42a9d01

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