Selaa lähdekoodia

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 vuotta sitten
vanhempi
commit
556e01adfa
1 muutettua tiedostoa jossa 7 lisäystä ja 0 poistoa
  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"));