vrpRouting  0.3
vroom/vehicles_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_vehicle_t.h"
Include dependency graph for vroom/vehicles_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_vehicles (char *vehicles_sql, Vroom_vehicle_t **vehicles, size_t *total_vehicles, bool is_plain)
 Reads the VROOM vehicles. More...
 

Function Documentation

◆ get_vroom_vehicles()

void get_vroom_vehicles ( char *  sql,
Vroom_vehicle_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM vehicles.

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

id is mandatory. At least one out of start_id or end_id must be present, but that is checked later.

Definition at line 237 of file vroom/vehicles_input.c.

241  {
242  int kColumnCount = 10;
243  Column_info_t info[kColumnCount];
244 
245  for (int i = 0; i < kColumnCount; ++i) {
246  info[i].colNumber = -1;
247  info[i].type = 0;
248  info[i].strict = false;
249  info[i].eType = ANY_INTEGER;
250  }
251 
252  info[0].name = "id";
253  info[1].name = "start_id";
254  info[2].name = "end_id";
255  info[3].name = "capacity";
256  info[4].name = "skills";
257  info[5].name = "tw_open";
258  info[6].name = "tw_close";
259  info[7].name = "speed_factor";
260  info[8].name = "max_tasks";
261  info[9].name = "data";
262 
263  info[3].eType = ANY_INTEGER_ARRAY; // capacity
264  info[4].eType = INTEGER_ARRAY; // skills
265  info[5].eType = INTEGER; // tw_open
266  info[6].eType = INTEGER; // tw_close
267  info[7].eType = ANY_NUMERICAL; // speed_factor
268  info[8].eType = INTEGER; // max_tasks
269  info[9].eType = JSONB; // data
270 
271  if (!is_plain) {
272  info[5].eType = TIMESTAMP; // tw_open
273  info[6].eType = TIMESTAMP; // tw_close
274  }
275 
280  info[0].strict = true;
281 
282  db_get_vehicles(sql, rows, total_rows, info, kColumnCount, is_plain);
283 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, ANY_NUMERICAL, Column_info_t::colNumber, db_get_vehicles(), Column_info_t::eType, INTEGER, INTEGER_ARRAY, JSONB, Column_info_t::name, Column_info_t::strict, TIMESTAMP, 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
Column_info_t::name
char * name
Definition: column_info_t.h:57
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
db_get_vehicles
static void db_get_vehicles(char *vehicles_sql, Vroom_vehicle_t **vehicles, size_t *total_vehicles, Column_info_t *info, const int column_count, bool is_plain)
Definition: vroom/vehicles_input.c:150
ANY_NUMERICAL
@ ANY_NUMERICAL
Definition: column_info_t.h:41
Column_info_t::type
uint64_t type
Definition: column_info_t.h:55
TIMESTAMP
@ TIMESTAMP
Definition: column_info_t.h:47
Column_info_t
Definition: column_info_t.h:52
INTEGER
@ INTEGER
Definition: column_info_t.h:39