vrpRouting  0.3
breaks_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_break_t.h"
Include dependency graph for breaks_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_breaks (char *breaks_sql, Vroom_break_t **breaks, size_t *total_breaks, bool is_plain)
 Reads the VROOM breaks. More...
 

Function Documentation

◆ get_vroom_breaks()

void get_vroom_breaks ( char *  sql,
Vroom_break_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM breaks.

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

Definition at line 160 of file breaks_input.c.

164  {
165  int kColumnCount = 4;
166  Column_info_t info[kColumnCount];
167 
168  for (int i = 0; i < kColumnCount; ++i) {
169  info[i].colNumber = -1;
170  info[i].type = 0;
171  info[i].strict = true;
172  info[i].eType = ANY_INTEGER;
173  }
174 
175  info[0].name = "id";
176  info[1].name = "vehicle_id";
177  info[2].name = "service";
178  info[3].name = "data";
179 
180  info[2].eType = INTEGER; // service
181  info[3].eType = JSONB; // data
182 
183  if (!is_plain) {
184  info[2].eType = INTERVAL; // service
185  }
186 
187  /* service and data are not mandatory */
188  info[2].strict = false;
189  info[3].strict = false;
190 
191  db_get_breaks(sql, rows, total_rows, info, kColumnCount, is_plain);
192 }

References ANY_INTEGER, Column_info_t::colNumber, db_get_breaks(), Column_info_t::eType, INTEGER, 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
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
db_get_breaks
static void db_get_breaks(char *breaks_sql, Vroom_break_t **breaks, size_t *total_breaks, Column_info_t *info, const int column_count, bool is_plain)
Definition: breaks_input.c:78
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