Explorar o código

vlib(pg): report error when inserting faces fails

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@55309 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa %!s(int64=12) %!d(string=hai) anos
pai
achega
d8f41e6790
Modificáronse 1 ficheiros con 9 adicións e 6 borrados
  1. 9 6
      lib/vector/Vlib/build_pg.c

+ 9 - 6
lib/vector/Vlib/build_pg.c

@@ -167,7 +167,7 @@ int build_topo(struct Map_info *Map, int build)
         G_debug(2, "SQL: %s", stmt);
         if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
             Vect__execute_pg(pg_info->conn, "ROLLBACK");
-            return -1;
+            return 0;
         }
 
         /* reset left|right edges */
@@ -176,7 +176,7 @@ int build_topo(struct Map_info *Map, int build)
         G_debug(2, "SQL: %s", stmt);
         if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
             Vect__execute_pg(pg_info->conn, "ROLLBACK");
-            return -1;
+            return 0;
         }
 
         /* delete faces */        
@@ -185,13 +185,16 @@ int build_topo(struct Map_info *Map, int build)
         G_debug(2, "SQL: %s", stmt);
         if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
             Vect__execute_pg(pg_info->conn, "ROLLBACK");
-            return -1;
+            return 0;
         }
         
         /* insert face from GRASS topology */
         nareas = Vect_get_num_areas(Map);
         for (area = 1; area <= nareas; area++) {
-            Vect__insert_face_pg(Map, area);
+            if (0 == Vect__insert_face_pg(Map, area)) {
+                Vect__execute_pg(pg_info->conn, "ROLLBACK");
+                return 0;
+            }
             
             if (build < GV_BUILD_CENTROIDS)
                 continue;
@@ -211,7 +214,7 @@ int build_topo(struct Map_info *Map, int build)
             
             if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
                 Vect__execute_pg(pg_info->conn, "ROLLBACK");
-                return -1;
+                return 0;
             }
         }
     }
@@ -261,7 +264,7 @@ int build_topo(struct Map_info *Map, int build)
             
             if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
                 Vect__execute_pg(pg_info->conn, "ROLLBACK");
-                return -1;
+                return 0;
             }
             continue;
         }