@@ -1773,9 +1773,16 @@ int QgsCoordinateReferenceSystem::syncDb()
1773
1773
{
1774
1774
deleted = sqlite3_changes ( database );
1775
1775
}
1776
+ else
1777
+ {
1778
+ errors++;
1779
+ qCritical ( " Could not execute: %s [%s]\n " ,
1780
+ sql.toLocal8Bit ().constData (),
1781
+ sqlite3_errmsg ( database ) );
1782
+ }
1776
1783
1777
1784
#if !defined(PJ_VERSION) || PJ_VERSION!=470
1778
- sql = QString ( " select auth_name,auth_id,parameters from tbl_srs WHERE auth_name<>'EPSG' WHERE NOT deprecated" );
1785
+ sql = QString ( " select auth_name,auth_id,parameters from tbl_srs WHERE auth_name<>'EPSG' AND NOT deprecated" );
1779
1786
if ( sqlite3_prepare ( database, sql.toAscii (), sql.size (), &select , &tail ) == SQLITE_OK )
1780
1787
{
1781
1788
while ( sqlite3_step ( select ) == SQLITE_ROW )
@@ -1806,6 +1813,28 @@ int QgsCoordinateReferenceSystem::syncDb()
1806
1813
proj4 = proj4.mid ( input.size () );
1807
1814
proj4 = proj4.trimmed ();
1808
1815
}
1816
+
1817
+ if ( proj4 != params )
1818
+ {
1819
+ sql = QString ( " UPDATE tbl_srs SET parameters=%1 WHERE auth_name=%2 AND auth_id=%3" )
1820
+ .arg ( quotedValue ( proj4 ) )
1821
+ .arg ( quotedValue ( auth_name ) )
1822
+ .arg ( quotedValue ( auth_id ) );
1823
+
1824
+ if ( sqlite3_exec ( database, sql.toUtf8 (), 0 , 0 , &errMsg ) == SQLITE_OK )
1825
+ {
1826
+ updated++;
1827
+ QgsDebugMsgLevel ( QString ( " SQL: %1\n OLD:%2\n NEW:%3" ).arg ( sql ).arg ( params ).arg ( proj4 ), 3 );
1828
+ }
1829
+ else
1830
+ {
1831
+ qCritical ( " Could not execute: %s [%s/%s]\n " ,
1832
+ sql.toLocal8Bit ().constData (),
1833
+ sqlite3_errmsg ( database ),
1834
+ errMsg ? errMsg : " (unknown error)" );
1835
+ errors++;
1836
+ }
1837
+ }
1809
1838
}
1810
1839
else
1811
1840
{
@@ -1820,6 +1849,13 @@ int QgsCoordinateReferenceSystem::syncDb()
1820
1849
pj_free ( pj );
1821
1850
}
1822
1851
}
1852
+ else
1853
+ {
1854
+ errors++;
1855
+ qCritical ( " Could not execute: %s [%s]\n " ,
1856
+ sql.toLocal8Bit ().constData (),
1857
+ sqlite3_errmsg ( database ) );
1858
+ }
1823
1859
#endif
1824
1860
1825
1861
OSRDestroySpatialReference ( crs );
0 commit comments