Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions include/c_common/e_report.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,35 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* ~~~~
*/
void
pgr_global_report(
char** log_msg,
char** notice_msg,
char** error_msg);
pgr_global_report(char**, char**, char**);

/*! @brief Generates a notice on PostgreSQL
*
* This is a development helper function
* `pgr_print_notice` on code and related code must be deleted
*
* To use:
* Add at the begining of the .cpp/.hpp file:
* ~~~~{.c}
* extern "C" {
* #include "c_common/postgres_connection.h"
* #include "c_common/e_report.h"
* }
* #include "cpp_common/alloc.hpp"
* ~~~~
*
* Insert a variable where to store the message
* Save the message
* Call the function using the to_pg_msg
* ~~~~{.c}
* std::ostringstream msg;
* int this_variable = 3;
* msg << "This is the message that shows the value of : " << this_variable;
* pgr_print_notice(to_pg_msg(msg));
* ~~~~
*/
void
pgr_print_notice(const char*);

/* @brief throws postgres error when first string is not null */
void pgr_throw_error(const char*, const char*);
Expand Down
11 changes: 11 additions & 0 deletions src/common/e_report.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ pgr_throw_error(const char *err, const char *hint) {
}
}


/**
* @param[in] msg string to send notice to PostgreSQL
*/
void
pgr_print_notice(const char* msg) {
if (msg) {
ereport(NOTICE, (errmsg_internal("%s", msg)));
}
}

/**
* On C++ side, the message to be returned;
* ~~~~{.c}
Expand Down