Skip to content

Commit 12106b8

Browse files
committed
allow crs without projection entries (fixes #6117)
1 parent 431f29d commit 12106b8

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

resources/qgis.db

0 Bytes
Binary file not shown.

resources/srs.db

0 Bytes
Binary file not shown.

src/app/qgisapp.cpp

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,21 +1987,6 @@ bool QgisApp::createDB()
19871987
"is_geo integer NOT NULL,"
19881988
"deprecated boolean);"
19891989
"CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);"
1990-
"DROP VIEW vw_srs;"
1991-
"CREATE VIEW vw_srs as "
1992-
"select a.description as description,"
1993-
"a.srs_id as srs_id,"
1994-
"a.is_geo as is_geo,"
1995-
"b.name as name,"
1996-
"a.parameters as parameters,"
1997-
"a.auth_name as auth_name,"
1998-
"a.auth_id as auth_id,"
1999-
"a.deprecated as deprecated"
2000-
" from "
2001-
"tbl_srs a inner join tbl_projection b on a.projection_acronym=b.acronym"
2002-
" order by "
2003-
"b.name,"
2004-
"a.description;"
20051990
"INSERT INTO tbl_srs(srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,auth_name,auth_id,is_geo,deprecated) SELECT srs_id,description,projection_acronym,ellipsoid_acronym,parameters,srid,'','',is_geo,0 FROM tbl_srs_bak;"
20061991
"DROP TABLE tbl_srs_bak", 0, 0, &errmsg ) != SQLITE_OK
20071992
)
@@ -2013,6 +1998,29 @@ bool QgisApp::createDB()
20131998
}
20141999
}
20152000

2001+
if ( sqlite3_exec( db,
2002+
"DROP VIEW vw_srs;"
2003+
"CREATE VIEW vw_srs AS"
2004+
" SELECT"
2005+
" a.description AS description"
2006+
",a.srs_id AS srs_id"
2007+
",a.is_geo AS is_geo"
2008+
",coalesce(b.name,a.projection_acronym) AS name"
2009+
",a.parameters AS parameters"
2010+
",a.auth_name AS auth_name"
2011+
",a.auth_id AS auth_id"
2012+
",a.deprecated AS deprecated"
2013+
" FROM tbl_srs a"
2014+
" LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym"
2015+
" ORDER BY coalesce(b.name,a.projection_acronym),a.description", 0, 0, &errmsg ) != SQLITE_OK
2016+
)
2017+
{
2018+
QMessageBox::critical( this, tr( "Private qgis.db" ), tr( "Update of view in private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) ) );
2019+
sqlite3_free( errmsg );
2020+
sqlite3_close( db );
2021+
return false;
2022+
}
2023+
20162024
sqlite3_close( db );
20172025
}
20182026
return true;

0 commit comments

Comments
 (0)