#include <stddef.h>
#include "c_types/coordinate_t.h"
Go to the source code of this file.
◆ pgr_get_coordinates()
void pgr_get_coordinates |
( |
char * |
sql, |
|
|
Coordinate_t ** |
coordinates, |
|
|
size_t * |
total_coordinates |
|
) |
| |
bigint id, float x, float y,
Definition at line 57 of file coordinates_input.c.
61 clock_t start_t = clock();
63 const int tuple_limit = 1000000;
65 size_t total_tuples = 0;
70 for (i = 0; i < 3; ++i) {
92 (*total_coordinates) = total_tuples;
94 int64_t default_id = 1;
96 while (moredata ==
true) {
97 SPI_cursor_fetch(SPIportal,
true, tuple_limit);
98 if (total_tuples == 0)
101 size_t ntuples = SPI_processed;
102 total_tuples += ntuples;
105 if ((*coordinates) == NULL)
110 repalloc((*coordinates),
113 if ((*coordinates) == NULL) {
114 elog(ERROR,
"Out of memory");
117 SPITupleTable *tuptable = SPI_tuptable;
118 TupleDesc tupdesc = SPI_tuptable->tupdesc;
119 PGR_DBG(
"Processing %ld coordinates tupĺes", ntuples);
122 for (t = 0; t < ntuples; t++) {
123 HeapTuple tuple = tuptable->vals[t];
126 &(*coordinates)[total_tuples - ntuples + t]);
128 SPI_freetuptable(tuptable);
134 SPI_cursor_close(SPIportal);
137 if (total_tuples == 0) {
138 (*total_coordinates) = 0;
143 (*total_coordinates) = total_tuples;
144 time_msg(
" reading coordinates:", start_t, clock());
References ANY_INTEGER, ANY_NUMERICAL, Column_info_t::colNumber, Column_info_t::eType, Column_info_t::name, PGR_DBG, pgr_fetch_column_info(), pgr_fetch_row(), pgr_SPI_cursor_open(), pgr_SPI_prepare(), Column_info_t::strict, time_msg(), and Column_info_t::type.
Referenced by process().