[GRASS-SVN] r60243 - grass/branches/releasebranch_6_4/scripts/v.rast.stats
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed May 14 15:40:31 PDT 2014
Author: neteler
Date: 2014-05-14 15:40:30 -0700 (Wed, 14 May 2014)
New Revision: 60243
Modified:
grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats
Log:
v.rast.stats: use DB TRANSACTION to speed up
Modified: grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats
===================================================================
--- grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats 2014-05-14 19:47:21 UTC (rev 60242)
+++ grass/branches/releasebranch_6_4/scripts/v.rast.stats/v.rast.stats 2014-05-14 22:40:30 UTC (rev 60243)
@@ -360,20 +360,22 @@
# create SQL file for extended and normal statistics
g.message -v "Creating SQL file ..."
+echo "BEGIN TRANSACTION;" > "$SQLTMP"
if [ $GIS_FLAG_E -eq 1 ] ; then
sed -e '1d' "$STATSTMP" | awk -F "|" \
'{printf "\nUPDATE '${TABLE}' SET '${col1}' = %i , '${col2}' = %.15g , \
'${col3}' = %.15g , '${col4}' = %.15g , '${col5}' = %.15g , '${col6}' = %.15g , \
'${col7}' = %.15g , '${col8}' = %.15g , '${col9}' = %.15g , '${col10}' = %.15g , \
'${col11}' = %.15g , '${col12}' = %2f , '${col13}' = %.15g \
- WHERE '${KEYCOL}' = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$1}' > "$SQLTMP"
+ WHERE '${KEYCOL}' = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$1}' >> "$SQLTMP"
else
sed -e '1d' "$STATSTMP" | awk -F "|" \
'{printf "\nUPDATE '${TABLE}' SET '${col1}' = %i , '${col2}' = %.15g , \
'${col3}' = %.15g , '${col4}' = %.15g , '${col5}' = %.15g , '${col6}' = %.15g , \
'${col7}' = %.15g , '${col8}' = %.15g , '${col9}' = %.15g \
- WHERE '${KEYCOL}' = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$1}' > "$SQLTMP"
+ WHERE '${KEYCOL}' = %i;", $2,$3,$4,$5,$6,$7,$8,$9,$10,$1}' >> "$SQLTMP"
fi
+echo "COMMIT;" >> "$SQLTMP"
g.message message="Updating the database ..."
db.execute input="$SQLTMP" database="$DB_DATABASE" driver="$DB_SQLDRIVER"
More information about the grass-commit
mailing list