vrpRouting  0.3
jobs_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_job_t.h"
Include dependency graph for jobs_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_jobs (char *jobs_sql, Vroom_job_t **jobs, size_t *total_jobs, bool is_plain)
 Reads the VROOM jobs. More...
 

Function Documentation

◆ get_vroom_jobs()

void get_vroom_jobs ( char *  sql,
Vroom_job_t **  rows,
size_t *  total_rows,
bool  is_plain 
)

Reads the VROOM jobs.

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

Definition at line 213 of file jobs_input.c.

217  {
218  int kColumnCount = 9;
219  Column_info_t info[kColumnCount];
220 
221  for (int i = 0; i < kColumnCount; ++i) {
222  info[i].colNumber = -1;
223  info[i].type = 0;
224  info[i].strict = false;
225  info[i].eType = ANY_INTEGER;
226  }
227 
228  info[0].name = "id";
229  info[1].name = "location_id";
230  info[2].name = "setup";
231  info[3].name = "service";
232  info[4].name = "delivery";
233  info[5].name = "pickup";
234  info[6].name = "skills";
235  info[7].name = "priority";
236  info[8].name = "data";
237 
238  info[2].eType = INTEGER; // setup
239  info[3].eType = INTEGER; // service
240  info[4].eType = ANY_INTEGER_ARRAY; // delivery
241  info[5].eType = ANY_INTEGER_ARRAY; // pickup
242  info[6].eType = INTEGER_ARRAY; // skills
243  info[7].eType = INTEGER; // priority
244  info[8].eType = JSONB; // data
245 
246  if (!is_plain) {
247  info[2].eType = INTERVAL; // setup
248  info[3].eType = INTERVAL; // service
249  }
250 
251  /* Only id and location_id are mandatory */
252  info[0].strict = true;
253  info[1].strict = true;
254 
255  db_get_jobs(sql, rows, total_rows, info, kColumnCount, is_plain);
256 }

References ANY_INTEGER, ANY_INTEGER_ARRAY, Column_info_t::colNumber, db_get_jobs(), 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
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
db_get_jobs
static void db_get_jobs(char *jobs_sql, Vroom_job_t **jobs, size_t *total_jobs, Column_info_t *info, const int column_count, bool is_plain)
Definition: jobs_input.c:132