[GRASS-SVN] r30008 - grass/branches/releasebranch_6_3/scripts/v.db.renamecol

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 7 16:15:56 EST 2008


Author: neteler
Date: 2008-02-07 16:15:56 -0500 (Thu, 07 Feb 2008)
New Revision: 30008

Modified:
   grass/branches/releasebranch_6_3/scripts/v.db.renamecol/v.db.renamecol
Log:
fail if DBF driver and too long target column name

Modified: grass/branches/releasebranch_6_3/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/releasebranch_6_3/scripts/v.db.renamecol/v.db.renamecol	2008-02-07 21:14:33 UTC (rev 30007)
+++ grass/branches/releasebranch_6_3/scripts/v.db.renamecol/v.db.renamecol	2008-02-07 21:15:56 UTC (rev 30008)
@@ -124,6 +124,16 @@
 oldcol="`echo $GIS_OPT_COLUMN | cut -d',' -f1`"
 newcol="`echo $GIS_OPT_COLUMN | cut -d',' -f2`"
 
+if [ "$driver" = "dbf" ] ; then
+  # strangely "" counts as 1
+  NAMELEN=`echo "$newcol" | wc -c | awk '{print $1}'`
+  if [ "$NAMELEN" -gt 11 ] ; then
+   g.message -e "Column name too long <$newcol>: the DBF driver only supports up to 10 characters as column name."
+   cleanup
+   exit 1
+  fi
+fi
+
 if [ "$col" = "cat" ] ; then
    g.message -e "Cannot rename <$col> column as it is needed to keep table \
      connected to vector map"



More information about the grass-commit mailing list