[GRASS-SVN] r45911 - grass/trunk/vector/v.out.ogr
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 12 02:53:23 EDT 2011
Author: martinl
Date: 2011-04-11 23:53:23 -0700 (Mon, 11 Apr 2011)
New Revision: 45911
Modified:
grass/trunk/vector/v.out.ogr/main.c
Log:
v.out.ogr: support transactions (major speed up)
Modified: grass/trunk/vector/v.out.ogr/main.c
===================================================================
--- grass/trunk/vector/v.out.ogr/main.c 2011-04-12 06:29:03 UTC (rev 45910)
+++ grass/trunk/vector/v.out.ogr/main.c 2011-04-12 06:53:23 UTC (rev 45911)
@@ -308,8 +308,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)) {
@@ -318,8 +317,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 &&
@@ -329,8 +327,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)) {
@@ -339,7 +336,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 &&
@@ -349,8 +346,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)) {
@@ -359,8 +355,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)) {
@@ -369,8 +364,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)) {
@@ -379,7 +373,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 features", num_to_export);
@@ -534,7 +528,7 @@
else
G_fatal_error(_("Unable to create OGR layer"));
}
-
+
db_init_string(&dbstring);
/* Vector attributes -> OGR fields */
@@ -644,7 +638,6 @@
fout = fskip = nocat = noatt = nocatskip = 0;
-
/* Fetch all attribute records */
if (doatt) {
sprintf(buf, "SELECT * FROM %s", Fi->table);
@@ -656,8 +649,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 features..."), Vect_get_num_lines(&In));
@@ -941,6 +936,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