vrpRouting  0.3
shipments_input.h File Reference
#include <stddef.h>
#include "c_common/get_check_data.h"
#include "c_types/column_info_t.h"
#include "c_types/vroom/vroom_shipment_t.h"
Include dependency graph for shipments_input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void get_vroom_shipments (char *shipments_sql, Vroom_shipment_t **shipments, size_t *total_shipments, bool is_plain)
 Reads the VROOM shipments. More...
 

Function Documentation

◆ get_vroom_shipments()

void get_vroom_shipments ( char *  sql,
Vroom_shipment_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM shipments.

Parameters
[in]sqlSQL query to execute
[out]rowsC Container that holds the data
[out]total_rowsTotal rows recieved

Definition at line 216 of file shipments_input.c.

220  {
221  int kColumnCount = 12;
222  Column_info_t info[kColumnCount];
223 
224  for (int i = 0; i < kColumnCount; ++i) {
225  info[i].colNumber = -1;
226  info[i].type = 0;
227  info[i].strict = false;
228  info[i].eType = ANY_INTEGER;
229  }
230 
231  info[0].name = "id";
232 
233  /* pickup shipments */
234  info[1].name = "p_location_id";
235  info[2].name = "p_setup";
236  info[3].name = "p_service";
237 
238  /* delivery shipments */
239  info[4].name = "d_location_id";
240  info[5].name = "d_setup";
241  info[6].name = "d_service";
242 
243  info[7].name = "amount";
244  info[8].name = "skills";
245  info[9].name = "priority";
246  info[10].name = "p_data";
247  info[11].name = "d_data";
248 
249  info[2].eType = INTEGER; // p_setup
250  info[3].eType = INTEGER; // p_service
251  info[5].eType = INTEGER; // d_setup
252  info[6].eType = INTEGER; // d_service
253  info[7].eType = ANY_INTEGER_ARRAY; // amount
254  info[8].eType = INTEGER_ARRAY; // skills
255  info[9].eType = INTEGER; // priority
256  info[10].eType = JSONB; // p_data
257  info[11].eType = JSONB; // d_data
258 
259  if (!is_plain) {
260  info[2].eType = INTERVAL; // p_setup
261  info[3].eType = INTERVAL; // p_service
262  info[5].eType = INTERVAL; // d_setup
263  info[6].eType = INTERVAL; // d_service
264  }
265 
266  /* id and location_id of pickup and delivery are mandatory */
267  info[0].strict = true;
268  info[1].strict = true;
269  info[4].strict = true;
270 
271  db_get_shipments(sql, rows, total_rows, info, kColumnCount, is_plain);
272 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, Column_info_t::colNumber, db_get_shipments(), Column_info_t::eType, INTEGER, INTEGER_ARRAY, INTERVAL, JSONB, Column_info_t::name, Column_info_t::strict, and Column_info_t::type.

Referenced by process().

Column_info_t::colNumber
int colNumber
Definition: column_info_t.h:54
Column_info_t::strict
bool strict
Definition: column_info_t.h:56
db_get_shipments
static void db_get_shipments(char *shipments_sql, Vroom_shipment_t **shipments, size_t *total_shipments, Column_info_t *info, const int column_count, bool is_plain)
Definition: shipments_input.c:135
Column_info_t::name
char * name
Definition: column_info_t.h:57
INTERVAL
@ INTERVAL
Definition: column_info_t.h:48
JSONB
@ JSONB
Definition: column_info_t.h:43
ANY_INTEGER_ARRAY
@ ANY_INTEGER_ARRAY
Definition: column_info_t.h:46
INTEGER_ARRAY
@ INTEGER_ARRAY
Definition: column_info_t.h:45
Column_info_t::eType
expectType eType
Definition: column_info_t.h:58
ANY_INTEGER
@ ANY_INTEGER
Definition: column_info_t.h:40
Column_info_t::type
uint64_t type
Definition: column_info_t.h:55
Column_info_t
Definition: column_info_t.h:52
INTEGER
@ INTEGER
Definition: column_info_t.h:39