@@ -1612,6 +1612,10 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
1612
1612
proj4String = toProj4 ();
1613
1613
}
1614
1614
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
+
1615
1619
// if this is the first record we need to ensure that its srs_id is 10000. For
1616
1620
// any rec after that sqlite3 will take care of the autonumbering
1617
1621
// this was done to support sqlite 3.0 as it does not yet support
@@ -1622,7 +1626,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
1622
1626
+ QString::number ( USER_CRS_START_ID )
1623
1627
+ ' ,' + QgsSqliteUtils::quotedString ( name )
1624
1628
+ ' ,' + QgsSqliteUtils::quotedString ( projectionAcronym () )
1625
- + ' ,' + QgsSqliteUtils::quotedString ( ellipsoidAcronym () )
1629
+ + ' ,' + quotedEllipsoidString
1626
1630
+ ' ,' + QgsSqliteUtils::quotedString ( toProj4 () )
1627
1631
+ " ,0)" ; // <-- is_geo shamelessly hard coded for now
1628
1632
}
@@ -1631,7 +1635,7 @@ long QgsCoordinateReferenceSystem::saveAsUserCrs( const QString &name )
1631
1635
mySql = " insert into tbl_srs (description,projection_acronym,ellipsoid_acronym,parameters,is_geo) values ("
1632
1636
+ QgsSqliteUtils::quotedString ( name )
1633
1637
+ ' ,' + QgsSqliteUtils::quotedString ( projectionAcronym () )
1634
- + ' ,' + QgsSqliteUtils::quotedString ( ellipsoidAcronym () )
1638
+ + ' ,' + quotedEllipsoidString
1635
1639
+ ' ,' + QgsSqliteUtils::quotedString ( toProj4 () )
1636
1640
+ " ,0)" ; // <-- is_geo shamelessly hard coded for now
1637
1641
}
0 commit comments