[GRASS-SVN] r34002 - in grass/trunk/scripts: v.db.addtable v.db.dropcol v.db.droptable v.db.update v.rast.stats

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Oct 24 17:23:51 EDT 2008


Author: neteler
Date: 2008-10-24 17:23:51 -0400 (Fri, 24 Oct 2008)
New Revision: 34002

Modified:
   grass/trunk/scripts/v.db.addtable/v.db.addtable
   grass/trunk/scripts/v.db.dropcol/v.db.dropcol
   grass/trunk/scripts/v.db.droptable/v.db.droptable
   grass/trunk/scripts/v.db.update/v.db.update
   grass/trunk/scripts/v.rast.stats/v.rast.stats
Log:
fix white space bugs

Modified: grass/trunk/scripts/v.db.addtable/v.db.addtable
===================================================================
--- grass/trunk/scripts/v.db.addtable/v.db.addtable	2008-10-24 20:38:32 UTC (rev 34001)
+++ grass/trunk/scripts/v.db.addtable/v.db.addtable	2008-10-24 21:23:51 UTC (rev 34002)
@@ -125,13 +125,13 @@
    driver=`db.connect -p | grep '^driver' | cut -d':' -f2`
 else
    # there is a definition for layer 1, so we check for the user defined layer
-   database=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$QUERYLAYER" | awk '{print $4}'`
+   database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$QUERYLAYER" | awk -F ";" '{print $4}'`
    if [ -z "database" ] ; then
       #nothing on user defined layer, so we use the default mapset settings in this case:
       database=`db.connect -p | grep '^database' | cut -d':' -f2`
       driver=`db.connect -p | grep '^driver' | cut -d':' -f2`
    else
-      driver=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$QUERYLAYER" | awk '{print $5}'`
+      driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$QUERYLAYER" | awk -F ";" '{print $5}'`
    fi
 fi
 

Modified: grass/trunk/scripts/v.db.dropcol/v.db.dropcol
===================================================================
--- grass/trunk/scripts/v.db.dropcol/v.db.dropcol	2008-10-24 20:38:32 UTC (rev 34001)
+++ grass/trunk/scripts/v.db.dropcol/v.db.dropcol	2008-10-24 21:23:51 UTC (rev 34002)
@@ -97,15 +97,15 @@
    exit 1
 fi
 
-table=`v.db.connect map=$GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | cut -f2 -d" "`
+table=`v.db.connect map=$GIS_OPT_MAP -g 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 delete any column'
    cleanup
    exit 1
 fi
-keycol=`v.db.connect -g map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f3 -d' '`
-database=`v.db.connect -g map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f4 -d' '`
-driver=`v.db.connect -g map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f5 -d' '`
+keycol=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f3 -d';'`
+database=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f4 -d';'`
+driver=`v.db.connect -g fs=";" map=$GIS_OPT_MAP | grep -w $GIS_OPT_LAYER | cut -f5 -d';'`
 col="$GIS_OPT_COLUMN"
 
 if [ "$col" = "$keycol" ] ; then

Modified: grass/trunk/scripts/v.db.droptable/v.db.droptable
===================================================================
--- grass/trunk/scripts/v.db.droptable/v.db.droptable	2008-10-24 20:38:32 UTC (rev 34001)
+++ grass/trunk/scripts/v.db.droptable/v.db.droptable	2008-10-24 21:23:51 UTC (rev 34002)
@@ -78,7 +78,7 @@
        g.message -e "An error occured while running v.db.connect"
        exit 1
     fi
-    table=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $2}'`
+    table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
     if [ -z $table ] ; then
        g.message -e "No table assigned to layer <$GIS_OPT_LAYER>"
        exit 1
@@ -86,7 +86,7 @@
     # Removing table name connected to selected layer
 else
     # Removing user specified table
-    existingtable=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $2}'`
+    existingtable=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
     table=$GIS_OPT_TABLE
     if [ "$existingtable" != "$table" ] ; then
        g.message -e "User selected table <$table> but the table <$existingtable> is linked to layer <$GIS_OPT_LAYER>" 
@@ -100,8 +100,8 @@
    g.message -e "An error occured while running v.db.connect" 
    exit 1
 fi
-database=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $4}'`
-driver=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $5}'`
+database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
 
 g.message "Removing table <$table> linked to layer <$GIS_OPT_LAYER> of vector map <$GIS_OPT_MAP>" 
 

Modified: grass/trunk/scripts/v.db.update/v.db.update
===================================================================
--- grass/trunk/scripts/v.db.update/v.db.update	2008-10-24 20:38:32 UTC (rev 34001)
+++ grass/trunk/scripts/v.db.update/v.db.update	2008-10-24 21:23:51 UTC (rev 34002)
@@ -96,14 +96,14 @@
    exit 1
 fi
 
-table=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $2}'`
+table=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
 if [ -z "$table" ] ; then
    g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
    exit 1
 fi
 
-database=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $4}'`
-driver=`v.db.connect map="$GIS_OPT_MAP" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $5}'`
+database=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $4}'`
+driver=`v.db.connect map="$GIS_OPT_MAP" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $5}'`
 
 # checking column types
 coltype=`v.info -c map="$GIS_OPT_MAP" --quiet | grep -w "$GIS_OPT_COLUMN" | cut -d'|' -f1`

Modified: grass/trunk/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/trunk/scripts/v.rast.stats/v.rast.stats	2008-10-24 20:38:32 UTC (rev 34001)
+++ grass/trunk/scripts/v.rast.stats/v.rast.stats	2008-10-24 21:23:51 UTC (rev 34002)
@@ -197,7 +197,7 @@
 
 #check if DBF driver used, in this case cut to 10 chars col names:
 DBFDRIVER=0
-v.db.connect -g "$VECTOR" | 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
@@ -205,11 +205,11 @@
    DBFDRIVER=0
 fi
 # we need this for non-DBF driver:
-DB_SQLDRIVER=`v.db.connect -g "$VECTOR" | cut -d' ' -f5`
-DB_DATABASE="`v.db.connect -g "$VECTOR" | cut -d' ' -f4`"
+DB_SQLDRIVER=`v.db.connect -g "$VECTOR" fs=";" | cut -d';' -f5`
+DB_DATABASE="`v.db.connect -g "$VECTOR" fs=";" | cut -d';' -f4`"
 
 #Find out which table is linked to the vector map on the given layer
-TABLE=`v.db.connect map="$VECTOR" -g | grep -w "$GIS_OPT_LAYER" | awk '{print $2}'`
+TABLE=`v.db.connect map="$VECTOR" -g fs=";" | grep -w "$GIS_OPT_LAYER" | awk -F ";" '{print $2}'`
 if [ -z "$TABLE" ] ; then
    g.message -e 'There is no table connected to this map! Run v.db.connect or v.db.addtable first.'
    exit 1



More information about the grass-commit mailing list