[GRASS-SVN] r33789 - in grass/branches/develbranch_6: lib/python vector/v.db.connect

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Oct 9 07:56:47 EDT 2008


Author: neteler
Date: 2008-10-09 07:56:47 -0400 (Thu, 09 Oct 2008)
New Revision: 33789

Modified:
   grass/branches/develbranch_6/lib/python/grass.py
   grass/branches/develbranch_6/vector/v.db.connect/main.c
Log:
Add fs= option to v.db.connect (for use by -g);
Change vector_db to use fs=| (to allow for spaces in pathnames) (merge from trunk, r33787)


Modified: grass/branches/develbranch_6/lib/python/grass.py
===================================================================
--- grass/branches/develbranch_6/lib/python/grass.py	2008-10-09 11:23:35 UTC (rev 33788)
+++ grass/branches/develbranch_6/lib/python/grass.py	2008-10-09 11:56:47 UTC (rev 33789)
@@ -442,10 +442,10 @@
     """Return the database connection details for a vector map
     (interface to `v.db.connect -g').
     """
-    s = read_command('v.db.connect', flags = 'g', map = map, layer = layer, **args)
+    s = read_command('v.db.connect', flags = 'g', map = map, layer = layer, fs = '|', **args)
     result = []
     for l in s.splitlines():
-	f = l.split(' ')
+	f = l.split('|')
 	if len(f) != 5:
 	    continue
 	if layer and int(layer) == int(f[0]):

Modified: grass/branches/develbranch_6/vector/v.db.connect/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.db.connect/main.c	2008-10-09 11:23:35 UTC (rev 33788)
+++ grass/branches/develbranch_6/vector/v.db.connect/main.c	2008-10-09 11:56:47 UTC (rev 33789)
@@ -33,7 +33,7 @@
     char *input, *mapset;
     struct GModule *module;
     struct Option *inopt, *dbdriver, *dbdatabase, *dbtable, *field_opt,
-	*dbkey;
+	*dbkey, *sep_opt;
     struct Flag *overwrite, *print, *columns, *delete, *shell_print;
     dbDriver *driver;
     dbString table_name;
@@ -72,6 +72,9 @@
 
     field_opt = G_define_standard_option(G_OPT_V_FIELD);
 
+    sep_opt = G_define_standard_option(G_OPT_F_SEP);
+    sep_opt->answer = " ";
+
     print = G_define_flag();
     print->key = 'p';
     print->description = _("Print all map connection parameters and exit");
@@ -153,15 +156,18 @@
 			G_fatal_error(_("Database connection not defined"));
 
 		    if (shell_print->answer) {
+			const char *sep = sep_opt->answer;
 			if (fi->name) {
-			    fprintf(stdout, "%d/%s %s %s %s %s\n", fi->number,
-				    fi->name, fi->table, fi->key,
-				    fi->database, fi->driver);
+			    fprintf(stdout, "%d/%s%s%s%s%s%s%s%s%s\n",
+				    fi->number, fi->name, sep,
+				    fi->table, sep, fi->key, sep,
+				    fi->database, sep, fi->driver);
 			}
 			else {
-			    fprintf(stdout, "%d %s %s %s %s\n", fi->number,
-				    fi->table, fi->key, fi->database,
-				    fi->driver);
+			    fprintf(stdout, "%d%s%s%s%s%s%s%s%s\n",
+				    fi->number, sep,
+				    fi->table, sep, fi->key, sep,
+				    fi->database, sep, fi->driver);
 			}
 		    }
 		    else {



More information about the grass-commit mailing list