[GRASS-SVN] r31585 -
grass/branches/releasebranch_6_3/scripts/v.db.join
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri May 30 12:39:38 EDT 2008
Author: neteler
Date: 2008-05-30 12:39:38 -0400 (Fri, 30 May 2008)
New Revision: 31585
Modified:
grass/branches/releasebranch_6_3/scripts/v.db.join/v.db.join
Log:
don't add if col already there (merge from trunk)
Modified: grass/branches/releasebranch_6_3/scripts/v.db.join/v.db.join
===================================================================
--- grass/branches/releasebranch_6_3/scripts/v.db.join/v.db.join 2008-05-30 13:15:47 UTC (rev 31584)
+++ grass/branches/releasebranch_6_3/scripts/v.db.join/v.db.join 2008-05-30 16:39:38 UTC (rev 31585)
@@ -103,10 +103,14 @@
i=1
for col in $COLLIST ; do
- v.db.addcol "$GIS_OPT_MAP" col="$col `echo $COLTYPES | cut -d' ' -f$i | tr -s '_' ' '`"
+ # col already there?
+ v.info --quiet -c map="$GIS_OPT_MAP" layer=$GIS_OPT_LAYER | cut -d'|' -f1,2 | grep "|${col}$" 2>&1 >/dev/null
if [ $? -ne 0 ] ; then
+ v.db.addcol "$GIS_OPT_MAP" col="$col `echo $COLTYPES | cut -d' ' -f$i | tr -s '_' ' '`"
+ if [ $? -ne 0 ] ; then
g.message -e "Cannot continue."
exit 1
+ fi
fi
echo "UPDATE $maptable SET $col=(SELECT $col
FROM $GIS_OPT_otable WHERE $GIS_OPT_otable.$GIS_OPT_ocolumn=$maptable.$GIS_OPT_column);" | db.execute
More information about the grass-commit
mailing list