[GRASS-SVN] r45912 - grass/branches/develbranch_6/vector/v.out.ogr

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Apr 12 03:07:57 EDT 2011


Author: martinl
Date: 2011-04-12 00:07:57 -0700 (Tue, 12 Apr 2011)
New Revision: 45912

Modified:
   grass/branches/develbranch_6/vector/v.out.ogr/main.c
Log:
v.out.ogr: support transactions (major speed up)
	   (merge r45911 from trunk)


Modified: grass/branches/develbranch_6/vector/v.out.ogr/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.out.ogr/main.c	2011-04-12 06:53:23 UTC (rev 45911)
+++ grass/branches/develbranch_6/vector/v.out.ogr/main.c	2011-04-12 07:07:57 UTC (rev 45912)
@@ -375,8 +375,7 @@
     }
     else {
 	if (otype & GV_POINT)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_POINT);
+	    num_to_export += Vect_get_num_primitives(&In, GV_POINT);
     }
 
     if (Vect_get_num_primitives(&In, GV_LINE) < 1 && (otype & GV_LINE)) {
@@ -385,8 +384,7 @@
     }
     else {
 	if (otype & GV_LINE)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_LINE);
+	    num_to_export += Vect_get_num_primitives(&In, GV_LINE);
     }
 
     if (Vect_get_num_primitives(&In, GV_BOUNDARY) < 1 &&
@@ -396,8 +394,7 @@
     }
     else {
 	if (otype & GV_BOUNDARY)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_BOUNDARY);
+	    num_to_export += Vect_get_num_primitives(&In, GV_BOUNDARY);
     }
 
     if (Vect_get_num_areas(&In) < 1 && (otype & GV_AREA)) {
@@ -406,7 +403,7 @@
     }
     else {
 	if (otype & GV_AREA)
-	    num_to_export = num_to_export + Vect_get_num_areas(&In);
+	    num_to_export += Vect_get_num_areas(&In);
     }
 
     if (Vect_get_num_primitives(&In, GV_CENTROID) < 1 &&
@@ -416,8 +413,7 @@
     }
     else {
 	if (otype & GV_CENTROID)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_CENTROID);
+	    num_to_export += Vect_get_num_primitives(&In, GV_CENTROID);
     }
 
     if (Vect_get_num_primitives(&In, GV_FACE) < 1 && (otype & GV_FACE)) {
@@ -426,8 +422,7 @@
     }
     else {
 	if (otype & GV_FACE)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_FACE);
+	    num_to_export += Vect_get_num_primitives(&In, GV_FACE);
     }
 
     if (Vect_get_num_primitives(&In, GV_KERNEL) < 1 && (otype & GV_KERNEL)) {
@@ -436,8 +431,7 @@
     }
     else {
 	if (otype & GV_KERNEL)
-	    num_to_export =
-		num_to_export + Vect_get_num_primitives(&In, GV_KERNEL);
+	    num_to_export += Vect_get_num_primitives(&In, GV_KERNEL);
     }
 
     if (Vect_get_num_volumes(&In) < 1 && (otype & GV_VOLUME)) {
@@ -446,7 +440,7 @@
     }
     else {
 	if (otype & GV_VOLUME)
-	    num_to_export = num_to_export + Vect_get_num_volumes(&In);
+	    num_to_export += Vect_get_num_volumes(&In);
     }
 
     G_debug(1, "Requested to export %d geometries", num_to_export);
@@ -582,7 +576,7 @@
     CSLDestroy(papszLCO);
     if (Ogr_layer == NULL)
 	G_fatal_error(_("Unable to create OGR layer"));
-
+    
     db_init_string(&dbstring);
 
     /* Vector attributes -> OGR fields */
@@ -680,7 +674,6 @@
 
     fout = fskip = nocat = noatt = nocatskip = 0;
 
-
     /* Fetch all attribute records */
     if (doatt) {
     	sprintf(buf, "SELECT * FROM %s", Fi->table);
@@ -692,8 +685,10 @@
     	      cat);
     	}
     }
-
-
+    
+    if (OGR_L_TestCapability(Ogr_layer, OLCTransactions))
+	OGR_L_StartTransaction(Ogr_layer);
+    
     /* Lines (run always to count features of different type) */
     if ((otype & GV_POINTS) || (otype & GV_LINES)) {
 	G_message(_("Exporting %i geometries..."), Vect_get_num_lines(&In));
@@ -979,6 +974,9 @@
 	G_warning(_("Export of volumes not implemented yet. Skipping."));
     }
 
+    if (OGR_L_TestCapability(Ogr_layer, OLCTransactions))
+	OGR_L_CommitTransaction(Ogr_layer);
+
     OGR_DS_Destroy(Ogr_ds);
 
     Vect_close(&In);



More information about the grass-commit mailing list