[GRASS-SVN] r59579 - grass-addons/grass6/vector/v.mkhexgrid

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 5 09:32:01 PDT 2014


Author: neteler
Date: 2014-04-05 09:32:00 -0700 (Sat, 05 Apr 2014)
New Revision: 59579

Modified:
   grass-addons/grass6/vector/v.mkhexgrid/v.mkhexgrid
Log:
v.mkhexgrid: speed up with SQL TRANSACTION

Modified: grass-addons/grass6/vector/v.mkhexgrid/v.mkhexgrid
===================================================================
--- grass-addons/grass6/vector/v.mkhexgrid/v.mkhexgrid	2014-04-05 16:17:55 UTC (rev 59578)
+++ grass-addons/grass6/vector/v.mkhexgrid/v.mkhexgrid	2014-04-05 16:32:00 UTC (rev 59579)
@@ -253,6 +253,7 @@
     #print "filename: %s\nx: %s, y: %s\nxmax: %s, ymax: %s\nside_length: %s" % (outfile, xstart, ystart, xmax, ymax, side_len)
     vf = open(vectorfile, "w")
     sf = open(sqlfile, "w")
+    sf.write("BEGIN TRANSACTION;\n")
     WriteGrassHeader(vf,vectorfile,xstart,ystart,xmax,ymax)
     tname = options['output'].split('@')[0]
     schema = gdb.db_connection()['schema']
@@ -262,6 +263,7 @@
         table_name = schema + '.' + tname
     WriteHexGridVectors(vf, sf, table_name, float(side_len), float(xstart), float(ystart), float(xmax), float(ymax))
     vf.close()
+    sf.write("COMMIT;\n")
     sf.close()
     # now import and clean up the vector
     grass.message('Importing GRASS ascii file')



More information about the grass-commit mailing list