[GRASS-SVN] r32777 - in grass-addons/raster/r.rast4d: bin lib
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Aug 15 09:04:15 EDT 2008
Author: neteler
Date: 2008-08-15 09:04:15 -0400 (Fri, 15 Aug 2008)
New Revision: 32777
Modified:
grass-addons/raster/r.rast4d/bin/tg.list
grass-addons/raster/r.rast4d/lib/insert_raster.sh
grass-addons/raster/r.rast4d/lib/remove_raster.sh
Log:
generalized $GRAST4D_DBM call syntax
Modified: grass-addons/raster/r.rast4d/bin/tg.list
===================================================================
--- grass-addons/raster/r.rast4d/bin/tg.list 2008-08-15 12:59:10 UTC (rev 32776)
+++ grass-addons/raster/r.rast4d/bin/tg.list 2008-08-15 13:04:15 UTC (rev 32777)
@@ -70,7 +70,7 @@
source ${GISBASE}/etc/r.rast4d/globals/defines.sh
echo "select $GIS_OPT_SELECTION from $GRASTER_VIEW_NAME where $GIS_OPT_WHERE order by $GIS_OPT_ORDER"
-$GRAST4D_DBM $GRAST4D_DATABASE "select $GIS_OPT_SELECTION from $GRASTER_VIEW_NAME where $GIS_OPT_WHERE order by $GIS_OPT_ORDER"
+echo "select $GIS_OPT_SELECTION from $GRASTER_VIEW_NAME where $GIS_OPT_WHERE order by $GIS_OPT_ORDER;" | $GRAST4D_DBM $GRAST4D_DATABASE
exit 0
Modified: grass-addons/raster/r.rast4d/lib/insert_raster.sh
===================================================================
--- grass-addons/raster/r.rast4d/lib/insert_raster.sh 2008-08-15 12:59:10 UTC (rev 32776)
+++ grass-addons/raster/r.rast4d/lib/insert_raster.sh 2008-08-15 13:04:15 UTC (rev 32777)
@@ -48,14 +48,14 @@
CAT_NUM=`r.info $MAPNAME | grep "Categories:" | awk '{print $9}'`
# create or update the database table
-STRING=`$GRAST4D_DBM $GRAST4D_DATABASE "select name from $GRASTER_TABLE_NAME where name='$MAPNAME'"`
+STRING=`echo "SELECT name FROM $GRASTER_TABLE_NAME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE`
if [ "$STRING" = "" ] ; then
echo "INSERT NEW $GRASTER_TABLE_NAME ENTRY $MAPNAME"
SQL_DATATYPE_STRING="(name, base_map, reference_table, color, group_table, temporal_table, metadata_table, category_table, category_num)"
SQL_VALUE_STRING="('$MAPNAME', '$BASE_MAP', '$REFERENCE_TABLE','$COLOR', '$GROUP_TABLE', '$TEMPORAL_TABLE', '$METADATA_TABLE', '$CATEGORY_TABLE', '$CAT_NUM')"
- $GRAST4D_DBM $GRAST4D_DATABASE "INSERT INTO $GRASTER_TABLE_NAME $SQL_DATATYPE_STRING values $SQL_VALUE_STRING"
+ echo "INSERT INTO $GRASTER_TABLE_NAME $SQL_DATATYPE_STRING values $SQL_VALUE_STRING;" | $GRAST4D_DBM $GRAST4D_DATABASE
#create the raster map tables
#cat $SQL_DIR/create_name_list_table.sql | sed s/TABLE_NAME/$REFERENCE_TABLE/ | $GRAST4D_DBM $GRAST4D_DATABASE
@@ -66,9 +66,9 @@
else
echo "UPDATE $GRASTER_TABLE_NAME ENTRY $MAPNAME"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TABLE_NAME SET base_map='$BASE_MAP' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TABLE_NAME SET color='$COLOR' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TABLE_NAME SET category_num='$CAT_NUM' WHERE name='$MAPNAME'"
+ echo "UPDATE $GRASTER_TABLE_NAME SET base_map='$BASE_MAP' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $GRASTER_TABLE_NAME SET color='$COLOR' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $GRASTER_TABLE_NAME SET category_num='$CAT_NUM' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
fi
}
@@ -116,35 +116,35 @@
# insert or update
-STRING=`$GRAST4D_DBM $GRAST4D_DATABASE "select name from $METADATA_TABLE where name='$MAPNAME'"`
+STRING=`echo "select name from $METADATA_TABLE where name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE`
if [ "$STRING" = "" ] ; then
echo "INSERT NEW $METADATA_TABLE ENTRY $MAPNAME"
SQL_DATATYPE_STRING="(name, projection, datatype, rows, cols, cell_num, north, south, west, east, ns_res,
ew_res, min, max, mtime, creator, data_source, comments, description, additional_data)"
SQL_VALUE_STRING="('$MAPNAME', '$PROJECTION', '$datatype', '$ROWS', '$COLS', '$CELLNUM', '$north', '$south', '$west', '$east',
'$nsres' , '$ewres', '$min', '$max', $MTIME, '$CREATOR', '$DATA_SOURCE', '$COMMENTS', '$DESCRIPTION' , '$ADDITIONAL_DATA')"
- $GRAST4D_DBM $GRAST4D_DATABASE "INSERT INTO $METADATA_TABLE $SQL_DATATYPE_STRING values $SQL_VALUE_STRING"
+ echo "INSERT INTO $METADATA_TABLE $SQL_DATATYPE_STRING values $SQL_VALUE_STRING;" | $GRAST4D_DBM $GRAST4D_DATABASE
else
echo "UPDATE $METADATA_TABLE ENTRY $MAPNAME"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET projection='$PROJECTION' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET datatype='$datatype' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET rows='$ROWS' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET cols='$COLS' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET cell_num='$CELLNUM' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET north='$north' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET south='$south' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET west='$west' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET east='$east' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET ns_res='$nsres' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET ew_res='$ewres' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET min='$min' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET max='$max' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET mtime=$MTIME WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET creator='$CREATOR' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET data_source='$DATA_SOURCE' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET comments='$COMMENTS' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET description='$DESCRIPTION' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $METADATA_TABLE SET additional_data='$ADDITIONAL_DATA' WHERE name='$MAPNAME'"
+ echo "UPDATE $METADATA_TABLE SET projection='$PROJECTION' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET datatype='$datatype' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET rows='$ROWS' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET cols='$COLS' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET cell_num='$CELLNUM' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET north='$north' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET south='$south' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET west='$west' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET east='$east' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET ns_res='$nsres' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET ew_res='$ewres' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET min='$min' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET max='$max' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET mtime=$MTIME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET creator='$CREATOR' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET data_source='$DATA_SOURCE' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET comments='$COMMENTS' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET description='$DESCRIPTION' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $METADATA_TABLE SET additional_data='$ADDITIONAL_DATA' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
fi
}
@@ -180,23 +180,23 @@
#echo $VTIME_END
# insert or update
-STRING=`$GRAST4D_DBM $GRAST4D_DATABASE "select name from $GRASTER_TIME_TABLE_NAME where name='$MAPNAME'"`
+STRING=`echo "select name from $GRASTER_TIME_TABLE_NAME where name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE`
if [ "$STRING" = "" ] ; then
echo "INSERT NEW $GRASTER_TIME_TABLE_NAME ENTRY $MAPNAME"
SQL_DATATYPE_STRING="(name, ctime, mtime, vtime_start, vtime_end)"
SQL_VALUE_STRING="('$MAPNAME', '$CTIME', $MTIME, '$VTIME_START', $VTIME_END)"
- $GRAST4D_DBM $GRAST4D_DATABASE "INSERT INTO $GRASTER_TIME_TABLE_NAME $SQL_DATATYPE_STRING values $SQL_VALUE_STRING"
+ echo "INSERT INTO $GRASTER_TIME_TABLE_NAME $SQL_DATATYPE_STRING values $SQL_VALUE_STRING;" | $GRAST4D_DBM $GRAST4D_DATABASE
else
echo "UPDATE $GRASTER_TIME_TABLE_NAME ENTRY $MAPNAME"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET ctime='$CTIME' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET mtime=$MTIME WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_start='$VTIME_START' WHERE name='$MAPNAME'"
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_end=$VTIME_END WHERE name='$MAPNAME'"
+ echo "UPDATE $GRASTER_TIME_TABLE_NAME SET ctime='$CTIME' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $GRASTER_TIME_TABLE_NAME SET mtime=$MTIME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_start='$VTIME_START' WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
+ echo "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_end=$VTIME_END WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
# difference in days
- $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_duration=(strftime('%s',vtime_end) - (SELECT strftime('%s',vtime_start)))/86400.0"
+ echo "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_duration=(strftime('%s',vtime_end) - (SELECT strftime('%s',vtime_start)))/86400.0;" | $GRAST4D_DBM $GRAST4D_DATABASE
fi
exit
}
Modified: grass-addons/raster/r.rast4d/lib/remove_raster.sh
===================================================================
--- grass-addons/raster/r.rast4d/lib/remove_raster.sh 2008-08-15 12:59:10 UTC (rev 32776)
+++ grass-addons/raster/r.rast4d/lib/remove_raster.sh 2008-08-15 13:04:15 UTC (rev 32777)
@@ -23,7 +23,7 @@
#$DBM $DATABASE "DROP TABLE $TEMPORAL_TABLE"
echo "REMOVE $MAPNAME FROM $GRASTER_TABLE_NAME"
-$GRAST4D_DBM $GRAST4D_DATABASE "DELETE FROM $GRASTER_TABLE_NAME WHERE name='$MAPNAME'"
+echo "DELETE FROM $GRASTER_TABLE_NAME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
}
@@ -31,12 +31,12 @@
{
MAPNAME=$1
echo "REMOVE $MAPNAME FROM $GRASTER_METADATA_TABLE_NAME"
-$GRAST4D_DBM $GRAST4D_DATABASE "DELETE FROM $GRASTER_METADATA_TABLE_NAME WHERE name='$MAPNAME'"
+echo "DELETE FROM $GRASTER_METADATA_TABLE_NAME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
}
remove_raster_map_time ()
{
MAPNAME=$1
echo "REMOVE $MAPNAME FROM $GRASTER_TIME_TABLE_NAME"
-$GRAST4D_DBM $GRAST4D_DATABASE "DELETE FROM $GRASTER_TIME_TABLE_NAME WHERE name='$MAPNAME'"
+echo "DELETE FROM $GRASTER_TIME_TABLE_NAME WHERE name='$MAPNAME';" | $GRAST4D_DBM $GRAST4D_DATABASE
}
More information about the grass-commit
mailing list