vrpRouting  0.3
get_check_data.c File Reference
#include <stdbool.h>
#include <time.h>
#include "c_common/postgres_connection.h"
#include <utils/date.h>
#include <utils/datetime.h>
#include "c_common/get_check_data.h"
#include "c_common/arrays_input.h"
#include "catalog/pg_type.h"
#include "c_common/debug_macro.h"
#include "c_types/typedefs.h"
Include dependency graph for get_check_data.c:

Go to the source code of this file.

Functions

static void check_any_integer_type (Column_info_t info)
 
static void check_any_integerarray_type (Column_info_t info)
 
static void check_any_numerical_type (Column_info_t info)
 
static void check_char_type (Column_info_t info)
 
static void check_integer_type (Column_info_t info)
 
static void check_integerarray_type (Column_info_t info)
 
static void check_interval_type (Column_info_t info)
 
static void check_jsonb_type (Column_info_t info)
 
static void check_text_type (Column_info_t info)
 
static void check_timestamp_type (Column_info_t info)
 
bool column_found (int colNumber)
 Check whether the colNumber represent any specific column or NULL (SPI_ERROR_NOATTRIBUTE). More...
 
static bool fetch_column_info (Column_info_t *info)
 
Amount get_Amount (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Amount opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TravelCost get_Cost (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TravelCost opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
Distance get_Distance (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Distance opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
Duration get_Duration (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Duration opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
Id get_Id (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Id opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
Idx get_Idx (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Idx opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
char get_Kind (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, char opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
MatrixIndex get_MatrixIndex (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, MatrixIndex opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
PAmount get_PositiveAmount (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, PAmount opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TInterval get_PositiveTInterval (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TInterval get_PositiveTInterval_plain (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TTimestamp get_PositiveTTimestamp (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] opt_value default value when the column does not exist More...
 
TTimestamp get_PositiveTTimestamp_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] opt_value default value when the column does not exist More...
 
Priority get_Priority (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Priority opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
StepType get_StepType (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, StepType opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TInterval get_TInterval (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
TInterval get_TInterval_plain (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
 @params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist More...
 
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] opt_value default value when the column does not exist More...
 
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] opt_value default value when the column does not exist More...
 
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. More...
 
static int64_t spi_getBigInt (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 
int64_t * spi_getBigIntArr (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
 Function returns the values of specified columns in array. More...
 
int64_t * spi_getBigIntArr_allowEmpty (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
 Function returns the values of specified columns in array. More...
 
char spi_getChar (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, char default_value)
 get value of specified column in char type. More...
 
Coordinate spi_getCoordinate (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Coordinate opt_value)
 get a coordinate value More...
 
double spi_getFloat8 (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 gets value of specified column in double type. More...
 
static int32_t spi_getInt (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 
static TInterval spi_getInterval (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 
int32_t spi_getMaxTasks (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 gets the vehicle max tasks value More...
 
int64_t * spi_getPositiveBigIntArr_allowEmpty (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
 Function returns the values of specified columns in array. More...
 
uint32_t * spi_getPositiveIntArr_allowEmpty (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
 Function returns the values of specified columns in array. More...
 
char * spi_getText (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 under development More...
 
static TTimestamp spi_getTimeStamp (HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
 
TTimestamp timestamp_without_timezone (TTimestamp timestamp)
 Steps: 1) Similar to: https://doxygen.postgresql.org/backend_2utils_2adt_2timestamp_8c.html#a52973f03ed8296b632d4028121f7e077 2) Using time.h to convert. More...
 

Function Documentation

◆ check_any_integer_type()

static void check_any_integer_type ( Column_info_t  info)
static

Definition at line 92 of file get_check_data.c.

92  {
93  if (!(info.type == INT2OID
94  || info.type == INT4OID
95  || info.type == INT8OID)) {
96  ereport(ERROR,
97  (errmsg_internal("Unexpected type in column '%s'.", info.name),
98  errhint("Expected ANY-INTEGER")));
99  }
100 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_any_integerarray_type()

static void check_any_integerarray_type ( Column_info_t  info)
static

Definition at line 115 of file get_check_data.c.

115  {
116  if (!(info.type == INT2ARRAYOID
117  || info.type == INT4ARRAYOID
118  || info.type == 1016)) {
119  elog(ERROR,
120  "Unexpected Column '%s' type. Expected ANY-INTEGER-ARRAY",
121  info.name);
122  }
123 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_any_numerical_type()

static void check_any_numerical_type ( Column_info_t  info)
static

Definition at line 127 of file get_check_data.c.

127  {
128  if (!(info.type == INT2OID
129  || info.type == INT4OID
130  || info.type == INT8OID
131  || info.type == FLOAT4OID
132  || info.type == FLOAT8OID
133  || info.type == NUMERICOID)) {
134  ereport(ERROR,
135  (errmsg_internal("Unexpected type in column '%s'.", info.name),
136  errhint("Found: %lu\nExpected ANY-NUMERICAL", info.type)));
137  }
138 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_char_type()

static void check_char_type ( Column_info_t  info)
static

Definition at line 58 of file get_check_data.c.

58  {
59  if (!(info.type == BPCHAROID)) {
60  elog(ERROR, "Unexpected Column '%s' type. Expected CHAR", info.name);
61  }
62 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_integer_type()

static void check_integer_type ( Column_info_t  info)
static

Definition at line 82 of file get_check_data.c.

82  {
83  if (!(info.type == INT2OID || info.type == INT4OID)) {
84  ereport(ERROR,
85  (errmsg_internal("Unexpected type in column '%s'.", info.name),
86  errhint("Expected SMALLINT or INTEGER")));
87  }
88 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_integerarray_type()

static void check_integerarray_type ( Column_info_t  info)
static

Definition at line 104 of file get_check_data.c.

104  {
105  if (!(info.type == INT2ARRAYOID
106  || info.type == INT4ARRAYOID)) {
107  elog(ERROR,
108  "Unexpected Column '%s' type. Expected SMALLINT-ARRAY or INTEGER-ARRAY",
109  info.name);
110  }
111 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_interval_type()

static void check_interval_type ( Column_info_t  info)
static

Definition at line 44 of file get_check_data.c.

44  {
45  if (!(info.type == 1186)) {
46  elog(ERROR,
47  "Unexpected Column '%s' type. Expected INTERVAL",
48  info.name);
49  }
50 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_jsonb_type()

static void check_jsonb_type ( Column_info_t  info)
static

Definition at line 74 of file get_check_data.c.

74  {
75  if (!(info.type == JSONBOID)) {
76  elog(ERROR, "Unexpected Column '%s' type. Expected JSONB %ld", info.name, info.type);
77  }
78 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_text_type()

static void check_text_type ( Column_info_t  info)
static

Definition at line 66 of file get_check_data.c.

66  {
67  if (!(info.type == TEXTOID)) {
68  elog(ERROR, "Unexpected Column '%s' type. Expected TEXT", info.name);
69  }
70 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ check_timestamp_type()

static void check_timestamp_type ( Column_info_t  info)
static

Definition at line 142 of file get_check_data.c.

142  {
143  if (!(info.type == 1114)) {
144  elog(ERROR,
145  "Unexpected Column '%s' type. Expected TIMESTAMP",
146  info.name);
147  }
148 }

References Column_info_t::name, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ column_found()

bool column_found ( int  colNumber)

◆ fetch_column_info()

static bool fetch_column_info ( Column_info_t info)
static

Definition at line 152 of file get_check_data.c.

153  {
154  /*
155  * [SPI_fnumber](https://www.postgresql.org/docs/12/spi-spi-fnumber.html)
156  */
157  info->colNumber = SPI_fnumber(SPI_tuptable->tupdesc, info->name);
158  if (info->strict && !column_found(info->colNumber)) {
159  elog(ERROR, "Column '%s' not Found", info->name);
160  }
161 
162  if (column_found(info->colNumber)) {
163  /*
164  * [SPI_gettypeid](https://www.postgresql.org/docs/12/spi-spi-gettypeid.html)
165  */
166  (info->type) = SPI_gettypeid(SPI_tuptable->tupdesc, (info->colNumber));
167  PGR_DBG("%s %ld", info->name, info->type);
168  if (SPI_result == SPI_ERROR_NOATTRIBUTE) {
169  elog(ERROR, "Type of column '%s' not Found", info->name);
170  }
171  return true;
172  }
173  return false;
174 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, PGR_DBG, Column_info_t::strict, and Column_info_t::type.

Referenced by pgr_fetch_column_info().

◆ get_Amount()

Amount get_Amount ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Amount  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Amount from data

Returns
The value found
opt_value when the column does not exist

Definition at line 619 of file get_check_data.c.

619  {
620  return (Amount) column_found(info.colNumber)?
621  spi_getBigInt(tuple, tupdesc, info)
622  : opt_value;
623 }

References Column_info_t::colNumber, column_found(), and spi_getBigInt().

Referenced by get_PositiveAmount().

◆ get_Cost()

TravelCost get_Cost ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
TravelCost  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get TravelCost from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for non-negative values only

Definition at line 704 of file get_check_data.c.

704  {
705  if (column_found(info.colNumber)) {
706  int32_t value = spi_getInt(tuple, tupdesc, info);
707  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
708  return (TravelCost)value;
709  }
710  return opt_value;
711 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, and spi_getInt().

Referenced by fetch_matrix().

◆ get_Distance()

Distance get_Distance ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Distance  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Distance from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for non-negative values only

Definition at line 771 of file get_check_data.c.

771  {
772  if (column_found(info.colNumber)) {
773  int32_t value = spi_getInt(tuple, tupdesc, info);
774  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
775  return (Distance) value;
776  }
777  return opt_value;
778 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, and spi_getInt().

◆ get_Duration()

Duration get_Duration ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Duration  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Duration from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for non-negative values only

Definition at line 681 of file get_check_data.c.

681  {
682  if (column_found(info.colNumber)) {
683  int32_t value = spi_getInt(tuple, tupdesc, info);
684  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
685  return (Duration) value;
686  }
687  return opt_value;
688 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, and spi_getInt().

Referenced by fetch_breaks(), fetch_jobs(), fetch_matrix(), fetch_shipments(), fetch_time_windows(), and fetch_vehicles().

◆ get_Id()

Id get_Id ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Id  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Id from data

Returns
The value found
opt_value when the column does not exist

Definition at line 562 of file get_check_data.c.

562  {
563  return column_found(info.colNumber)?
564  (Id)spi_getBigInt(tuple, tupdesc, info)
565  : opt_value;
566 }

References Column_info_t::colNumber, column_found(), and spi_getBigInt().

Referenced by fetch_euclidean(), fetch_plain(), fetch_raw(), fetch_timestamps(), and get_Idx().

◆ get_Idx()

Idx get_Idx ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Idx  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Idx from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is not positive

Precondition
for positive values only

Definition at line 581 of file get_check_data.c.

581  {
582  Id value = get_Id(tuple, tupdesc, info, 0);
583  if (value <= 0) elog(ERROR, "Unexpected Negative value or Zero in column %s", info.name);
584  return column_found(info.colNumber)? (Idx) value : opt_value;
585 }

References Column_info_t::colNumber, column_found(), get_Id(), and Column_info_t::name.

Referenced by fetch_breaks(), fetch_jobs(), fetch_shipments(), fetch_time_windows(), and fetch_vehicles().

◆ get_Kind()

char get_Kind ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
char  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Kind from data

Returns
The value found
opt_value when the column does not exist

Definition at line 725 of file get_check_data.c.

725  {
726  if (column_found(info.colNumber)) {
727  char value = spi_getChar(tuple, tupdesc, info, opt_value);
728  return value;
729  }
730  return opt_value;
731 }

References Column_info_t::colNumber, column_found(), and spi_getChar().

Referenced by fetch_time_windows().

◆ get_MatrixIndex()

MatrixIndex get_MatrixIndex ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
MatrixIndex  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get MatrixIndex from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is not positive

Precondition
for positive values only

Definition at line 658 of file get_check_data.c.

658  {
659  if (column_found(info.colNumber)) {
660  int64_t value = spi_getBigInt(tuple, tupdesc, info);
661  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
662  return (MatrixIndex) value;
663  }
664  return opt_value;
665 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, and spi_getBigInt().

Referenced by fetch_jobs(), fetch_matrix(), fetch_shipments(), and fetch_vehicles().

◆ get_PositiveAmount()

PAmount get_PositiveAmount ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
PAmount  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get positive Amount from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for non-negative values only

Definition at line 638 of file get_check_data.c.

638  {
639  Amount value = get_Amount(tuple, tupdesc, info, 0);
640  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
641  return column_found(info.colNumber)? (PAmount) value : opt_value;
642 }

References Column_info_t::colNumber, column_found(), get_Amount(), and Column_info_t::name.

Referenced by fetch_euclidean(), fetch_raw(), and fetch_timestamps().

◆ get_PositiveTInterval()

TInterval get_PositiveTInterval ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
TInterval  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

gets an interval value from postgres type INTERVAL > 0

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for positive values only

Definition at line 511 of file get_check_data.c.

511  {
512  TInterval value = get_TInterval(tuple, tupdesc, info, opt_value);
513  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
514  return (TInterval) value;
515 }

References get_TInterval(), and Column_info_t::name.

Referenced by fetch_breaks(), fetch_jobs(), fetch_matrix(), fetch_shipments(), and fetch_timestamps().

◆ get_PositiveTInterval_plain()

TInterval get_PositiveTInterval_plain ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
TInterval  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

gets an interval value from ANY-INTEGER > 0

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for positive values only

Definition at line 546 of file get_check_data.c.

546  {
547  TInterval value = get_TInterval_plain(tuple, tupdesc, info, opt_value);
548  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
549  return (TInterval) value;
550 }

References get_TInterval_plain(), and Column_info_t::name.

Referenced by fetch_euclidean(), fetch_plain(), and fetch_raw().

◆ get_PositiveTTimestamp()

TTimestamp get_PositiveTTimestamp ( 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] opt_value default value when the column does not exist

gets a timestamp value from postgres type TIMESTAMP >= 1970-01-01 00:00:00

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for positive values only

Definition at line 476 of file get_check_data.c.

476  {
477  TTimestamp value = get_TTimestamp(tuple, tupdesc, info, opt_value);
478  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
479  return value;
480 }

References get_TTimestamp(), and Column_info_t::name.

Referenced by fetch_time_windows(), and fetch_vehicles().

◆ get_PositiveTTimestamp_plain()

TTimestamp get_PositiveTTimestamp_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] opt_value default value when the column does not exist

gets a timestamp value from ANY-INTEGER > 0

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for positive values only

Definition at line 441 of file get_check_data.c.

441  {
442  TTimestamp value = get_TTimestamp_plain(tuple, tupdesc, info, opt_value);
443  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
444  return value;
445 }

References get_TTimestamp_plain(), and Column_info_t::name.

◆ get_Priority()

Priority get_Priority ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Priority  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get Priority from data

Returns
The value found
opt_value when the column does not exist

exceptions when the value is negative

Precondition
for non-negative values only

Definition at line 747 of file get_check_data.c.

747  {
748  if (column_found(info.colNumber)) {
749  int32_t value = spi_getInt(tuple, tupdesc, info);
750  if (value < 0) elog(ERROR, "Unexpected Negative value in column %s", info.name);
751  if (value > 100) elog(ERROR, "Priority exceeds the max priority 100");
752  return (Priority) value;
753  }
754  return opt_value;
755 }

References Column_info_t::colNumber, column_found(), Column_info_t::name, and spi_getInt().

Referenced by fetch_jobs(), and fetch_shipments().

◆ get_StepType()

StepType get_StepType ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
StepType  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

get StepType from data

Returns
The value found
opt_value when the column does not exist

Definition at line 596 of file get_check_data.c.

597  {
598  StepType step_type = column_found(info.colNumber)
599  ? spi_getInt(tuple, tupdesc, info)
600  : opt_value;
601  StepType min_value = 1;
602  StepType max_value = 6;
603  if (step_type < min_value || step_type > max_value) {
604  elog(ERROR, "Step value should lie between %d and %d", min_value, max_value);
605  }
606  return step_type;
607 }

References Column_info_t::colNumber, column_found(), and spi_getInt().

◆ get_TInterval()

TInterval get_TInterval ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
TInterval  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

gets an interval value from postgres type INTERVAL

Returns
The value found
opt_value when the column does not exist

Definition at line 492 of file get_check_data.c.

492  {
493  return column_found(info.colNumber)?
494  (TInterval)spi_getInterval(tuple, tupdesc, info)
495  : opt_value;
496 }

References Column_info_t::colNumber, column_found(), and spi_getInterval().

Referenced by fetch_timestamps(), and get_PositiveTInterval().

◆ get_TInterval_plain()

TInterval get_TInterval_plain ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
TInterval  opt_value 
)

@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] opt_value default value when the column does not exist

gets an interval value from ANY-INTEGER

Returns
The value found
opt_value when the column does not exist

Definition at line 527 of file get_check_data.c.

527  {
528  return column_found(info.colNumber)?
529  (TInterval)spi_getBigInt(tuple, tupdesc, info)
530  : opt_value;
531 }

References Column_info_t::colNumber, column_found(), and spi_getBigInt().

Referenced by fetch_euclidean(), fetch_raw(), and get_PositiveTInterval_plain().

◆ get_TTimestamp()

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] opt_value default value when the column does not exist

gets a timestamp value from postgres type TIMESTAMP

Returns
The value found
opt_value when the column does not exist

Definition at line 457 of file get_check_data.c.

457  {
458  return column_found(info.colNumber)?
459  spi_getTimeStamp(tuple, tupdesc, info)
460  : opt_value;
461 }

References Column_info_t::colNumber, column_found(), and spi_getTimeStamp().

Referenced by fetch_timestamps(), and get_PositiveTTimestamp().

◆ get_TTimestamp_plain()

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] opt_value default value when the column does not exist

gets a timestamp value from ANY-INTEGER

Returns
The value found
opt_value when the column does not exist

Definition at line 422 of file get_check_data.c.

422  {
423  return column_found(info.colNumber)?
424  (TTimestamp)spi_getBigInt(tuple, tupdesc, info)
425  : opt_value;
426 }

References Column_info_t::colNumber, column_found(), and spi_getBigInt().

Referenced by fetch_euclidean(), fetch_raw(), and get_PositiveTTimestamp_plain().

◆ pgr_fetch_column_info()

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.


Definition at line 905 of file get_check_data.c.

907  {
908  for (int i = 0; i < info_size; ++i) {
909  if (fetch_column_info(&info[i])) {
910  switch (info[i].eType) {
911  case INTEGER:
912  check_integer_type(info[i]);
913  break;
914  case ANY_INTEGER:
915  check_any_integer_type(info[i]);
916  break;
917  case ANY_NUMERICAL:
918  check_any_numerical_type(info[i]);
919  break;
920  case TEXT:
921  check_text_type(info[i]);
922  break;
923  case JSONB:
924  check_jsonb_type(info[i]);
925  break;
926  case CHAR1:
927  check_char_type(info[i]);
928  break;
929  case INTEGER_ARRAY:
930  check_integerarray_type(info[i]);
931  break;
932  case ANY_INTEGER_ARRAY:
934  break;
935  case TIMESTAMP:
936  check_timestamp_type(info[i]);
937  break;
938  case INTERVAL:
939  check_interval_type(info[i]);
940  break;
941  default:
942  elog(ERROR, "Unknown type of column %s", info[i].name);
943  }
944  }
945  }
946 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, CHAR1, check_any_integer_type(), check_any_integerarray_type(), check_any_numerical_type(), check_char_type(), check_integer_type(), check_integerarray_type(), check_interval_type(), check_jsonb_type(), check_text_type(), check_timestamp_type(), fetch_column_info(), INTEGER, INTEGER_ARRAY, INTERVAL, JSONB, TEXT, and TIMESTAMP.

Referenced by db_get_breaks(), db_get_jobs(), db_get_matrix(), db_get_shipments(), db_get_time_windows(), db_get_vehicles(), get_matrixRows_general(), get_timeMultipliersGeneral(), and pgr_get_pd_orders_general().

◆ spi_getBigInt()

static int64_t spi_getBigInt ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)
static

Definition at line 203 of file get_check_data.c.

203  {
204  Datum binval;
205  bool isnull;
206  int64_t value = 0;
207  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isnull);
208 
209  if (isnull) elog(ERROR, "Unexpected Null value in column %s", info.name);
210 
211  switch (info.type) {
212  case INT2OID:
213  value = (int64_t) DatumGetInt16(binval);
214  break;
215  case INT4OID:
216  value = (int64_t) DatumGetInt32(binval);
217  break;
218  case INT8OID:
219  value = DatumGetInt64(binval);
220  break;
221  default:
222  ereport(ERROR,
223  (errmsg_internal("Unexpected type in column '%s'.", info.name),
224  errhint("Found: %lu\nExpected ANY-INTEGER", info.type)));
225  }
226  return value;
227 }

References Column_info_t::colNumber, Column_info_t::name, and Column_info_t::type.

Referenced by get_Amount(), get_Id(), get_MatrixIndex(), get_TInterval_plain(), and get_TTimestamp_plain().

◆ spi_getBigIntArr()

int64_t* spi_getBigIntArr ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
size_t *  the_size 
)

Function returns the values of specified columns in array.


Definition at line 336 of file get_check_data.c.

340  {
341  bool is_null = false;
342 
343  Datum raw_array = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &is_null);
344  /*
345  * [DatumGetArrayTypeP](https://doxygen.postgresql.org/array_8h.html#aa1b8e77c103863862e06a7b7c07ec532)
346  * [pgr_get_bigIntArray](http://docs.pgrouting.org/doxy/2.2/arrays__input_8c_source.html)
347  */
348  ArrayType *pg_array = DatumGetArrayTypeP(raw_array);
349 
350  return pgr_get_bigIntArray((size_t*)the_size, pg_array);
351 }

References Column_info_t::colNumber, and pgr_get_bigIntArray().

◆ spi_getBigIntArr_allowEmpty()

int64_t* spi_getBigIntArr_allowEmpty ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
size_t *  the_size 
)

Function returns the values of specified columns in array.


Definition at line 354 of file get_check_data.c.

358  {
359  bool is_null = false;
360 
361  Datum raw_array = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &is_null);
362  /*
363  * [DatumGetArrayTypeP](https://doxygen.postgresql.org/array_8h.html#aa1b8e77c103863862e06a7b7c07ec532)
364  * [pgr_get_bigIntArray](http://docs.pgrouting.org/doxy/2.2/arrays__input_8c_source.html)
365  */
366  if (!raw_array) {
367  *the_size = 0;
368  return NULL;
369  }
370 
371  ArrayType *pg_array = DatumGetArrayTypeP(raw_array);
372 
373  return pgr_get_bigIntArray_allowEmpty(the_size, pg_array);
374 }

References Column_info_t::colNumber, and pgr_get_bigIntArray_allowEmpty().

Referenced by fetch_euclidean(), fetch_raw(), fetch_timestamps(), and spi_getPositiveBigIntArr_allowEmpty().

◆ spi_getChar()

char spi_getChar ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
char  default_value 
)

get value of specified column in char type.

Definition at line 298 of file get_check_data.c.

299  {
300  Datum binval;
301  bool isNull;
302  char value = default_value;
303 
304  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isNull);
305  if (!(info.type == BPCHAROID)) {
306  elog(ERROR, "Unexpected Column type of %s. Expected CHAR", info.name);
307  }
308  if (!isNull) {
309  value = ((char*)binval)[1];
310  } else {
311  if (info.strict) {
312  elog(ERROR, "Unexpected Null value in column %s", info.name);
313  }
314  value = default_value;
315  }
316  return value;
317 }

References Column_info_t::colNumber, Column_info_t::name, Column_info_t::strict, and Column_info_t::type.

Referenced by get_Kind().

◆ spi_getCoordinate()

Coordinate spi_getCoordinate ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
Coordinate  opt_value 
)

get a coordinate value

Definition at line 819 of file get_check_data.c.

819  {
820  return column_found(info.colNumber)?
821  (Coordinate) spi_getFloat8(tuple, tupdesc, info)
822  : opt_value;
823 }

References Column_info_t::colNumber, column_found(), and spi_getFloat8().

Referenced by fetch_euclidean().

◆ spi_getFloat8()

double spi_getFloat8 ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)

gets value of specified column in double type.

Definition at line 782 of file get_check_data.c.

782  {
783  Datum binval;
784  bool isnull = false;
785  double value = 0.0;
786  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isnull);
787  if (isnull)
788  elog(ERROR, "Unexpected Null value in column %s", info.name);
789 
790  switch (info.type) {
791  case INT2OID:
792  value = (double) DatumGetInt16(binval);
793  break;
794  case INT4OID:
795  value = (double) DatumGetInt32(binval);
796  break;
797  case INT8OID:
798  value = (double) DatumGetInt64(binval);
799  break;
800  case FLOAT4OID:
801  value = (double) DatumGetFloat4(binval);
802  break;
803  case FLOAT8OID:
804  value = DatumGetFloat8(binval);
805  break;
806  case NUMERICOID:
807  /* Note: out-of-range values will be clamped to +-HUGE_VAL */
808  value = (double) DatumGetFloat8(DirectFunctionCall1(numeric_float8_no_overflow, binval));
809  break;
810  default:
811  ereport(ERROR,
812  (errmsg_internal("Unexpected type in column '%s'.", info.name),
813  errhint("Found: %lu\nExpected ANY-NUMERICAL", info.type)));
814  }
815  return value;
816 }

References Column_info_t::colNumber, Column_info_t::name, and Column_info_t::type.

Referenced by fetch_euclidean(), fetch_raw(), fetch_timestamps(), fetch_vehicles(), and spi_getCoordinate().

◆ spi_getInt()

static int32_t spi_getInt ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)
static

Definition at line 178 of file get_check_data.c.

178  {
179  Datum binval;
180  bool isnull;
181  int32_t value = 0;
182  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isnull);
183 
184  if (isnull) elog(ERROR, "Unexpected Null value in column %s", info.name);
185 
186  switch (info.type) {
187  case INT2OID:
188  value = (int32_t) DatumGetInt16(binval);
189  break;
190  case INT4OID:
191  value = (int32_t) DatumGetInt32(binval);
192  break;
193  default:
194  ereport(ERROR,
195  (errmsg_internal("Unexpected type in column '%s'.", info.name),
196  errhint("Found: %lu\nExpected INTEGER", info.type)));
197  }
198  return value;
199 }

References Column_info_t::colNumber, Column_info_t::name, and Column_info_t::type.

Referenced by get_Cost(), get_Distance(), get_Duration(), get_Priority(), get_StepType(), and spi_getMaxTasks().

◆ spi_getInterval()

static TInterval spi_getInterval ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)
static

Definition at line 253 of file get_check_data.c.

253  {
254  Datum binval;
255  bool isnull;
256  Interval* interval;
257 
258  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isnull);
259 
260  if (isnull) elog(ERROR, "Unexpected Null value in column %s", info.name);
261 
262  switch (info.type) {
263  case INTERVALOID:
264  interval = DatumGetIntervalP(binval);
265  break;
266  default:
267  elog(ERROR,
268  "[spi_getInterval] Unexpected type in column %s. found %ld expected %d",
269  info.name, info.type, INTERVALOID);
270  }
271  PGR_DBG("time %ld secs %ld", interval->time,
272  interval->time / 1000000
273  + interval->day * SECS_PER_DAY
274  + (int64_t)(interval->month * ((DAYS_PER_YEAR / (double) MONTHS_PER_YEAR) * SECS_PER_DAY)));
275 
276  return interval->time / 1000000
277  + interval->day * SECS_PER_DAY
278  + (int64_t)(interval->month * ((DAYS_PER_YEAR / (double) MONTHS_PER_YEAR) * SECS_PER_DAY));
279 }

References Column_info_t::colNumber, Column_info_t::name, PGR_DBG, and Column_info_t::type.

Referenced by get_TInterval().

◆ spi_getMaxTasks()

int32_t spi_getMaxTasks ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)

gets the vehicle max tasks value

Definition at line 320 of file get_check_data.c.

323  {
324  int32_t value = spi_getInt(tuple, tupdesc, info);
325  if (value < 0) {
326  ereport(
327  ERROR,
328  (errmsg("Invalid max_tasks value %d", value),
329  errhint(
330  "Maximum number of tasks must be greater than or equal to 0")));
331  }
332  return value;
333 }

References spi_getInt().

Referenced by fetch_vehicles().

◆ spi_getPositiveBigIntArr_allowEmpty()

int64_t* spi_getPositiveBigIntArr_allowEmpty ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
size_t *  the_size 
)

Function returns the values of specified columns in array.


Definition at line 377 of file get_check_data.c.

381  {
382  int64_t *array = spi_getBigIntArr_allowEmpty(tuple, tupdesc, info, the_size);
383  for (size_t i = 0; i < *the_size; i++) {
384  if (array[i] < 0) {
385  elog(ERROR, "Unexpected Negative value %ld in array", array[i]);
386  }
387  }
388  return array;
389 }

References spi_getBigIntArr_allowEmpty().

Referenced by fetch_jobs(), fetch_shipments(), and fetch_vehicles().

◆ spi_getPositiveIntArr_allowEmpty()

uint32_t* spi_getPositiveIntArr_allowEmpty ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info,
size_t *  the_size 
)

Function returns the values of specified columns in array.

Definition at line 393 of file get_check_data.c.

397  {
398  bool is_null = false;
399 
400  Datum raw_array = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &is_null);
401  if (!raw_array) {
402  *the_size = 0;
403  return NULL;
404  }
405 
406  ArrayType *pg_array = DatumGetArrayTypeP(raw_array);
407 
408  return pgr_get_positiveIntArray_allowEmpty(the_size, pg_array);
409 }

References Column_info_t::colNumber, and pgr_get_positiveIntArray_allowEmpty().

Referenced by fetch_jobs(), fetch_shipments(), and fetch_vehicles().

◆ spi_getText()

char* spi_getText ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)

under development

gets string representation of the value of specified column.

Definition at line 832 of file get_check_data.c.

832  {
833  char *val = DatumGetCString(SPI_getvalue(*tuple, *tupdesc, info.colNumber));
834  return val;
835 }

References Column_info_t::colNumber.

Referenced by fetch_breaks(), fetch_jobs(), fetch_shipments(), and fetch_vehicles().

◆ spi_getTimeStamp()

static TTimestamp spi_getTimeStamp ( HeapTuple *  tuple,
TupleDesc *  tupdesc,
Column_info_t  info 
)
static

Definition at line 231 of file get_check_data.c.

231  {
232  Datum binval;
233  bool isnull;
234  TTimestamp value = 0;
235  binval = SPI_getbinval(*tuple, *tupdesc, info.colNumber, &isnull);
236 
237  if (isnull) elog(ERROR, "Unexpected Null value in column %s", info.name);
238 
239  switch (info.type) {
240  case 1114:
241  value = timestamp_without_timezone((TTimestamp) Int64GetDatum(binval));
242  break;
243  default:
244  elog(ERROR,
245  "[SPI_getTimeStamp] Unexpected type in column %s. found %ld expected 1114",
246  info.name, info.type);
247  }
248  return value;
249 }

References Column_info_t::colNumber, Column_info_t::name, timestamp_without_timezone(), and Column_info_t::type.

Referenced by get_TTimestamp().

◆ timestamp_without_timezone()

TTimestamp timestamp_without_timezone ( TTimestamp  timestamp)

Steps: 1) Similar to: https://doxygen.postgresql.org/backend_2utils_2adt_2timestamp_8c.html#a52973f03ed8296b632d4028121f7e077 2) Using time.h to convert.

Converts timestamp to timestamp without timezone.

from time.h struct tm timezone

Definition at line 847 of file get_check_data.c.

847  {
848  /*
849  * step 1
850  */
851  Timestamp date;
852  Timestamp time = timestamp;
853  TMODULO(time, date, USECS_PER_DAY);
854  if (time < INT64CONST(0)) {
855  time += USECS_PER_DAY;
856  date -= 1;
857  }
858  date += POSTGRES_EPOCH_JDATE;
859  /* Julian day routine does not work for negative Julian days */
860  if (date < 0 || date > (Timestamp) INT_MAX) {
861  ereport(ERROR,
862  (errcode(ERRCODE_INTERNAL_ERROR),
863  errmsg("Julian day routine does not work for negative Julian days")));
864  }
865 
866  /*
867  * using structure from time.h to store values
868  */
869  struct tm info;
870  fsec_t fsec;
871 
872  /*
873  * calling postgres functions
874  */
875  j2date((int) date, &info.tm_year, &info.tm_mon, &info.tm_mday);
876  dt2time(time, &info.tm_hour, &info.tm_min, &info.tm_sec, &fsec);
877 
878  /*
879  * adjust values before calling mktime
880  */
881  info.tm_isdst = -1;
882  info.tm_year = info.tm_year - 1900;
883  info.tm_mon = info.tm_mon - 1;
884 
885  /*
886  * mktime & timezone are defined in time.h
887  */
888  return mktime(&info) - timezone;
889 }

Referenced by process(), and spi_getTimeStamp().

spi_getInterval
static TInterval spi_getInterval(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Definition: get_check_data.c:253
Column_info_t::colNumber
int colNumber
Definition: column_info_t.h:54
fetch_column_info
static bool fetch_column_info(Column_info_t *info)
Definition: get_check_data.c:152
Column_info_t::strict
bool strict
Definition: column_info_t.h:56
TEXT
@ TEXT
Definition: column_info_t.h:42
get_TTimestamp
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] ...
Definition: get_check_data.c:457
check_interval_type
static void check_interval_type(Column_info_t info)
Definition: get_check_data.c:44
check_text_type
static void check_text_type(Column_info_t info)
Definition: get_check_data.c:66
get_Id
Id get_Id(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Id opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:562
spi_getBigIntArr_allowEmpty
int64_t * spi_getBigIntArr_allowEmpty(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, size_t *the_size)
Function returns the values of specified columns in array.
Definition: get_check_data.c:354
get_TInterval
TInterval get_TInterval(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:492
check_any_integerarray_type
static void check_any_integerarray_type(Column_info_t info)
Definition: get_check_data.c:115
pgr_get_bigIntArray
int64_t * pgr_get_bigIntArray(size_t *arrlen, ArrayType *input)
enforces the input array to be NOT empty
Definition: arrays_input.c:217
pgr_get_bigIntArray_allowEmpty
int64_t * pgr_get_bigIntArray_allowEmpty(size_t *arrlen, ArrayType *input)
Allows the input array to be empty.
Definition: arrays_input.c:223
check_char_type
static void check_char_type(Column_info_t info)
Definition: get_check_data.c:58
Column_info_t::name
char * name
Definition: column_info_t.h:57
Id
int64_t Id
Definition: typedefs.h:78
timestamp_without_timezone
TTimestamp timestamp_without_timezone(TTimestamp timestamp)
Steps: 1) Similar to: https://doxygen.postgresql.org/backend_2utils_2adt_2timestamp_8c....
Definition: get_check_data.c:847
PGR_DBG
#define PGR_DBG(...)
Definition: debug_macro.h:34
INTERVAL
@ INTERVAL
Definition: column_info_t.h:48
check_any_integer_type
static void check_any_integer_type(Column_info_t info)
Definition: get_check_data.c:92
JSONB
@ JSONB
Definition: column_info_t.h:43
check_any_numerical_type
static void check_any_numerical_type(Column_info_t info)
Definition: get_check_data.c:127
ANY_INTEGER_ARRAY
@ ANY_INTEGER_ARRAY
Definition: column_info_t.h:46
INTEGER_ARRAY
@ INTEGER_ARRAY
Definition: column_info_t.h:45
spi_getTimeStamp
static TTimestamp spi_getTimeStamp(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Definition: get_check_data.c:231
pgr_get_positiveIntArray_allowEmpty
uint32_t * pgr_get_positiveIntArray_allowEmpty(size_t *arrlen, ArrayType *input)
Allows the input array, with non-negative elements to be empty.
Definition: arrays_input.c:228
spi_getChar
char spi_getChar(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, char default_value)
get value of specified column in char type.
Definition: get_check_data.c:298
TravelCost
uint32_t TravelCost
Definition: typedefs.h:82
TTimestamp
int64_t TTimestamp
Definition: typedefs.h:71
Coordinate
double Coordinate
Definition: typedefs.h:73
check_integer_type
static void check_integer_type(Column_info_t info)
Definition: get_check_data.c:82
Amount
int64_t Amount
Definition: typedefs.h:74
Idx
uint64_t Idx
Definition: typedefs.h:79
MatrixIndex
int64_t MatrixIndex
Definition: typedefs.h:80
ANY_INTEGER
@ ANY_INTEGER
Definition: column_info_t.h:40
Duration
uint32_t Duration
Definition: typedefs.h:81
get_Amount
Amount get_Amount(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, Amount opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:619
check_jsonb_type
static void check_jsonb_type(Column_info_t info)
Definition: get_check_data.c:74
PAmount
uint32_t PAmount
Definition: typedefs.h:75
Distance
uint32_t Distance
Definition: typedefs.h:84
Priority
uint32_t Priority
Definition: typedefs.h:83
TInterval
int64_t TInterval
Definition: typedefs.h:72
get_TInterval_plain
TInterval get_TInterval_plain(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info, TInterval opt_value)
@params [in] tuple @params [in] tupdesc @params [in] info about the column been fetched @params [in] ...
Definition: get_check_data.c:527
ANY_NUMERICAL
@ ANY_NUMERICAL
Definition: column_info_t.h:41
column_found
bool column_found(int colNumber)
Check whether the colNumber represent any specific column or NULL (SPI_ERROR_NOATTRIBUTE).
Definition: get_check_data.c:900
spi_getBigInt
static int64_t spi_getBigInt(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Definition: get_check_data.c:203
spi_getInt
static int32_t spi_getInt(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
Definition: get_check_data.c:178
Column_info_t::type
uint64_t type
Definition: column_info_t.h:55
TIMESTAMP
@ TIMESTAMP
Definition: column_info_t.h:47
CHAR1
@ CHAR1
Definition: column_info_t.h:44
check_integerarray_type
static void check_integerarray_type(Column_info_t info)
Definition: get_check_data.c:104
INTEGER
@ INTEGER
Definition: column_info_t.h:39
get_TTimestamp_plain
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] ...
Definition: get_check_data.c:422
StepType
int32_t StepType
Definition: typedefs.h:86
check_timestamp_type
static void check_timestamp_type(Column_info_t info)
Definition: get_check_data.c:142
spi_getFloat8
double spi_getFloat8(HeapTuple *tuple, TupleDesc *tupdesc, Column_info_t info)
gets value of specified column in double type.
Definition: get_check_data.c:782