PGROUTING  2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
test_matrixRows.c File Reference
Include dependency graph for test_matrixRows.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (test_matrixRows)
 
static void process (char *matrix_rows_sql, bool *result_bool)
 
PGDLLEXPORT Datum test_matrixRows (PG_FUNCTION_ARGS)
 

Function Documentation

PG_FUNCTION_INFO_V1 ( test_matrixRows  )
static void process ( char *  matrix_rows_sql,
bool *  result_bool 
)
static

Definition at line 45 of file test_matrixRows.c.

References do_pgr_test_matrixRows(), PGR_DBG, pgr_get_matrixRows(), pgr_SPI_connect(), and pgr_SPI_finish().

Referenced by test_matrixRows().

46  {
48 
49  PGR_DBG("Load data");
50  Matrix_cell_t *matrix_rows = NULL;
51  size_t total_rows = 0;
52  pgr_get_matrixRows(matrix_rows_sql, &matrix_rows, &total_rows);
53 
54  if (total_rows == 0) {
55  PGR_DBG("No rows found");
56  (*result_bool) = true;
57  pfree(matrix_rows);
59  return;
60  }
61 
62  PGR_DBG("Total %ld rows in query:", total_rows);
63  size_t i;
64  for (i = 0; i < total_rows; ++i) {
65  PGR_DBG("start_vid = %li \t end_vid = %li agg_cost = %lf",
66  matrix_rows[i].from_vid, matrix_rows[i].to_vid, matrix_rows[i].cost);
67  }
68 
69 
70  PGR_DBG("Starting processing");
71  char *err_msg = NULL;
72  char *log_msg = NULL;
73  (*result_bool) = do_pgr_test_matrixRows(
74  matrix_rows,
75  total_rows,
76  &log_msg,
77  &err_msg);
78 
79  pfree(matrix_rows);
80  PGR_DBG("Returned log message = %s\n", log_msg);
81  if (log_msg) {
82  elog(DEBUG1, "%s", log_msg);
83  free(log_msg);
84  }
85  PGR_DBG("Returned error message = %s\n", err_msg);
86 
87  if (err_msg) {
89  elog(ERROR, "%s", err_msg);
90  free(err_msg);
91  }
92 
94 }
#define PGR_DBG(...)
Definition: debug_macro.h:34
void pgr_SPI_finish(void)
void pgr_SPI_connect(void)
void pgr_get_matrixRows(char *sql, Matrix_cell_t **rows, size_t *total_rows)
bigint start_vid, bigint end_vid, float agg_cost,
bool do_pgr_test_matrixRows(Matrix_cell_t *matrix_rows, size_t total_rows, char **log_msg, char **err_msg)

Here is the call graph for this function:

Here is the caller graph for this function:

PGDLLEXPORT Datum test_matrixRows ( PG_FUNCTION_ARGS  )

Definition at line 99 of file test_matrixRows.c.

References process().

99  {
100  bool result_bool = false;
101 
102  process(
103  text_to_cstring(PG_GETARG_TEXT_P(0)),
104  &result_bool);
105 
106  PG_RETURN_BOOL(result_bool);
107 }
static void process(char *matrix_rows_sql, bool *result_bool)

Here is the call graph for this function: