@@ -1773,9 +1773,16 @@ int QgsCoordinateReferenceSystem::syncDb()
17731773 {
17741774 deleted = sqlite3_changes ( database );
17751775 }
1776+ else
1777+ {
1778+ errors++;
1779+ qCritical ( " Could not execute: %s [%s]\n " ,
1780+ sql.toLocal8Bit ().constData (),
1781+ sqlite3_errmsg ( database ) );
1782+ }
17761783
17771784#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" );
17791786 if ( sqlite3_prepare ( database, sql.toAscii (), sql.size (), &select, &tail ) == SQLITE_OK )
17801787 {
17811788 while ( sqlite3_step ( select ) == SQLITE_ROW )
@@ -1806,6 +1813,28 @@ int QgsCoordinateReferenceSystem::syncDb()
18061813 proj4 = proj4.mid ( input.size () );
18071814 proj4 = proj4.trimmed ();
18081815 }
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+ }
18091838 }
18101839 else
18111840 {
@@ -1820,6 +1849,13 @@ int QgsCoordinateReferenceSystem::syncDb()
18201849 pj_free ( pj );
18211850 }
18221851 }
1852+ else
1853+ {
1854+ errors++;
1855+ qCritical ( " Could not execute: %s [%s]\n " ,
1856+ sql.toLocal8Bit ().constData (),
1857+ sqlite3_errmsg ( database ) );
1858+ }
18231859#endif
18241860
18251861 OSRDestroySpatialReference ( crs );
0 commit comments