[GRASS-SVN] r56728 - grass-addons/grass6/vector/v.points.cog

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jun 15 23:12:53 PDT 2013


Author: hamish
Date: 2013-06-15 23:12:52 -0700 (Sat, 15 Jun 2013)
New Revision: 56728

Modified:
   grass-addons/grass6/vector/v.points.cog/v.points.cog
Log:
work when @mapset is given

Modified: grass-addons/grass6/vector/v.points.cog/v.points.cog
===================================================================
--- grass-addons/grass6/vector/v.points.cog/v.points.cog	2013-06-16 05:41:40 UTC (rev 56727)
+++ grass-addons/grass6/vector/v.points.cog/v.points.cog	2013-06-16 06:12:52 UTC (rev 56728)
@@ -84,9 +84,18 @@
     exit 1
 fi
 
-# get column details so we can recreate it
+# get column details so we can recreate it.
+# The db.* modules need special care when querying from @another mapset
 DB=`v.db.connect "$MAP" -g layer="$LAYER" fs='|' | cut -f4 -d'|'`
-COLUMN_DESC=`db.describe -c table="$MAP" database="$DB" | grep " $COLUMN:" | cut -f3- -d:`
+BASENAME=`echo "$MAP" | sed -e 's/@.*//'`
+db.describe -c table="$BASENAME" database="$DB" > /dev/null
+if [ $? -ne 0 ] ; then
+   g.message -e "Unable to describe table"
+   exit 1
+fi
+COLUMN_DESC=`db.describe -c table="$BASENAME" database="$DB" | grep " $COLUMN:" | cut -f3- -d:`
+
+
 if [ `echo "$COLUMN_DESC" | grep -c CHARACTER` -eq 1 ] ; then
    COLUMN_TYPE="string"
    COLUMN_LEN=`echo "$COLUMN_DESC" | cut -f2 -d:`
@@ -97,7 +106,7 @@
 fi
 
 # cheap hack to avoid conflict
-if [ $COLUMN = "cat" ] ; then
+if [ "$COLUMN" = "cat" ] ; then
   OUT_COLUMN="cat_"
 else
   OUT_COLUMN="$COLUMN"



More information about the grass-commit mailing list