[GRASS-SVN] r52765 - grass/branches/releasebranch_6_4/vector/v.in.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Aug 20 05:06:46 PDT 2012


Author: mmetz
Date: 2012-08-20 05:06:45 -0700 (Mon, 20 Aug 2012)
New Revision: 52765

Modified:
   grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c
Log:
v.in.ogr support whitespace in dsn and layer

Modified: grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c	2012-08-20 12:04:27 UTC (rev 52764)
+++ grass/branches/releasebranch_6_4/vector/v.in.ogr/main.c	2012-08-20 12:06:45 UTC (rev 52765)
@@ -638,6 +638,7 @@
 	/* Add DB link */
 	if (!notab_flag->answer) {
 	    char *cat_col_name = "cat";
+	    char *lname;
 
 	    if (nlayers == 1) {	/* one layer only */
 		Fi = Vect_default_field_info(&Map, layer + 1, NULL,
@@ -651,8 +652,14 @@
 	    if (ncnames > 0) {
 		cat_col_name = cnames_opt->answers[0];
 	    }
-	    Vect_map_add_dblink(&Map, layer + 1, layer_names[layer], Fi->table,
+	    /* replace all spaces with underscore, otherwise dbln can't be read */
+	    lname = G_store(layer_names[layer]);
+	    G_strip(lname);
+	    G_strchg(lname, ' ', '_');
+
+	    Vect_map_add_dblink(&Map, layer + 1, lname, Fi->table,
 				cat_col_name, Fi->database, Fi->driver);
+	    G_free(lname);
 
 	    ncols = OGR_FD_GetFieldCount(Ogr_featuredefn);
 	    G_debug(2, "%d columns", ncols);



More information about the grass-commit mailing list