PGROUTING  2.5
test_c_edges.c File Reference
Include dependency graph for test_c_edges.c:

Go to the source code of this file.

Functions

 PG_FUNCTION_INFO_V1 (test_c_edges)
 
static void process (char *edges_sql, bool *result_bool)
 
PGDLLEXPORT Datum test_c_edges (PG_FUNCTION_ARGS)
 

Function Documentation

PG_FUNCTION_INFO_V1 ( test_c_edges  )

Referenced by process().

Here is the caller graph for this function:

static void process ( char *  edges_sql,
bool *  result_bool 
)
static

Definition at line 43 of file test_c_edges.c.

References do_pgr_test_c_edges(), edges, PG_FUNCTION_INFO_V1(), PGR_DBG, pgr_get_edges(), pgr_SPI_connect(), pgr_SPI_finish(), and test_c_edges().

Referenced by test_c_edges().

44  {
46 
47  PGR_DBG("Load data");
48  pgr_edge_t *edges = NULL;
49  size_t total_edges = 0;
50  pgr_get_edges(edges_sql, &edges, &total_edges);
51 
52  if (total_edges == 0) {
53  PGR_DBG("No edges found");
54  (*result_bool) = true;
55  pfree(edges);
57  return;
58  }
59  PGR_DBG("Total %ld tuples in query:", total_edges);
60  size_t i;
61  for (i = 0; i < total_edges; ++i) {
62  PGR_DBG("id = %li \t source = %li \t target = %ld cost = %lf reverse_cost = %lf",
63  edges[i].id, edges[i].source, edges[i].target, edges[i].cost, edges[i].reverse_cost);
64  /*PGR_DBG(" (x1,y1) = (%.32lf ,%.32lf) (x2,y2) = (%.32lf,.%.32lf)",
65  edges[i].x1, edges[i].y1, edges[i].x2, edges[i].y2);*/
66  }
67 
68 
69  PGR_DBG("Starting processing");
70  char *err_msg = NULL;
71  char *log_msg = NULL;
72  (*result_bool) = do_pgr_test_c_edges(
73  edges,
74  total_edges,
75  &log_msg,
76  &err_msg);
77 
78  pfree(edges);
79  PGR_DBG("Returned log message = %s\n", log_msg);
80  if (log_msg) {
81  elog(DEBUG1, "%s", log_msg);
82  free(log_msg);
83  }
84  PGR_DBG("Returned error message = %s\n", err_msg);
85 
86  if (err_msg) {
88  elog(ERROR, "%s", err_msg);
89  free(err_msg);
90  }
91 
93 }
static edge_t edges[22573]
#define PGR_DBG(...)
Definition: debug_macro.h:34
void pgr_get_edges(char *edges_sql, pgr_edge_t **edges, size_t *total_edges)
basic edge_sql
Definition: edges_input.c:540
bool do_pgr_test_c_edges(pgr_edge_t *data_edges, size_t total_edges, char **log_msg, char **err_msg)
void pgr_SPI_finish(void)
void pgr_SPI_connect(void)

Here is the call graph for this function:

Here is the caller graph for this function:

PGDLLEXPORT Datum test_c_edges ( PG_FUNCTION_ARGS  )

Definition at line 97 of file test_c_edges.c.

References process().

Referenced by process().

97  {
98  bool result_bool = false;
99  process(
100  text_to_cstring(PG_GETARG_TEXT_P(0)),
101  &result_bool);
102 
103  PG_RETURN_BOOL(result_bool);
104 }
static void process(char *edges_sql, bool *result_bool)
Definition: test_c_edges.c:43

Here is the call graph for this function:

Here is the caller graph for this function: