[GRASS-SVN] r34005 - in grass/branches/develbranch_6/scripts: d.vect.thematic db.dropcol db.droptable v.db.addcol v.db.addtable v.db.dropcol v.db.join v.db.reconnect.all v.db.renamecol v.db.update v.dissolve v.rast.stats v.report

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


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

Modified:
   grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic
   grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol
   grass/branches/develbranch_6/scripts/db.droptable/db.droptable
   grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol
   grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
   grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol
   grass/branches/develbranch_6/scripts/v.db.join/v.db.join
   grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all
   grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
   grass/branches/develbranch_6/scripts/v.db.update/v.db.update
   grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
   grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
   grass/branches/develbranch_6/scripts/v.report/v.report
Log:
fix white space bugs (merge from trunk, r34004)

Modified: grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic
===================================================================
--- grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/d.vect.thematic/d.vect.thematic	2008-10-24 21:39:23 UTC (rev 34005)
@@ -351,9 +351,9 @@
     export GRASS_PNG_AUTO_WRITE
 fi
 
-table=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $2}'`
-database=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $4}'`
-driver=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $5}'`
+table=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $2}'`
+database=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $4}'`
+driver=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $5}'`
 
 if [ -z "$table" ]
     then
@@ -366,7 +366,7 @@
     # test, if the column GRASSRGB is in the table
     if [ -z "`db.columns table=$table database=$database driver=$driver| grep -i grassrgb`" ] ; then
         g.message message="Creating column 'grassrgb' in table '$table'"
-        echo "ALTER TABLE $table ADD COLUMN grassrgb varchar(11)" | db.execute database=$database
+        echo "ALTER TABLE $table ADD COLUMN grassrgb varchar(11)" | database="${database}" driver=${driver}
     fi
 fi
 
@@ -756,7 +756,7 @@
         # update color to database?
         if [ $GIS_FLAG_U -eq 1 ] ; then
             echo "UPDATE $table SET GRASSRGB = '$themecolor' WHERE\
-                $sqlwhere" | db.execute database=$database
+                $sqlwhere" | db.execute database="${database}" driver=${driver}
         fi
                
         # Create group for GIS Manager
@@ -1057,7 +1057,7 @@
         # update color to database?
         if [ $GIS_FLAG_U -eq 1 ] ; then
             echo "UPDATE $table SET GRASSRGB = '$themecolor' WHERE\
-                $sqlwhere" | db.execute database=$database
+                $sqlwhere" | db.execute database="${database}" driver=${driver}
         fi
       
         # Create group for GIS Manager

Modified: grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol
===================================================================
--- grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/db.dropcol/db.dropcol	2008-10-24 21:39:23 UTC (rev 34005)
@@ -153,7 +153,7 @@
 	    	exit 1
 	fi
 else
-	echo "ALTER TABLE $table DROP COLUMN $col" | db.execute database=$database driver=$driver
+	echo "ALTER TABLE $table DROP COLUMN $col" | db.execute database="${database}" driver=${driver}
 	if [ $? -eq 1 ] ; then
 	    	g.message -e "Cannot continue (problem deleting column)."
 	    	cleanup

Modified: grass/branches/develbranch_6/scripts/db.droptable/db.droptable
===================================================================
--- grass/branches/develbranch_6/scripts/db.droptable/db.droptable	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/db.droptable/db.droptable	2008-10-24 21:39:23 UTC (rev 34005)
@@ -101,7 +101,7 @@
 fi
 
 
-echo "DROP TABLE $table" | db.execute database=$database driver=$driver
+echo "DROP TABLE $table" | db.execute database="${database}" driver=${driver}
 if [ $? -eq 1 ] ; then
   	g.message -e "Cannot continue (problem deleting column)."
     	exit 1

Modified: grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.addcol/v.db.addcol	2008-10-24 21:39:23 UTC (rev 34005)
@@ -84,14 +84,14 @@
    exit 1
 fi
 
-table=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $2}'`
+table=`v.db.connect $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 $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $4}'`
-driver=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $5}'`
+database=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $4}'`
+driver=`v.db.connect $GIS_OPT_MAP -g fs=";" | grep -w $GIS_OPT_LAYER | awk -F ";" '{print $5}'`
 
 colnum=`echo $GIS_OPT_COLUMNS | awk -F, '{print NF}'`
 
@@ -105,7 +105,7 @@
       exit 1
     fi
 
-    echo "ALTER TABLE $table ADD COLUMN $col" | db.execute database=$database driver=$driver
+    echo "ALTER TABLE $table ADD COLUMN $col" | db.execute database="${database}" driver=${driver}
     if [ $? -eq 1 ] ; then
       g.message -e "Cannot continue (problem adding column)."
       exit 1

Modified: grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.addtable/v.db.addtable	2008-10-24 21:39:23 UTC (rev 34005)
@@ -177,7 +177,7 @@
 fi
 
 # connect the map to the DB:
-v.db.connect map="$GIS_OPT_MAP" database="$database" driver="$driver" \
+v.db.connect map="$GIS_OPT_MAP" database="${database}" driver="$driver" \
    layer="$GIS_OPT_LAYER" table="$table" key=cat
 
 # finally we have to add cats into the attribute DB to make modules such as v.what.rast happy:

Modified: grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.dropcol/v.db.dropcol	2008-10-24 21:39:23 UTC (rev 34005)
@@ -146,7 +146,7 @@
 	    	exit 1
 	fi
 else
-	echo "ALTER TABLE $table DROP COLUMN $col" | db.execute database=$database driver=$driver
+	echo "ALTER TABLE $table DROP COLUMN $col" | db.execute database="${database}" driver=${driver}
 	if [ $? -eq 1 ] ; then
 	    	g.message -e 'Cannot continue (problem deleting column)'
 	    	cleanup

Modified: grass/branches/develbranch_6/scripts/v.db.join/v.db.join
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.join/v.db.join	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.join/v.db.join	2008-10-24 21:39:23 UTC (rev 34005)
@@ -73,15 +73,15 @@
 
 PROG=`basename $0`
 
-driver=`v.db.connect -g map="$GIS_OPT_MAP" | grep "^$GIS_OPT_LAYER " | cut -d' ' -f5`
-database=`v.db.connect -g map="$GIS_OPT_MAP" | grep "^$GIS_OPT_LAYER " | cut -d' ' -f4`
+driver=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep "^$GIS_OPT_LAYER " | cut -d';' -f5`
+database=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep "^$GIS_OPT_LAYER " | cut -d';' -f4`
 
 if [ "$driver" = "dbf" ] ; then
    g.message -e "JOIN is not supported for tables stored in DBF format."
    exit 1
 fi
 
-maptable=`v.db.connect -g map="$GIS_OPT_MAP" | grep "^$GIS_OPT_LAYER " | cut -d' ' -f2`
+maptable=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep "^$GIS_OPT_LAYER " | cut -d';' -f2`
 if [ -z "$maptable" ] ; then
    g.message 'There is no table connected to this map! Cannot join any column.'
    cleanup
@@ -109,7 +109,7 @@
 	exit 1
   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 driver=$driver database=$database
+        FROM $GIS_OPT_OTABLE WHERE $GIS_OPT_OTABLE.$GIS_OPT_OCOLUMN=$maptable.$GIS_OPT_COLUMN);" | db.execute database="${database}" driver=${driver}
   i=`expr $i + 1`
 done
 

Modified: grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.reconnect.all/v.db.reconnect.all	2008-10-24 21:39:23 UTC (rev 34005)
@@ -72,7 +72,7 @@
 for VECT in `g.list type=vect mapset=${MAPSET} | sed 1,2d | grep -v '^-*$'`
 do
     g.message message="Reconnecting vector '${VECT}@${MAPSET}'"
-    for LINK in `v.db.connect -g map=${VECT}@${MAPSET} | tr ' ' '|'`
+    for LINK in `v.db.connect -g fs=";" map=${VECT}@${MAPSET} | tr ';' '|'`
     do
         eval `echo $LINK | sed 's$\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)|\([^\|]*\)$LAYER=\1 SCHEMA_TABLE=\2 KEY=\3 DATABASE=\4 DRIVER=\5$'`
 
@@ -90,7 +90,7 @@
         if [ "$DATABASE" = "$OLD_DATABASE" -a "$SCHEMA" = "$OLD_SCHEMA" ]
 	then
 	   g.message "    Reconnecting layer $LAYER"
-	   CMD="v.db.connect -o map=${VECT}@${MAPSET} layer=$LAYER driver=$DRIVER database=$NEW_DATABASE table=$NEW_SCHEMA_TABLE key=$KEY"
+	   CMD="v.db.connect -o map=${VECT}@${MAPSET} layer=$LAYER driver=$DRIVER database=${NEW_DATABASE} table=$NEW_SCHEMA_TABLE key=$KEY"
 	   g.message message="$CMD"
 	   $CMD
 	else 

Modified: grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.renamecol/v.db.renamecol	2008-10-24 21:39:23 UTC (rev 34005)
@@ -102,16 +102,16 @@
    exit 1
 fi
 
-table=`v.db.connect -g map="$GIS_OPT_MAP" | 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
    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 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';'`
+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`"
 
@@ -154,10 +154,10 @@
 	else
 	    v.db.addcol map="$GIS_OPT_MAP" layer=$GIS_OPT_LAYER col="$newcol $oldcoltype" || error
 	fi
-	echo "UPDATE $table SET $newcol=$oldcol" | db.execute database=$database driver=$driver
+	echo "UPDATE $table SET $newcol=$oldcol" | db.execute database="${database}" driver=${driver}
 	v.db.dropcol map="$GIS_OPT_MAP" layer=$GIS_OPT_LAYER col=$oldcol
 else
-	echo "ALTER TABLE $table RENAME $oldcol TO $newcol" | db.execute database=$database driver=$driver || error
+	echo "ALTER TABLE $table RENAME $oldcol TO $newcol" | db.execute database="${database}" driver=${driver} || error
 fi
 
 # cleanup

Modified: grass/branches/develbranch_6/scripts/v.db.update/v.db.update
===================================================================
--- grass/branches/develbranch_6/scripts/v.db.update/v.db.update	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.db.update/v.db.update	2008-10-24 21:39:23 UTC (rev 34005)
@@ -127,10 +127,10 @@
 if [ -n "$GIS_OPT_WHERE" ]
   then
     echo "UPDATE $table SET $GIS_OPT_COLUMN=$value WHERE $GIS_OPT_WHERE" |
-       db.execute database="$database" driver="$driver"
+       db.execute database="${database}" driver=${driver}
 else
     echo "UPDATE $table SET $GIS_OPT_COLUMN=$value" | \
-       db.execute database="$database" driver="$driver"
+       db.execute database="${database}" driver=${driver}
 fi
 
 # write cmd history:

Modified: grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve
===================================================================
--- grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.dissolve/v.dissolve	2008-10-24 21:39:23 UTC (rev 34005)
@@ -102,7 +102,7 @@
        exit 1
     fi
 
-   table=`v.db.connect $GIS_OPT_INPUT -g | grep -w $GIS_OPT_LAYER | awk '{print $2}'`
+   table=`v.db.connect $GIS_OPT_INPUT -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!'
       exit 1

Modified: grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.rast.stats/v.rast.stats	2008-10-24 21:39:23 UTC (rev 34005)
@@ -318,7 +318,7 @@
 
 
 g.message -v "Updating the database ..."
-db.execute input="$SQLTMP" database="$DB_DATABASE" driver="$DB_SQLDRIVER"
+db.execute input="$SQLTMP" database="${DB_DATABASE}" driver="$DB_SQLDRIVER"
 EXITCODE=$?
 
 

Modified: grass/branches/develbranch_6/scripts/v.report/v.report
===================================================================
--- grass/branches/develbranch_6/scripts/v.report/v.report	2008-10-24 21:38:43 UTC (rev 34004)
+++ grass/branches/develbranch_6/scripts/v.report/v.report	2008-10-24 21:39:23 UTC (rev 34005)
@@ -143,7 +143,7 @@
 if [ $TABLEEXISTS -eq 1 ] ; then
    v.db.select -c map="$MAP" layer="$LAYER" | sort -n -t'|' -k 1 | grep -v '^0' > "$TMP1"
    if [ `wc -l "$TMP1" | awk '{print $1}'` -eq 0 ] ; then
-      KEY=`v.db.connect -g map="$GIS_OPT_MAP" | grep -w "$LAYER" | cut -f3 -d" "`
+      KEY=`v.db.connect -g map="$GIS_OPT_MAP" fs=";" | grep -w "$LAYER" | cut -f3 -d';'`
       g.message -e "There is a table connected to input vector map '$MAP', but\
       there are no categories present in the key column '$KEY'. Consider using\
       v.to.db to correct this."



More information about the grass-commit mailing list