Pārlūkot izejas kodu

vlib: OGR - support transaction when writing (v.external.out)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45910 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 14 gadi atpakaļ
vecāks
revīzija
8e49a9346f
2 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  1. 3 0
      lib/vector/Vlib/build_ogr.c
  2. 5 0
      lib/vector/Vlib/open_ogr.c

+ 3 - 0
lib/vector/Vlib/build_ogr.c

@@ -361,6 +361,9 @@ int Vect_build_ogr(struct Map_info *Map, int build)
     Map->fInfo.ogr.offset = NULL;
     Map->fInfo.ogr.offset_num = 0;
     Map->fInfo.ogr.offset_alloc = 0;
+    
+    if (OGR_L_TestCapability(Map->fInfo.ogr.layer, OLCTransactions))
+	OGR_L_CommitTransaction(Map->fInfo.ogr.layer);
 
     /* test layer capabilities */
     if (!OGR_L_TestCapability(Map->fInfo.ogr.layer, OLCRandomRead)) {

+ 5 - 0
lib/vector/Vlib/open_ogr.c

@@ -95,6 +95,8 @@ int V1_open_old_ogr(struct Map_info *Map, int update)
     G_debug(2, "OGR layer %d opened", layer);
 
     Map->fInfo.ogr.layer = Ogr_layer;
+    if (update && OGR_L_TestCapability(Map->fInfo.ogr.layer, OLCTransactions))
+	OGR_L_StartTransaction(Map->fInfo.ogr.layer);
     
     Map->fInfo.ogr.lines = NULL;
     Map->fInfo.ogr.lines_types = NULL;
@@ -339,6 +341,9 @@ int V2_open_new_ogr(struct Map_info *Map, int type)
     }
     Map->fInfo.ogr.layer = Ogr_layer;
 
+    if (OGR_L_TestCapability(Map->fInfo.ogr.layer, OLCTransactions))
+	OGR_L_StartTransaction(Map->fInfo.ogr.layer);
+
     return 0;
 }
 #endif