[GRASS-SVN] r38883 -
grass/branches/develbranch_6/scripts/v.rast.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Aug 27 06:44:15 EDT 2009
Author: hamish
Date: 2009-08-27 06:44:14 -0400 (Thu, 27 Aug 2009)
New Revision: 38883
Modified:
grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
Log:
error if column prefix is too long for DBF
Modified: grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats 2009-08-27 09:08:08 UTC (rev 38882)
+++ grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats 2009-08-27 10:44:14 UTC (rev 38883)
@@ -197,13 +197,26 @@
#check if DBF driver used, in this case cut to 10 chars col names:
DBFDRIVER=0
-v.db.connect -g "$VECTOR" fs=";" | grep -w "$GIS_OPT_LAYER" | cut -d';' -f5 | grep -i dbf --quiet
+v.db.connect -g "$VECTOR" fs=";" | grep -w "$GIS_OPT_LAYER" | \
+ cut -d';' -f5 | grep -i dbf --quiet
if [ $? -eq 0 ] ; then
DBFDRIVER=1
else
# in case a table is missing, we'll trap a crash later...
DBFDRIVER=0
fi
+
+if [ $DBFDRIVER -eq 1 ] ; then
+ # `wc -c` reports number of chars + 1 for the newline
+ if [ `echo "$COLPREFIX" | wc -c` -gt 8 ] ; then
+ g.message -e "Cannot create unique names for columns. \
+ Either use a shorter column prefix or switch to another DB \
+ backend such as SQLite. DBF limits the length to 10 characters"
+ cleanup
+ exit 1
+ fi
+fi
+
# we need this for non-DBF driver:
DB_SQLDRIVER=`v.db.connect -g "$VECTOR" fs=";" | cut -d';' -f5`
DB_DATABASE="`v.db.connect -g "$VECTOR" fs=";" | cut -d';' -f4`"
More information about the grass-commit
mailing list