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

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 10 14:18:24 PDT 2013


Author: martinl
Date: 2013-03-10 14:18:24 -0700 (Sun, 10 Mar 2013)
New Revision: 55309

Modified:
   grass/trunk/lib/vector/Vlib/build_pg.c
Log:
vlib(pg): report error when inserting faces fails


Modified: grass/trunk/lib/vector/Vlib/build_pg.c
===================================================================
--- grass/trunk/lib/vector/Vlib/build_pg.c	2013-03-10 21:17:22 UTC (rev 55308)
+++ grass/trunk/lib/vector/Vlib/build_pg.c	2013-03-10 21:18:24 UTC (rev 55309)
@@ -167,7 +167,7 @@
         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 @@
         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 @@
         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 @@
             
             if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
                 Vect__execute_pg(pg_info->conn, "ROLLBACK");
-                return -1;
+                return 0;
             }
         }
     }
@@ -261,7 +264,7 @@
             
             if(Vect__execute_pg(pg_info->conn, stmt) == -1) {
                 Vect__execute_pg(pg_info->conn, "ROLLBACK");
-                return -1;
+                return 0;
             }
             continue;
         }



More information about the grass-commit mailing list