Kaynağa Gözat

vlib(pg): close transaction when unable to insert new feature

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51074 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 yıl önce
ebeveyn
işleme
d20b52ac6b
2 değiştirilmiş dosya ile 8 ekleme ve 4 silme
  1. 4 3
      lib/vector/Vlib/build_pg.c
  2. 4 1
      lib/vector/Vlib/write_pg.c

+ 4 - 3
lib/vector/Vlib/build_pg.c

@@ -79,9 +79,10 @@ int Vect_build_pg(struct Map_info *Map, int build)
 	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

+ 4 - 1
lib/vector/Vlib/write_pg.c

@@ -638,8 +638,11 @@ int write_feature(const struct Format_info_pg *pg_info,
 	       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);