소스 검색

ogr dbdriver: try to open data source read-only when read-write access fails

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54296 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 년 전
부모
커밋
556e01adfa
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      db/drivers/ogr/db.c

+ 7 - 0
db/drivers/ogr/db.c

@@ -47,7 +47,14 @@ int db__driver_open_database(dbHandle * handle)
 
     OGRRegisterAll();
 
+    /* try read-write access */
     hDs = OGROpen(name, TRUE, NULL);
+    if (hDs == NULL) {
+        /* try read-only access */
+        hDs = OGROpen(name, FALSE, NULL);
+        if (hDs)
+            G_important_message(_("Had to open data source read-only"));
+    }
 
     if (hDs == NULL) {
 	db_d_append_error(_("Unable to open OGR data source"));