[GRASS-SVN] r40311 - in grass/branches/develbranch_6/scripts: v.db.addtable v.db.reconnect.all v.out.gpsbabel

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 8 03:11:21 EST 2010


Author: hamish
Date: 2010-01-08 03:11:19 -0500 (Fri, 08 Jan 2010)
New Revision: 40311

Modified:
   grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
   grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all
   grass/branches/develbranch_6/scripts/v.out.gpsbabel/v.out.gpsbabel
Log:
further v.db.connect fixes (#809)

Modified: grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable	2010-01-08 05:44:02 UTC (rev 40310)
+++ grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable	2010-01-08 08:11:19 UTC (rev 40311)
@@ -127,7 +127,11 @@
    # there is a definition for layer 1, so we check for the user defined layer
    # v.db.connect expands $VARIABLES, we want to keep them relative so use the raw file
    eval `g.findfile elem="vector/$GIS_OPT_MAP" file=dbln`
-   database=`grep -w "^$QUERYLAYER" "$file" | cut -f4- -d' ' | sed -e 's/ [^ ]*$//'`
+   if [ ! "$file" ] ; then
+      database=""
+   else
+      database=`grep -w "^$QUERYLAYER" "$file" | cut -f4- -d' ' | sed -e 's/ [^ ]*$//'`
+   fi
 
    if [ -z "$database" ] ; then
       #nothing on user defined layer, so we use the default mapset settings in this case:

Modified: grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all	2010-01-08 05:44:02 UTC (rev 40310)
+++ grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all	2010-01-08 08:11:19 UTC (rev 40311)
@@ -73,8 +73,7 @@
 for VECT in `g.list type=vect mapset=${MAPSET} | sed 1,2d | grep -v '^-*$'`
 do
     g.message message="Reconnecting vector '${VECT}@${MAPSET}'"
-    for LINK in `v.db.connect -g fs=";" map=${VECT}@${MAPSET} | tr ';' '|'`
-    do
+    for LINK in `v.db.connect -g fs="|" map=${VECT}@${MAPSET}` ; do
         eval `echo $LINK | sed 's$\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)$LAYER=\1 SCHEMA_TABLE=\2 KEY=\3 DATABASE=\4 DRIVER=\5$'`
 
         SCHEMA=`echo $SCHEMA_TABLE | grep '\.' | sed 's/\([^.]*\)\..*/\1/'`

Modified: grass/branches/develbranch_6/scripts/v.out.gpsbabel/v.out.gpsbabel
===================================================================
--- grass/branches/develbranch_6/scripts/v.out.gpsbabel/v.out.gpsbabel	2010-01-08 05:44:02 UTC (rev 40310)
+++ grass/branches/develbranch_6/scripts/v.out.gpsbabel/v.out.gpsbabel	2010-01-08 08:11:19 UTC (rev 40311)
@@ -266,12 +266,12 @@
 
 # don't v.db.connect directly as source table will be removed with
 # temporary map in that case. So we make a temp copy of it to work with.
-DB_PARAMS=`v.db.connect -g "$INMAP" 2> /dev/null | grep "^$GIS_OPT_LAYER "`
+DB_PARAMS=`v.db.connect -g "$INMAP" fs='|' 2> /dev/null | grep "^$GIS_OPT_LAYER "`
 if [ -n "$DB_PARAMS" ] ; then
-   DB_TABLE=`echo "$DB_PARAMS" | cut -f2 -d' '`
-   DB_KEY=`echo "$DB_PARAMS" | cut -f3 -d' '`
-   DB_DATABASE=`echo "$DB_PARAMS" | cut -f4 -d' '`
-   DB_DRIVER=`echo "$DB_PARAMS" | cut -f5 -d' '`
+   DB_TABLE=`echo "$DB_PARAMS" | cut -f2 -d'|'`
+   DB_KEY=`echo "$DB_PARAMS" | cut -f3 -d'|'`
+   DB_DATABASE=`echo "$DB_PARAMS" | cut -f4 -d'|'`
+   DB_DRIVER=`echo "$DB_PARAMS" | cut -f5 -d'|'`
 
    db.copy from_driver="$DB_DRIVER" from_database="$DB_DATABASE" \
       from_table="$DB_TABLE"  to_table="tmp_vogb_epsg4326_$$"



More information about the grass-commit mailing list