#include <stddef.h>
#include "c_types/point_on_edge_t.h"
Go to the source code of this file.
◆ pgr_get_points()
void pgr_get_points |
( |
char * |
points_sql, |
|
|
Point_on_edge_t ** |
points, |
|
|
size_t * |
total_points |
|
) |
| |
pgr_get_points
For queries of the type:
SELECT pid, edge_id, fraction, [side]
FROM edge_table;
- Parameters
-
[in] | points_sql | |
[out] | points | |
[out] | total_points | |
Definition at line 69 of file points_input.c.
73 const int tuple_limit = 1000;
79 for (i = 0; i < 4; ++i) {
87 info[1].
name =
"edge_id";
88 info[2].
name =
"fraction";
89 info[3].
name =
"side";
103 bool moredata =
true;
104 (*total_points) = total_tuples = 0;
106 int64_t default_pid = 1;
107 char default_side =
'b';
109 while (moredata ==
true) {
110 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
111 if (total_tuples == 0) {
116 size_t ntuples = SPI_processed;
117 total_tuples += ntuples;
120 if ((*points) == NULL)
127 if ((*points) == NULL) {
128 elog(ERROR,
"Out of memory");
131 SPITupleTable *tuptable = SPI_tuptable;
132 TupleDesc tupdesc = SPI_tuptable->tupdesc;
135 PGR_DBG(
"processing %ld points tuples", ntuples);
136 for (t = 0; t < ntuples; t++) {
137 HeapTuple tuple = tuptable->vals[t];
139 &default_pid, default_side,
140 &(*points)[total_tuples - ntuples + t]);
142 SPI_freetuptable(tuptable);
147 SPI_cursor_close(SPIportal);
150 if (total_tuples == 0) {
156 (*total_points) = total_tuples;
157 PGR_DBG(
"Finish reading %ld points, %ld", total_tuples, (*total_points));
References ANY_INTEGER, ANY_NUMERICAL, CHAR1, Column_info_t::colNumber, Column_info_t::eType, fetch_point(), Column_info_t::name, PGR_DBG, pgr_fetch_column_info(), pgr_SPI_cursor_open(), pgr_SPI_prepare(), Column_info_t::strict, and Column_info_t::type.
Referenced by process().