[GRASS-SVN] r51074 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Mar 16 06:59:15 EDT 2012


Author: martinl
Date: 2012-03-16 03:59:15 -0700 (Fri, 16 Mar 2012)
New Revision: 51074

Modified:
   grass/trunk/lib/vector/Vlib/build_pg.c
   grass/trunk/lib/vector/Vlib/write_pg.c
Log:
vlib(pg): close transaction when unable to insert new feature


Modified: grass/trunk/lib/vector/Vlib/build_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_pg.c	2012-03-16 10:58:29 UTC (rev 51073)
+++ grass/trunk/lib/vector/Vlib/build_pg.c	2012-03-16 10:59:15 UTC (rev 51074)
@@ -79,9 +79,10 @@
 	return 0;
     }
     
-    G_message(_("Using external data format '%s' (feature type '%s')"),
-	      Vect_get_finfo_format_info(Map),
-	      Vect_get_finfo_geometry_type(Map));
+    if (build > GV_BUILD_NONE)
+	G_message(_("Using external data format '%s' (feature type '%s')"),
+		  Vect_get_finfo_format_info(Map),
+		  Vect_get_finfo_geometry_type(Map));
     
     return Vect__build_sfa(Map, build);
 #else

Modified: grass/trunk/lib/vector/Vlib/write_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/write_pg.c	2012-03-16 10:58:29 UTC (rev 51073)
+++ grass/trunk/lib/vector/Vlib/write_pg.c	2012-03-16 10:59:15 UTC (rev 51074)
@@ -638,8 +638,11 @@
 	       fid, text_data);
     G_debug(2, "SQL: %s", stmt);
     
-    if (execute(pg_info->conn, stmt) == -1)
+    if (execute(pg_info->conn, stmt) == -1) {
+	/* close transaction */
+	execute(pg_info->conn, "COMMIT");
 	return -1;
+    }
 
     G_free(wkb_data);
     G_free(text_data);



More information about the grass-commit mailing list