#include <stddef.h>
#include "c_types/restriction_t.h"
Go to the source code of this file.
◆ pgr_get_restrictions()
void pgr_get_restrictions |
( |
char * |
restrictions_sql, |
|
|
Restriction_t ** |
restrictions, |
|
|
size_t * |
total_restrictions |
|
) |
| |
Definition at line 63 of file restrictions_input.c.
67 const int tuple_limit = 1000000;
68 clock_t start_t = clock();
70 PGR_DBG(
"pgr_get_restrictions");
71 PGR_DBG(
"%s", restrictions_sql);
76 for (i = 0; i < 3; ++i) {
84 info[1].
name =
"cost";
86 info[2].
name =
"path";
101 bool moredata =
true;
102 (*total_restrictions) = total_tuples = 0;
107 while (moredata ==
true) {
108 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
109 if (total_tuples == 0) {
112 size_t ntuples = SPI_processed;
113 total_tuples += ntuples;
114 PGR_DBG(
"Restrictions to be processed %ld", ntuples);
117 if ((*restrictions) == NULL) {
126 if ((*restrictions) == NULL) {
127 elog(ERROR,
"Out of memory");
131 SPITupleTable *tuptable = SPI_tuptable;
132 TupleDesc tupdesc = SPI_tuptable->tupdesc;
133 PGR_DBG(
"processing %ld", ntuples);
134 for (t = 0; t < ntuples; t++) {
135 HeapTuple tuple = tuptable->vals[t];
137 &(*restrictions)[total_tuples - ntuples + t]);
139 SPI_freetuptable(tuptable);
145 SPI_cursor_close(SPIportal);
147 if (total_tuples == 0) {
148 (*total_restrictions) = 0;
153 (*total_restrictions) = total_tuples;
154 PGR_DBG(
"Finish reading %ld restrictions, %ld",
156 (*total_restrictions));
157 clock_t end_t = clock();
158 time_msg(
" reading Restrictions", start_t, end_t);
References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, Column_info_t::colNumber, Column_info_t::eType, fetch_restriction(), Column_info_t::name, PGR_DBG, pgr_fetch_column_info(), pgr_SPI_cursor_open(), pgr_SPI_prepare(), Column_info_t::strict, time_msg(), and Column_info_t::type.
Referenced by compute_trsp(), and process().