31
31
#include " qgsmessageoutput.h"
32
32
#include " qgis.h" // const vals declared here
33
33
34
- #include < cassert>
35
34
#include < sqlite3.h>
36
35
37
36
// gdal and ogr includes (needed for == operator)
@@ -1145,7 +1144,7 @@ QString QgsCoordinateReferenceSystem::proj4FromSrsId( const int theSrsId )
1145
1144
// close the database
1146
1145
sqlite3_close ( db );
1147
1146
1148
- // assert (myProjString.length() > 0);
1147
+ // Q_ASSERT (myProjString.length() > 0);
1149
1148
return myProjString;
1150
1149
}
1151
1150
@@ -1259,12 +1258,10 @@ bool QgsCoordinateReferenceSystem::saveAsUserCRS()
1259
1258
myResult = sqlite3_open ( QgsApplication::qgisUserDbFilePath ().toUtf8 ().data (), &myDatabase );
1260
1259
if ( myResult != SQLITE_OK )
1261
1260
{
1262
- QgsDebugMsg ( QString ( " Can't open database: %1 \n please notify QGIS developers of this error \n %2 (file name) " )
1263
- .arg ( sqlite3_errmsg ( myDatabase ) )
1264
- .arg ( QgsApplication::qgisUserDbFilePath () ) );
1265
- // XXX This will likely never happen since on open, sqlite creates the
1266
- // database if it does not exist.
1267
- assert ( myResult == SQLITE_OK );
1261
+ QgsDebugMsg ( QString ( " Can't open or create database %1: %2" )
1262
+ .arg ( QgsApplication::qgisUserDbFilePath () )
1263
+ .arg ( sqlite3_errmsg ( myDatabase ) ) );
1264
+ return false ;
1268
1265
}
1269
1266
QgsDebugMsg ( QString ( " Update or insert sql \n %1" ).arg ( mySql ) );
1270
1267
myResult = sqlite3_prepare ( myDatabase, mySql.toUtf8 (), mySql.toUtf8 ().length (), &myPreparedStatement, &myTail );
@@ -1285,9 +1282,7 @@ long QgsCoordinateReferenceSystem::getRecordCount()
1285
1282
if ( myResult != SQLITE_OK )
1286
1283
{
1287
1284
QgsDebugMsg ( QString ( " Can't open database: %1" ).arg ( sqlite3_errmsg ( myDatabase ) ) );
1288
- // XXX This will likely never happen since on open, sqlite creates the
1289
- // database if it does not exist.
1290
- assert ( myResult == SQLITE_OK );
1285
+ return 0 ;
1291
1286
}
1292
1287
// Set up the query to retrieve the projection information needed to populate the ELLIPSOID list
1293
1288
QString mySql = " select count(*) from tbl_srs" ;
0 commit comments