vrpRouting  0.3
time_windows_input.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include "c_common/get_check_data.h"
#include "c_types/column_info_t.h"
#include "c_types/vroom/vroom_time_window_t.h"
Include dependency graph for time_windows_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_time_windows (char *time_windows_sql, Vroom_time_window_t **time_windows, size_t *total_time_windows, bool is_plain)
 Reads the VROOM shipments time windows. More...
 
void get_vroom_time_windows (char *time_windows_sql, Vroom_time_window_t **time_windows, size_t *total_time_windows, bool is_plain)
 Reads the VROOM time windows. More...
 

Function Documentation

◆ get_vroom_shipments_time_windows()

void get_vroom_shipments_time_windows ( char *  sql,
Vroom_time_window_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM shipments time windows.

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

Definition at line 239 of file time_windows_input.c.

243  {
244  int kColumnCount = 4;
245  Column_info_t info[kColumnCount];
246 
247  for (int i = 0; i < kColumnCount; ++i) {
248  info[i].colNumber = -1;
249  info[i].type = 0;
250  info[i].strict = true;
251  info[i].eType = INTEGER;
252  }
253 
254  info[0].name = "id";
255  info[1].name = "kind";
256  info[2].name = "tw_open";
257  info[3].name = "tw_close";
258 
259  info[0].eType = ANY_INTEGER; // id
260  info[1].eType = CHAR1; // kind
261 
262  if (!is_plain) {
263  info[2].eType = TIMESTAMP; // tw_open
264  info[3].eType = TIMESTAMP; // tw_close
265  }
266 
267  db_get_time_windows(sql, rows, total_rows, info, kColumnCount, 1, is_plain);
268 }

References ANY_INTEGER, CHAR1, Column_info_t::colNumber, db_get_time_windows(), Column_info_t::eType, INTEGER, Column_info_t::name, Column_info_t::strict, TIMESTAMP, and Column_info_t::type.

Referenced by process().

◆ get_vroom_time_windows()

void get_vroom_time_windows ( char *  sql,
Vroom_time_window_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM time windows.

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

Definition at line 204 of file time_windows_input.c.

208  {
209  int kColumnCount = 3;
210  Column_info_t info[kColumnCount];
211 
212  for (int i = 0; i < kColumnCount; ++i) {
213  info[i].colNumber = -1;
214  info[i].type = 0;
215  info[i].strict = true;
216  info[i].eType = INTEGER;
217  }
218 
219  info[0].name = "id";
220  info[1].name = "tw_open";
221  info[2].name = "tw_close";
222 
223  info[0].eType = ANY_INTEGER; // id
224 
225  if (!is_plain) {
226  info[1].eType = TIMESTAMP; // tw_open
227  info[2].eType = TIMESTAMP; // tw_close
228  }
229 
230  db_get_time_windows(sql, rows, total_rows, info, kColumnCount, 0, is_plain);
231 }

References ANY_INTEGER, Column_info_t::colNumber, db_get_time_windows(), Column_info_t::eType, INTEGER, 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
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
TIMESTAMP
@ TIMESTAMP
Definition: column_info_t.h:47
CHAR1
@ CHAR1
Definition: column_info_t.h:44
Column_info_t
Definition: column_info_t.h:52
INTEGER
@ INTEGER
Definition: column_info_t.h:39
db_get_time_windows
static void db_get_time_windows(char *time_windows_sql, Vroom_time_window_t **time_windows, size_t *total_time_windows, Column_info_t *info, const int column_count, bool is_shipment, bool is_plain)
Definition: time_windows_input.c:121