Skip to content

Commit

Permalink
allow crs without projection entries (fixes #6117)
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 29, 2012
1 parent 431f29d commit 12106b8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
Binary file modified resources/qgis.db
Binary file not shown.
Binary file modified resources/srs.db
Binary file not shown.
38 changes: 23 additions & 15 deletions src/app/qgisapp.cpp
Expand Up @@ -1987,21 +1987,6 @@ bool QgisApp::createDB()
"is_geo integer NOT NULL,"
"deprecated boolean);"
"CREATE INDEX idx_srsauthid on tbl_srs(auth_name,auth_id);"
"DROP VIEW vw_srs;"
"CREATE VIEW vw_srs as "
"select a.description as description,"
"a.srs_id as srs_id,"
"a.is_geo as is_geo,"
"b.name as name,"
"a.parameters as parameters,"
"a.auth_name as auth_name,"
"a.auth_id as auth_id,"
"a.deprecated as deprecated"
" from "
"tbl_srs a inner join tbl_projection b on a.projection_acronym=b.acronym"
" order by "
"b.name,"
"a.description;"
"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;"
"DROP TABLE tbl_srs_bak", 0, 0, &errmsg ) != SQLITE_OK
)
Expand All @@ -2013,6 +1998,29 @@ bool QgisApp::createDB()
}
}

if ( sqlite3_exec( db,
"DROP VIEW vw_srs;"
"CREATE VIEW vw_srs AS"
" SELECT"
" a.description AS description"
",a.srs_id AS srs_id"
",a.is_geo AS is_geo"
",coalesce(b.name,a.projection_acronym) AS name"
",a.parameters AS parameters"
",a.auth_name AS auth_name"
",a.auth_id AS auth_id"
",a.deprecated AS deprecated"
" FROM tbl_srs a"
" LEFT OUTER JOIN tbl_projection b ON a.projection_acronym=b.acronym"
" ORDER BY coalesce(b.name,a.projection_acronym),a.description", 0, 0, &errmsg ) != SQLITE_OK
)
{
QMessageBox::critical( this, tr( "Private qgis.db" ), tr( "Update of view in private qgis.db failed.\n%1" ).arg( QString::fromUtf8( errmsg ) ) );
sqlite3_free( errmsg );
sqlite3_close( db );
return false;
}

sqlite3_close( db );
}
return true;
Expand Down

0 comments on commit 12106b8

Please sign in to comment.