From 1549311f97d3fa26ff5e47af277ec2b6211e0e26 Mon Sep 17 00:00:00 2001 From: jef Date: Sun, 16 May 2010 20:27:08 +0000 Subject: [PATCH] fix #2670 git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13508 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/core/qgscoordinatereferencesystem.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/core/qgscoordinatereferencesystem.cpp b/src/core/qgscoordinatereferencesystem.cpp index 55c7f830bba6..6696cd916250 100644 --- a/src/core/qgscoordinatereferencesystem.cpp +++ b/src/core/qgscoordinatereferencesystem.cpp @@ -31,7 +31,6 @@ #include "qgsmessageoutput.h" #include "qgis.h" //const vals declared here -#include #include //gdal and ogr includes (needed for == operator) @@ -1145,7 +1144,7 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId ) // close the database sqlite3_close( db ); - //assert(myProjString.length() > 0); + //Q_ASSERT(myProjString.length() > 0); return myProjString; } @@ -1259,12 +1258,10 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS() myResult = sqlite3_open( QgsApplication::qgisUserDbFilePath().toUtf8().data(), &myDatabase ); if ( myResult != SQLITE_OK ) { - QgsDebugMsg( QString( "Can't open database: %1 \n please notify QGIS developers of this error \n %2 (file name) " ) - .arg( sqlite3_errmsg( myDatabase ) ) - .arg( QgsApplication::qgisUserDbFilePath() ) ); - // XXX This will likely never happen since on open, sqlite creates the - // database if it does not exist. - assert( myResult == SQLITE_OK ); + QgsDebugMsg( QString( "Can't open or create database %1: %2" ) + .arg( QgsApplication::qgisUserDbFilePath() ) + .arg( sqlite3_errmsg( myDatabase ) ) ); + return false; } QgsDebugMsg( QString( "Update or insert sql \n%1" ).arg( mySql ) ); myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail ); @@ -1285,9 +1282,7 @@ long QgsCoordinateReferenceSystem::getRecordCount() if ( myResult != SQLITE_OK ) { QgsDebugMsg( QString( "Can't open database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); - // XXX This will likely never happen since on open, sqlite creates the - // database if it does not exist. - assert( myResult == SQLITE_OK ); + return 0; } // Set up the query to retrieve the projection information needed to populate the ELLIPSOID list QString mySql = "select count(*) from tbl_srs";