@@ -1612,6 +1612,10 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16121612 proj4String = toProj4 ();
16131613 }
16141614
1615+ // ellipsoid acroynym column is incorrect marked as not null in many crs database instances,
1616+ // hack around this by using an empty string instead
1617+ const QString quotedEllipsoidString = ellipsoidAcronym ().isNull () ? " ''" : QgsSqliteUtils::quotedString ( ellipsoidAcronym () );
1618+
16151619 // if this is the first record we need to ensure that its srs_id is 10000. For
16161620 // any rec after that sqlite3 will take care of the autonumbering
16171621 // this was done to support sqlite 3.0 as it does not yet support
@@ -1622,7 +1626,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16221626 + QString::number ( USER_CRS_START_ID )
16231627 + ' ,' + QgsSqliteUtils::quotedString ( name )
16241628 + ' ,' + QgsSqliteUtils::quotedString ( projectionAcronym () )
1625- + ' ,' + QgsSqliteUtils::quotedString ( ellipsoidAcronym () )
1629+ + ' ,' + quotedEllipsoidString
16261630 + ' ,' + QgsSqliteUtils::quotedString ( toProj4 () )
16271631 + " ,0)" ; // <-- is_geo shamelessly hard coded for now
16281632 }
@@ -1631,7 +1635,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
16311635 mySql = " insert into tbl_srs (description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
16321636 + QgsSqliteUtils::quotedString ( name )
16331637 + ' ,' + QgsSqliteUtils::quotedString ( projectionAcronym () )
1634- + ' ,' + QgsSqliteUtils::quotedString ( ellipsoidAcronym () )
1638+ + ' ,' + quotedEllipsoidString
16351639 + ' ,' + QgsSqliteUtils::quotedString ( toProj4 () )
16361640 + " ,0)" ; // <-- is_geo shamelessly hard coded for now
16371641 }
0 commit comments