PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
e_report.h File Reference

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 messaage";
log_msg = strdup(log.str().c_str());

The char* messages are cleared. New messages are made with palloc

when there is ERROR then postgreSQL takes over control

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...
 
void pgr_notice (char *notice_msg)
 notice with no hint More...
 
void pgr_notice2 (char *log_msg, char *notice_msg)
 notice with hint More...
 
void pgr_error (char *error_msg)
 error with no hint More...
 
void pgr_error2 (char *log_msg, char *error_msg)
 error with hint More...
 

Function Documentation

void pgr_error ( char *  error_msg)

error with no hint

if (err_msg) {
pfree(<data>);
}
pgr_error(&error_msg);
precondition: before calling ereport
assert(!*error_msg);

Definition at line 61 of file e_report.c.

References err_msg, pgr_cstring2char(), and PGR_DBG.

void pgr_error2 ( char *  log_msg,
char *  error_msg 
)

error with hint

if (err_msg) {
pfree(<data>);
}
pgr_error(&log_msg, &error_msg);
precondition: before calling ereport
assert(!*log_msg);
assert(!*error_msg);

Definition at line 79 of file e_report.c.

References PGR_DBG.

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 93 of file e_report.c.

Referenced by compute(), and process().

void pgr_notice ( char *  notice_msg)

notice with no hint

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

Definition at line 31 of file e_report.c.

References PGR_DBG.

Referenced by pgr_notice2().

void pgr_notice2 ( char *  log_msg,
char *  notice_msg 
)

notice with hint

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

Definition at line 42 of file e_report.c.

References PGR_DBG, and pgr_notice().