* @param ids an array of element identifiers
* @param numelems input/output parameter, pass number of node identifiers
* in the input array, gets number of node in output array.
+ * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
*
* @param numelems output parameter, gets number of elements found
* if the return is not null, otherwise see @return
* section for semantic.
+ * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_NODE_* macros
* @param limit max number of nodes to return, 0 for no limit, -1
* @param nodes the nodes 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 nodes array
+ * TODO: Should be uint64 to match SPI_processed
*
* @return 1 on success, 0 on error (@see lastErrorMessage)
*/
* @param edges the edges to insert. Those with a edge_id set to -1
* it will be replaced to an automatically assigned identifier
* @param nelems number of elements in the edges array
+ * TODO: Should be uint64 to match SPI_processed
*
* @return number of inserted edges, or -1 (@see lastErrorMessage)
*/
* @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 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 to match SPI_processed
*
* @return number of faces being updated or -1 on error
* (@see lastErroMessage)
* side (left if positive, right if negative)
* and direction (forward if positive, backward if negative).
* @param numedges output parameter, gets the number of edges visited
+ *
* @param limit max edges to return (to avoid an infinite loop in case
* of a corrupted topology). 0 is for unlimited.
* The function is expected to error out if the limit is hit.
* @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 to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_EDGE_* macros
*
* in the input array, gets number of edges in output array
* if the return is not null, otherwise see @return
* section for semantic.
+ * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_EDGE_* macros
* @param box optional bounding box to further restrict matches, use
* 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 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
* @param nodes an array of LWT_ISO_EDGE objects with selecting id
* and updating fields.
* @param numnodes number of nodes in the "nodes" array
+ * TODO: Should be uint64 to match SPI_processed
* @param upd_fields fields to be updated for the selected edges,
* see LWT_COL_NODE_* macros
*
* @param topo the topology to act upon
* @param ids an array of face identifiers
* @param numelems number of face identifiers in the ids array
+ * TODO: Should be uint64 to match SPI_processed
*
* @return number of faces being deleted or -1 on error
* (@see lastErrorMessage)
* @param topo the topology to act upon
* @param ids an array of node identifiers
* @param numelems number of node identifiers in the ids array
+ * TODO: Should be uint64 to match SPI_processed
*
* @return number of nodes being deleted or -1 on error
* (@see lastErrorMessage)
* @param numelems output parameter, gets number of elements found
* if the return is not null, otherwise see @return
* section for semantic.
+ * TODO: Should be uint64 to match SPI_processed
* @param fields fields to be filled in the returned structure, see
* LWT_COL_FACE_* macros
* @param limit max number of faces to return, 0 for no limit, -1
- * to only check for existance if a matching row.
+ * to only check for existence if a matching row.
*
* @return an array of faces or null in the following cases:
* - limit=-1 ("numelems" is set to 1 if found, 0 otherwise)
return NULL;
}
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ edges = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ edges = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ edges = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ faces = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillFaceFields(&faces[i], row, SPI_tuptable->tupdesc, fields);
{
return NULL;
}
- if ( limit && SPI_processed == limit )
+ if ( limit && *numelems == limit )
{
cberror(topo->be_data, "Max traversing limit hit: %d", limit-1);
*numelems = -1;
return NULL;
}
- edges = palloc( sizeof(LWT_ELEMID) * SPI_processed );
+ edges = palloc( sizeof(LWT_ELEMID) * *numelems );
rowdesc = SPI_tuptable->tupdesc;
- for ( i=0; i<SPI_processed; ++i )
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
bool isnull;
return NULL;
}
- nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ nodes = palloc( sizeof(LWT_ISO_NODE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- nodes = palloc( sizeof(LWT_ISO_NODE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ nodes = palloc( sizeof(LWT_ISO_NODE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ edges = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields);
}
else
{
- nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ *numelems = SPI_processed;
+ nodes = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields);
}
- *numelems = SPI_processed;
SPI_freetuptable(SPI_tuptable);
if ( SPI_processed ) topo->be_data->data_changed = true;
- if ( SPI_processed != numelems )
+ // TODO: Remove cast when numelems uses uint64 instead of int
+ if ( SPI_processed != (uint64) numelems )
{
cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
(uint64)SPI_processed, numelems);
/* Set node_id (could skip this if none had it set to -1) */
/* TODO: check for -1 values in the first loop */
- for ( i=0; i<SPI_processed; ++i )
+ for ( i=0; i<numelems; ++i )
{
if ( nodes[i].node_id != -1 ) continue;
fillNodeFields(&nodes[i], SPI_tuptable->vals[i],
pfree(sqldata.data);
if ( SPI_processed ) topo->be_data->data_changed = true;
POSTGIS_DEBUGF(1, "cb_insertEdges query processed %d rows", SPI_processed);
- if ( SPI_processed != numelems )
+ if ( SPI_processed != (uint64) numelems )
{
cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
(uint64)SPI_processed, numelems);
if ( needsEdgeIdReturn )
{
/* Set node_id for items that need it */
- for ( i=0; i<SPI_processed; ++i )
+ for ( i=0; i<(int)SPI_processed; ++i )
{
if ( edges[i].edge_id != -1 ) continue;
fillEdgeFields(&edges[i], SPI_tuptable->vals[i],
pfree(sqldata.data);
if ( SPI_processed ) topo->be_data->data_changed = true;
POSTGIS_DEBUGF(1, "cb_insertFaces query processed %d rows", SPI_processed);
- if ( SPI_processed != numelems )
+ if ( SPI_processed != (uint64) numelems )
{
cberror(topo->be_data, "processed " UINT64_FORMAT " rows, expected %d",
(uint64)SPI_processed, numelems);
if ( needsFaceIdReturn )
{
/* Set node_id for items that need it */
- for ( i=0; i<SPI_processed; ++i )
+ for ( i=0; i<numelems; ++i )
{
if ( faces[i].face_id != -1 ) continue;
fillFaceFields(&faces[i], SPI_tuptable->vals[i],
return NULL;
}
- nodes = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ nodes = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillNodeFields(&nodes[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- edges = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ edges = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillEdgeFields(&edges[i], row, SPI_tuptable->tupdesc, fields);
return NULL;
}
- faces = palloc( sizeof(LWT_ISO_EDGE) * SPI_processed );
- for ( i=0; i<SPI_processed; ++i )
+ faces = palloc( sizeof(LWT_ISO_EDGE) * *numelems );
+ for ( i=0; i<*numelems; ++i )
{
HeapTuple row = SPI_tuptable->vals[i];
fillFaceFields(&faces[i], row, SPI_tuptable->tupdesc, fields);