vrpRouting  0.3
e_report.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Postgres ereport

Send notice or error to postgreSQL (cleans the char *)

From the C++ err_msg, log_msg, notice_msg are returned as a (char *),

Before exiting the C code the pointers need to be freed:

  • This task can be done when there is no error,
  • Call to ERROR, gives the control back to postgreSQL
    • leaves a leak

on C++ side, the message to be returned;

std::ostringstream log;
log << "the message";
*log_msg = pgr_msg(log.str().c_str());

when there is ERROR then postgreSQL takes over control The char* messages are cleared automaticalyy with pfree.

Warning
When error: Free all data not created with palloc before calling
void pgr_global_report (char *log_msg, char *notice_msg, char *error_msg)
 notice & error More...
 

Function Documentation

◆ pgr_global_report()

void pgr_global_report ( char *  log_msg,
char *  notice_msg,
char *  error_msg 
)

notice & error

pgr_notice(&log_msg, &notice_msg, &error_msg);
precondition: before calling ereport
assert(!*log_msg);
assert(!*notice_msg);
assert(!*error_msg);

Definition at line 30 of file e_report.c.

33  {
34  if (!notice && log) {
35  ereport(DEBUG1,
36  (errmsg_internal("%s", log)));
37  }
38 
39  if (notice) {
40  if (log) {
41  ereport(NOTICE,
42  (errmsg_internal("%s", notice),
43  errhint("%s", log)));
44  } else {
45  ereport(NOTICE,
46  (errmsg_internal("%s", notice)));
47  }
48  }
49 
50  if (err) {
51  if (log) {
52  ereport(ERROR,
53  (errmsg_internal("%s", err),
54  errhint("%s", log)));
55  } else {
56  ereport(ERROR,
57  (errmsg_internal("%s", err)));
58  }
59  }
60 }

Referenced by process().

pgr_msg
char * pgr_msg(const std::string &msg)
Definition: pgr_alloc.cpp:33