Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

PostgreSQL Source Code git master
plpy_elog.h File Reference
#include "plpython.h"
Include dependency graph for plpy_elog.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define PLy_elog(elevel, ...)
 

Functions

PGDLLEXPORT void PLy_elog_impl (int elevel, const char *fmt,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set (PyObject *exc, const char *fmt,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set_plural (PyObject *exc, const char *fmt_singular, const char *fmt_plural, unsigned long n,...) pg_attribute_printf(2
 
PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void pg_attribute_printf (3, 5)
 
PGDLLEXPORT void PLy_exception_set_with_details (PyObject *excclass, ErrorData *edata)
 

Variables

PyObject * PLy_exc_error
 
PyObject * PLy_exc_fatal
 
PyObject * PLy_exc_spi_error
 

Macro Definition Documentation

◆ PLy_elog

#define PLy_elog (   elevel,
  ... 
)
Value:
do { \
const int elevel_ = (elevel); \
PLy_elog_impl(elevel_, __VA_ARGS__); \
if (elevel_ >= ERROR) \
pg_unreachable(); \
} while(0)
#define ERROR
Definition: elog.h:39

Definition at line 28 of file plpy_elog.h.

Function Documentation

◆ pg_attribute_printf()

PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void pg_attribute_printf ( ,
 
)

◆ PLy_elog_impl()

PGDLLEXPORT void PLy_elog_impl ( int  elevel,
const char *  fmt,
  ... 
)

◆ PLy_exception_set()

PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set ( PyObject *  exc,
const char *  fmt,
  ... 
)

◆ PLy_exception_set_plural()

PGDLLEXPORT void PGDLLEXPORT void PGDLLEXPORT void PLy_exception_set_plural ( PyObject *  exc,
const char *  fmt_singular,
const char *  fmt_plural,
unsigned long  n,
  ... 
)

◆ PLy_exception_set_with_details()

PGDLLEXPORT void PLy_exception_set_with_details ( PyObject *  excclass,
ErrorData edata 
)

Definition at line 509 of file plpy_elog.c.

510{
511 PyObject *args = NULL;
512 PyObject *error = NULL;
513
514 args = Py_BuildValue("(s)", edata->message);
515 if (!args)
516 goto failure;
517
518 /* create a new exception with the error message as the parameter */
519 error = PyObject_CallObject(excclass, args);
520 if (!error)
521 goto failure;
522
523 if (!set_string_attr(error, "sqlstate",
525 goto failure;
526
527 if (!set_string_attr(error, "detail", edata->detail))
528 goto failure;
529
530 if (!set_string_attr(error, "hint", edata->hint))
531 goto failure;
532
533 if (!set_string_attr(error, "query", edata->internalquery))
534 goto failure;
535
536 if (!set_string_attr(error, "schema_name", edata->schema_name))
537 goto failure;
538
539 if (!set_string_attr(error, "table_name", edata->table_name))
540 goto failure;
541
542 if (!set_string_attr(error, "column_name", edata->column_name))
543 goto failure;
544
545 if (!set_string_attr(error, "datatype_name", edata->datatype_name))
546 goto failure;
547
548 if (!set_string_attr(error, "constraint_name", edata->constraint_name))
549 goto failure;
550
551 PyErr_SetObject(excclass, error);
552
553 Py_DECREF(args);
554 Py_DECREF(error);
555
556 return;
557
558failure:
559 Py_XDECREF(args);
560 Py_XDECREF(error);
561
562 elog(ERROR, "could not convert error to Python exception");
563}
char * unpack_sql_state(int sql_state)
Definition: elog.c:3213
#define elog(elevel,...)
Definition: elog.h:226
static bool set_string_attr(PyObject *obj, char *attrname, char *str)
Definition: plpy_elog.c:583
static void error(void)
Definition: sql-dyntest.c:147
char * schema_name
Definition: elog.h:439
char * internalquery
Definition: elog.h:446
int sqlerrcode
Definition: elog.h:431
char * datatype_name
Definition: elog.h:442
char * detail
Definition: elog.h:433
char * table_name
Definition: elog.h:440
char * message
Definition: elog.h:432
char * hint
Definition: elog.h:435
char * constraint_name
Definition: elog.h:443
char * column_name
Definition: elog.h:441

References generate_unaccent_rules::args, ErrorData::column_name, ErrorData::constraint_name, ErrorData::datatype_name, ErrorData::detail, elog, ERROR, error(), ErrorData::hint, ErrorData::internalquery, ErrorData::message, ErrorData::schema_name, set_string_attr(), ErrorData::sqlerrcode, ErrorData::table_name, and unpack_sql_state().

Referenced by PLy_output().

Variable Documentation

◆ PLy_exc_error

◆ PLy_exc_fatal

PyObject* PLy_exc_fatal
extern

Definition at line 16 of file plpy_elog.c.

Referenced by PLy_add_exceptions(), and PLy_elog_impl().

◆ PLy_exc_spi_error