[GRASS-SVN] r34392 - grass/branches/develbranch_6/scripts/v.db.renamecol

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Nov 19 07:08:10 EST 2008


Author: mlennert
Date: 2008-11-19 07:08:10 -0500 (Wed, 19 Nov 2008)
New Revision: 34392

Modified:
   grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
Log:
added quoting to database and table variables (not sure if the latter is really useful, but probably does no harm)


Modified: grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol	2008-11-19 11:46:13 UTC (rev 34391)
+++ grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol	2008-11-19 12:08:10 UTC (rev 34392)
@@ -102,7 +102,7 @@
    exit 1
 fi
 
-table=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "$GIS_OPT_LAYER" | cut -f2 -d';'`
+table="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "$GIS_OPT_LAYER" | cut -f2 -d';'`"
 if [ -z "$table" ] ; then
    g.message -e 'There is no table connected to the input vector map! Cannot rename any column'
    cleanup
@@ -110,7 +110,7 @@
 fi
 
 keycol=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f3 -d';'`
-database=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f4 -d';'`
+database="`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f4 -d';'`"
 driver=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w $GIS_OPT_LAYER | cut -f5 -d';'`
 oldcol="`echo $GIS_OPT_COLUMN | cut -d',' -f1`"
 newcol="`echo $GIS_OPT_COLUMN | cut -d',' -f2`"
@@ -143,8 +143,8 @@
 fi
 
 # describe old col
-oldcoltype="`db.describe -c table=$table database=$database driver=$driver | grep -w "$oldcol" | cut -d':' -f3`"
-oldcollength=`db.describe -c table=$table database=$database driver=$driver | grep -w "$oldcol" | cut -d':' -f4`
+oldcoltype="`db.describe -c table="${table}" database="${database}" driver=$driver | grep -w "$oldcol" | cut -d':' -f3`"
+oldcollength=`db.describe -c table="${table}" database="${database}" driver=$driver | grep -w "$oldcol" | cut -d':' -f4`
 
 # some tricks
 if [ "$driver" = "sqlite" -o "$driver" = "dbf" ] ; then



More information about the grass-commit mailing list