Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
2 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*
 * src/pl/plpython/plpy_elog.h
 */
 
#ifndef PLPY_ELOG_H
#define PLPY_ELOG_H
 
#include "plpython.h"
 
/* global exception classes */
extern PyObject *PLy_exc_error;
extern PyObject *PLy_exc_fatal;
extern PyObject *PLy_exc_spi_error;
 
/*
 * PLy_elog()
 *
 * See comments at elog() about the compiler hinting.
 */
#ifdef HAVE_PG_INTEGER_CONSTANT_P
#define PLy_elog(elevel, ...) \
    do { \
        PLy_elog_impl(elevel, __VA_ARGS__); \
        if (pg_integer_constant_p(elevel) && (elevel) >= ERROR) \
            pg_unreachable(); \
    } while(0)
#else                           /* !HAVE_PG_INTEGER_CONSTANT_P */
#define PLy_elog(elevel, ...)  \
    do { \
        const int elevel_ = (elevel); \
        PLy_elog_impl(elevel_, __VA_ARGS__); \
        if (elevel_ >= ERROR) \
            pg_unreachable(); \
    } while(0)
#endif                          /* HAVE_PG_INTEGER_CONSTANT_P */
 
extern PGDLLEXPORT void PLy_elog_impl(int elevel, const char *fmt, ...) pg_attribute_printf(2, 3);
 
extern PGDLLEXPORT void PLy_exception_set(PyObject *exc, const char *fmt, ...) pg_attribute_printf(2, 3);
 
extern PGDLLEXPORT void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural,
                                                 unsigned long n, ...) pg_attribute_printf(2, 5) pg_attribute_printf(3, 5);
 
extern PGDLLEXPORT void PLy_exception_set_with_details(PyObject *excclass, ErrorData *edata);
 
#endif                          /* PLPY_ELOG_H */