51 point->
pid = *default_pid;
62 point->
side = default_side;
72 size_t *total_points) {
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));