[GRASS-SVN] r52060 - grass-addons/grass7/vector/v.build.pg
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 13 07:18:16 PDT 2012
Author: martinl
Date: 2012-06-13 07:18:16 -0700 (Wed, 13 Jun 2012)
New Revision: 52060
Modified:
grass-addons/grass7/vector/v.build.pg/v.build.pg.py
Log:
v.build.pg: add new flag (-p) to print SQL staments (dry run)
Modified: grass-addons/grass7/vector/v.build.pg/v.build.pg.py
===================================================================
--- grass-addons/grass7/vector/v.build.pg/v.build.pg.py 2012-06-13 11:30:35 UTC (rev 52059)
+++ grass-addons/grass7/vector/v.build.pg/v.build.pg.py 2012-06-13 14:18:16 UTC (rev 52060)
@@ -41,7 +41,11 @@
#% description: Tolerance to snap input geometry to existing primitives
#% type: double
#% answer: 1
-#end
+#%end
+#%flag
+#% key: p
+#% description: Don't execute SQL statements, just print them and exit
+#%end
import os
import sys
@@ -54,6 +58,10 @@
else:
cmd = 'execute'
+ if flags['p']:
+ sys.stdout.write("\n%s\n\n" % sql)
+ return
+
ret = grass.run_command('db.%s' % cmd, sql = sql,
**pg_conn)
if ret == 0:
More information about the grass-commit
mailing list