* @param faces the faces to insert. Those with a node_id set to -1
* it will be replaced to an automatically assigned identifier
* @param nelems number of elements in the faces array
- * TODO: Should be uint64_t to match SPI_processed
*
* @return number of inserted faces, or -1 (@see lastErrorMessage)
*/
* @param faces an array of LWT_ISO_FACE object with selecting id
* and setting mbr.
* @param numfaces number of faces in the "faces" array
- * TODO: Should be uint64_t to match SPI_processed
*
- * @return number of faces being updated or -1 on error
+ * @return number of faces being updated or UINT64_MAX on error
* (@see lastErroMessage)
*/
- int (*updateFacesById) (
+ uint64_t (*updateFacesById) (
const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces
+ const LWT_ISO_FACE* faces, uint64_t numfaces
);
/*
* @param edges an array of LWT_ISO_EDGE object with selecting id
* and updating fields.
* @param numedges number of edges in the "edges" array
- * TODO: Should be uint64_t to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_EDGE_* macros
*
* identifiers in the input array, gets number of
* nodes in output array if the return is not null,
* otherwise see @return section for semantic.
- * TODO: Should be uint64_t to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
* @param box optional bounding box to further restrict matches, use
exc_node, exc_fields);
}
-static int
+static uint64_t
lwt_be_updateFacesById(LWT_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces
+ const LWT_ISO_FACE* faces, uint64_t numfaces
)
{
CBT2(topo, updateFacesById, faces, numfaces);
const GBOX* oldbox = lwgeom_get_bbox(lwline_as_lwgeom(oldedge->geom));
const GBOX* newbox = lwgeom_get_bbox(lwline_as_lwgeom(geom));
if ( ! gbox_same(oldbox, newbox) )
- {{
- int facestoupdate = 0;
+ {
+ uint64_t facestoupdate = 0;
LWT_ISO_FACE faces[2];
LWGEOM *nface1 = NULL;
LWGEOM *nface2 = NULL;
LWDEBUGF(1, "%d faces to update", facestoupdate);
if ( facestoupdate )
{
- res = lwt_be_updateFacesById(topo, &(faces[0]), facestoupdate);
- if (res != facestoupdate)
+ uint64_t updatedFaces = lwt_be_updateFacesById(topo, &(faces[0]), facestoupdate);
+ if (updatedFaces != facestoupdate)
{
if (nface1)
lwgeom_free(nface1);
if (nface2)
lwgeom_free(nface2);
_lwt_release_edges(oldedge, 1);
- if (res == -1)
+ if (updatedFaces == UINT64_MAX)
lwerror("Backend error: %s", lwt_be_lastErrorMessage(topo->be_iface));
else
lwerror("Unexpected error: %d faces found when expecting 1", i);
}
if ( nface1 ) lwgeom_free(nface1);
if ( nface2 ) lwgeom_free(nface2);
- }} else {{
+ }
+ else
+ {
lwnotice("BBOX of changed edge did not change");
- }}
+ }
LWDEBUG(1, "all done, cleaning up edges");
return SPI_processed;
}
-static int
+static uint64_t
cb_updateFacesById( const LWT_BE_TOPOLOGY* topo,
- const LWT_ISO_FACE* faces, int numfaces )
+ const LWT_ISO_FACE* faces, uint64_t numfaces )
{
MemoryContext oldcontext = CurrentMemoryContext;
- int i;
+ uint64_t i;
int spi_result;
StringInfoData sqldata;
StringInfo sql = &sqldata;
cberror(topo->be_data, "unexpected return (%d) from query execution: %s",
spi_result, sql->data);
pfree(sqldata.data);
- return -1;
+ return UINT64_MAX;
}
pfree(sqldata.data);