[GRASS-SVN] r54296 - grass/trunk/db/drivers/ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Dec 15 05:09:14 PST 2012


Author: martinl
Date: 2012-12-15 05:09:14 -0800 (Sat, 15 Dec 2012)
New Revision: 54296

Modified:
   grass/trunk/db/drivers/ogr/db.c
Log:
ogr dbdriver: try to open data source read-only when read-write access fails


Modified: grass/trunk/db/drivers/ogr/db.c
===================================================================
--- grass/trunk/db/drivers/ogr/db.c	2012-12-15 12:58:09 UTC (rev 54295)
+++ grass/trunk/db/drivers/ogr/db.c	2012-12-15 13:09:14 UTC (rev 54296)
@@ -47,7 +47,14 @@
 
     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"));



More information about the grass-commit mailing list