 |
vrpRouting
0.3
|
Go to the documentation of this file.
73 clock_t start_t = clock();
76 const int tuple_limit = 1000000;
77 size_t total_tuples = 0;
78 const int column_count = 2;
88 (*total_rows) = total_tuples;
90 while (moredata ==
true) {
91 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
92 if (total_tuples == 0)
95 size_t ntuples = SPI_processed;
96 total_tuples += ntuples;
106 if ((*rows) == NULL) {
107 elog(ERROR,
"Out of memory");
110 SPITupleTable *tuptable = SPI_tuptable;
111 TupleDesc tupdesc = SPI_tuptable->tupdesc;
113 for (
size_t t = 0; t < ntuples; t++) {
114 HeapTuple tuple = tuptable->vals[t];
117 &(*rows)[total_tuples - ntuples + t]);
119 case 1 :
fetch_raw(&tuple, &tupdesc, info,
120 &(*rows)[total_tuples - ntuples + t]);
124 SPI_freetuptable(tuptable);
130 SPI_cursor_close(SPIportal);
133 if (total_tuples == 0) {
138 (*total_rows) = total_tuples;
140 time_msg(
"reading time dependant multipliers", start_t, clock());
152 size_t *total_rows) {
156 for (i = 0; i < 2; ++i) {
162 info[0].
name =
"start_time";
163 info[1].
name =
"multiplier";
178 size_t *total_rows) {
182 for (i = 0; i < 2; ++i) {
188 info[0].
name =
"start_value";
189 info[1].
name =
"multiplier";
SPIPlanPtr pgr_SPI_prepare(char *sql)
Time Dependant Multipliers.
TTimestamp get_TTimestamp(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TTimestamp opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
void pgr_fetch_column_info(Column_info_t info[], int info_size)
Function tells expected type of each column and then check the correspondence type of each column.
Portal pgr_SPI_cursor_open(SPIPlanPtr SPIplan)
TTimestamp start_time
Time of day where the multiplier starts to be valid.
void time_msg(char *msg, clock_t start_t, clock_t end_t)
TTimestamp get_TTimestamp_plain(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TTimestamp opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
double spi_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
gets value of specified column in double type.
Multiplier multiplier
multiplier at hour