Исходный код СУБД 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
47
48
49
50
#ifndef QDBPP_UTL_CALL_STACK_HPP
#define QDBPP_UTL_CALL_STACK_HPP
 
extern "C" {
#include "postgres.h"
#include "fmgr.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/elog.h"
#include "utils/guc.h"      // <— добавили
#include "miscadmin.h"
}
 
#define UTL_CALL_STACK_ERR_BAD_DEPTH 64610
 
inline void UTL_CALL_STACK_RAISE_BAD_DEPTH()
{
    ereport(ERROR,
        (errcode(ERRCODE_RAISE_EXCEPTION),
         errmsg("ORA-64610: BAD_DEPTH_INDICATOR")));
}
 
extern "C" {
    // no-arg
    PGDLLEXPORT Datum utl_call_stack_backtrace_depth(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_dynamic_depth(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_error_depth(PG_FUNCTION_ARGS);
 
    // int-arg
    PGDLLEXPORT Datum utl_call_stack_backtrace_line(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_backtrace_unit(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_current_edition(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_error_msg(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_error_number(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_lexical_depth(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_owner(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_unit_line(PG_FUNCTION_ARGS);
 
    // string
    PGDLLEXPORT Datum utl_call_stack_subprogram(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_concatenate_subprogram(PG_FUNCTION_ARGS);
    PGDLLEXPORT Datum utl_call_stack_compose_subprogram(PG_FUNCTION_ARGS);
 
    PGDLLEXPORT Datum utl_call_stack_get_version(PG_FUNCTION_ARGS);
 
    void _PG_init(void);
    void _PG_fini(void);
}
 
#endif