mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-01-24 18:55:04 +08:00
PL/Python: Add argument names to function declarations
For easier source reading
This commit is contained in:
parent
a671d9409b
commit
f9de1e9a96
@ -20,12 +20,12 @@
|
||||
#include "plpy_spi.h"
|
||||
|
||||
|
||||
static PyObject *PLy_cursor_query(const char *);
|
||||
static PyObject *PLy_cursor_plan(PyObject *, PyObject *);
|
||||
static void PLy_cursor_dealloc(PyObject *);
|
||||
static PyObject *PLy_cursor_iternext(PyObject *);
|
||||
static PyObject *PLy_cursor_fetch(PyObject *, PyObject *);
|
||||
static PyObject *PLy_cursor_close(PyObject *, PyObject *);
|
||||
static PyObject *PLy_cursor_query(const char *query);
|
||||
static PyObject *PLy_cursor_plan(PyObject *ob, PyObject *args);
|
||||
static void PLy_cursor_dealloc(PyObject *arg);
|
||||
static PyObject *PLy_cursor_iternext(PyObject *self);
|
||||
static PyObject *PLy_cursor_fetch(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_cursor_close(PyObject *self, PyObject *unused);
|
||||
|
||||
static char PLy_cursor_doc[] = {
|
||||
"Wrapper around a PostgreSQL cursor"
|
||||
|
@ -17,6 +17,6 @@ typedef struct PLyCursorObject
|
||||
} PLyCursorObject;
|
||||
|
||||
extern void PLy_cursor_init_type(void);
|
||||
extern PyObject *PLy_cursor(PyObject *, PyObject *);
|
||||
extern PyObject *PLy_cursor(PyObject *self, PyObject *args);
|
||||
|
||||
#endif /* PLPY_CURSOROBJECT_H */
|
||||
|
@ -20,10 +20,10 @@ PyObject *PLy_exc_fatal = NULL;
|
||||
PyObject *PLy_exc_spi_error = NULL;
|
||||
|
||||
|
||||
static void PLy_traceback(char **, char **, int *);
|
||||
static void PLy_get_spi_error_data(PyObject *, int *, char **,
|
||||
char **, char **, int *);
|
||||
static char * get_source_line(const char *, int);
|
||||
static void PLy_traceback(char **xmsg, char **tbmsg, int *tb_depth);
|
||||
static void PLy_get_spi_error_data(PyObject *exc, int *sqlerrcode, char **detail,
|
||||
char **hint, char **query, int *position);
|
||||
static char * get_source_line(const char *src, int lineno);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -10,13 +10,13 @@ extern PyObject *PLy_exc_error;
|
||||
extern PyObject *PLy_exc_fatal;
|
||||
extern PyObject *PLy_exc_spi_error;
|
||||
|
||||
extern void PLy_elog(int, const char *,...)
|
||||
extern void PLy_elog(int elevel, const char *fmt,...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
|
||||
extern void PLy_exception_set(PyObject *, const char *,...)
|
||||
extern void PLy_exception_set(PyObject *exc, const char *fmt,...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 3)));
|
||||
|
||||
extern void PLy_exception_set_plural(PyObject *, const char *, const char *,
|
||||
extern void PLy_exception_set_plural(PyObject *exc, const char *fmt_singular, const char *fmt_plural,
|
||||
unsigned long n,...)
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 2, 5)))
|
||||
__attribute__((format(PG_PRINTF_ATTRIBUTE, 3, 5)));
|
||||
|
@ -25,18 +25,18 @@
|
||||
#include "plpy_subxactobject.h"
|
||||
|
||||
|
||||
static PyObject *PLy_function_build_args(FunctionCallInfo, PLyProcedure *);
|
||||
static void PLy_function_delete_args(PLyProcedure *);
|
||||
static void plpython_return_error_callback(void *);
|
||||
static PyObject *PLy_function_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc);
|
||||
static void PLy_function_delete_args(PLyProcedure *proc);
|
||||
static void plpython_return_error_callback(void *arg);
|
||||
|
||||
static PyObject *PLy_trigger_build_args(FunctionCallInfo, PLyProcedure *,
|
||||
HeapTuple *);
|
||||
static HeapTuple PLy_modify_tuple(PLyProcedure *, PyObject *,
|
||||
TriggerData *, HeapTuple);
|
||||
static void plpython_trigger_error_callback(void *);
|
||||
static PyObject *PLy_trigger_build_args(FunctionCallInfo fcinfo, PLyProcedure *proc,
|
||||
HeapTuple *rv);
|
||||
static HeapTuple PLy_modify_tuple(PLyProcedure *proc, PyObject *pltd,
|
||||
TriggerData *tdata, HeapTuple otup);
|
||||
static void plpython_trigger_error_callback(void *arg);
|
||||
|
||||
static PyObject *PLy_procedure_call(PLyProcedure *, char *, PyObject *);
|
||||
static void PLy_abort_open_subtransactions(int);
|
||||
static PyObject *PLy_procedure_call(PLyProcedure *proc, char *kargs, PyObject *vargs);
|
||||
static void PLy_abort_open_subtransactions(int save_subxact_level);
|
||||
|
||||
|
||||
/* function subhandler */
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "plpy_procedure.h"
|
||||
|
||||
extern Datum PLy_exec_function(FunctionCallInfo, PLyProcedure *);
|
||||
extern HeapTuple PLy_exec_trigger(FunctionCallInfo, PLyProcedure *);
|
||||
extern Datum PLy_exec_function(FunctionCallInfo fcinfo, PLyProcedure *proc);
|
||||
extern HeapTuple PLy_exec_trigger(FunctionCallInfo fcinfo, PLyProcedure *proc);
|
||||
|
||||
#endif /* PLPY_EXEC_H */
|
||||
|
@ -61,9 +61,9 @@ PG_FUNCTION_INFO_V1(plpython2_inline_handler);
|
||||
#endif
|
||||
|
||||
|
||||
static bool PLy_procedure_is_trigger(Form_pg_proc);
|
||||
static void plpython_error_callback(void *);
|
||||
static void plpython_inline_error_callback(void *);
|
||||
static bool PLy_procedure_is_trigger(Form_pg_proc procStruct);
|
||||
static void plpython_error_callback(void *arg);
|
||||
static void plpython_inline_error_callback(void *arg);
|
||||
static void PLy_init_interp(void);
|
||||
|
||||
static const int plpython_python_version = PY_MAJOR_VERSION;
|
||||
|
@ -13,8 +13,8 @@
|
||||
#include "plpy_elog.h"
|
||||
|
||||
|
||||
static void PLy_plan_dealloc(PyObject *);
|
||||
static PyObject *PLy_plan_status(PyObject *, PyObject *);
|
||||
static void PLy_plan_dealloc(PyObject *arg);
|
||||
static PyObject *PLy_plan_status(PyObject *self, PyObject *args);
|
||||
|
||||
static char PLy_plan_doc[] = {
|
||||
"Store a PostgreSQL plan"
|
||||
|
@ -21,6 +21,6 @@ typedef struct PLyPlanObject
|
||||
|
||||
extern void PLy_plan_init_type(void);
|
||||
extern PyObject *PLy_plan_new(void);
|
||||
extern bool is_PLyPlanObject(PyObject *);
|
||||
extern bool is_PLyPlanObject(PyObject *ob);
|
||||
|
||||
#endif /* PLPY_PLANOBJECT_H */
|
||||
|
@ -24,20 +24,20 @@
|
||||
HTAB *PLy_spi_exceptions = NULL;
|
||||
|
||||
|
||||
static void PLy_add_exceptions(PyObject *);
|
||||
static void PLy_generate_spi_exceptions(PyObject *, PyObject *);
|
||||
static void PLy_add_exceptions(PyObject *plpy);
|
||||
static void PLy_generate_spi_exceptions(PyObject *mod, PyObject *base);
|
||||
|
||||
/* module functions */
|
||||
static PyObject *PLy_debug(PyObject *, PyObject *);
|
||||
static PyObject *PLy_log(PyObject *, PyObject *);
|
||||
static PyObject *PLy_info(PyObject *, PyObject *);
|
||||
static PyObject *PLy_notice(PyObject *, PyObject *);
|
||||
static PyObject *PLy_warning(PyObject *, PyObject *);
|
||||
static PyObject *PLy_error(PyObject *, PyObject *);
|
||||
static PyObject *PLy_fatal(PyObject *, PyObject *);
|
||||
static PyObject *PLy_quote_literal(PyObject *, PyObject *);
|
||||
static PyObject *PLy_quote_nullable(PyObject *, PyObject *);
|
||||
static PyObject *PLy_quote_ident(PyObject *, PyObject *);
|
||||
static PyObject *PLy_debug(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_log(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_info(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_notice(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_warning(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_error(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_fatal(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_quote_literal(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_quote_nullable(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_quote_ident(PyObject *self, PyObject *args);
|
||||
|
||||
|
||||
/* A list of all known exceptions, generated from backend/utils/errcodes.txt */
|
||||
|
@ -28,10 +28,10 @@ PLyProcedure *PLy_curr_procedure = NULL;
|
||||
static HTAB *PLy_procedure_cache = NULL;
|
||||
static HTAB *PLy_trigger_cache = NULL;
|
||||
|
||||
static PLyProcedure *PLy_procedure_create(HeapTuple, Oid, bool);
|
||||
static bool PLy_procedure_argument_valid(PLyTypeInfo *);
|
||||
static bool PLy_procedure_valid(PLyProcedure *, HeapTuple procTup);
|
||||
static char *PLy_procedure_munge_source(const char *, const char *);
|
||||
static PLyProcedure *PLy_procedure_create(HeapTuple procTup, Oid fn_oid, bool is_trigger);
|
||||
static bool PLy_procedure_argument_valid(PLyTypeInfo *arg);
|
||||
static bool PLy_procedure_valid(PLyProcedure *proc, HeapTuple procTup);
|
||||
static char *PLy_procedure_munge_source(const char *name, const char *src);
|
||||
|
||||
|
||||
void
|
||||
|
@ -40,10 +40,10 @@ typedef struct PLyProcedureEntry
|
||||
} PLyProcedureEntry;
|
||||
|
||||
/* PLyProcedure manipulation */
|
||||
extern char *PLy_procedure_name(PLyProcedure *);
|
||||
extern PLyProcedure *PLy_procedure_get(Oid, bool);
|
||||
extern void PLy_procedure_compile(PLyProcedure *, const char *);
|
||||
extern void PLy_procedure_delete(PLyProcedure *);
|
||||
extern char *PLy_procedure_name(PLyProcedure *proc);
|
||||
extern PLyProcedure *PLy_procedure_get(Oid fn_oid, bool is_trigger);
|
||||
extern void PLy_procedure_compile(PLyProcedure *proc, const char *src);
|
||||
extern void PLy_procedure_delete(PLyProcedure *proc);
|
||||
|
||||
|
||||
/* currently active plpython function */
|
||||
|
@ -11,14 +11,14 @@
|
||||
#include "plpy_resultobject.h"
|
||||
|
||||
|
||||
static void PLy_result_dealloc(PyObject *);
|
||||
static PyObject *PLy_result_nrows(PyObject *, PyObject *);
|
||||
static PyObject *PLy_result_status(PyObject *, PyObject *);
|
||||
static Py_ssize_t PLy_result_length(PyObject *);
|
||||
static PyObject *PLy_result_item(PyObject *, Py_ssize_t);
|
||||
static PyObject *PLy_result_slice(PyObject *, Py_ssize_t, Py_ssize_t);
|
||||
static int PLy_result_ass_item(PyObject *, Py_ssize_t, PyObject *);
|
||||
static int PLy_result_ass_slice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *);
|
||||
static void PLy_result_dealloc(PyObject *arg);
|
||||
static PyObject *PLy_result_nrows(PyObject *self, PyObject *args);
|
||||
static PyObject *PLy_result_status(PyObject *self, PyObject *args);
|
||||
static Py_ssize_t PLy_result_length(PyObject *arg);
|
||||
static PyObject *PLy_result_item(PyObject *arg, Py_ssize_t idx);
|
||||
static PyObject *PLy_result_slice(PyObject *arg, Py_ssize_t lidx, Py_ssize_t hidx);
|
||||
static int PLy_result_ass_item(PyObject *arg, Py_ssize_t idx, PyObject *item);
|
||||
static int PLy_result_ass_slice(PyObject *rg, Py_ssize_t lidx, Py_ssize_t hidx, PyObject *slice);
|
||||
|
||||
static char PLy_result_doc[] = {
|
||||
"Results of a PostgreSQL query"
|
||||
|
@ -24,10 +24,10 @@
|
||||
#include "plpy_resultobject.h"
|
||||
|
||||
|
||||
static PyObject *PLy_spi_execute_query(char *, long );
|
||||
static PyObject *PLy_spi_execute_plan(PyObject *, PyObject *, long);
|
||||
static PyObject *PLy_spi_execute_fetch_result(SPITupleTable *, int, int);
|
||||
static void PLy_spi_exception_set(PyObject *, ErrorData *);
|
||||
static PyObject *PLy_spi_execute_query(char *query, long limit);
|
||||
static PyObject *PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit);
|
||||
static PyObject *PLy_spi_execute_fetch_result(SPITupleTable *tuptable, int rows, int status);
|
||||
static void PLy_spi_exception_set(PyObject *excclass, ErrorData *edata);
|
||||
|
||||
|
||||
/* prepare(query="select * from foo")
|
||||
|
@ -8,8 +8,8 @@
|
||||
#include "utils/palloc.h"
|
||||
#include "utils/resowner.h"
|
||||
|
||||
extern PyObject *PLy_spi_prepare(PyObject *, PyObject *);
|
||||
extern PyObject *PLy_spi_execute(PyObject *, PyObject *);
|
||||
extern PyObject *PLy_spi_prepare(PyObject *self, PyObject *args);
|
||||
extern PyObject *PLy_spi_execute(PyObject *self, PyObject *args);
|
||||
|
||||
typedef struct PLyExceptionEntry
|
||||
{
|
||||
|
@ -19,9 +19,9 @@
|
||||
List *explicit_subtransactions = NIL;
|
||||
|
||||
|
||||
static void PLy_subtransaction_dealloc(PyObject *);
|
||||
static PyObject *PLy_subtransaction_enter(PyObject *, PyObject *);
|
||||
static PyObject *PLy_subtransaction_exit(PyObject *, PyObject *);
|
||||
static void PLy_subtransaction_dealloc(PyObject *subxact);
|
||||
static PyObject *PLy_subtransaction_enter(PyObject *self, PyObject *unused);
|
||||
static PyObject *PLy_subtransaction_exit(PyObject *self, PyObject *args);
|
||||
|
||||
static char PLy_subtransaction_doc[] = {
|
||||
"PostgreSQL subtransaction context manager"
|
||||
|
@ -24,6 +24,6 @@ typedef struct PLySubtransactionData
|
||||
} PLySubtransactionData;
|
||||
|
||||
extern void PLy_subtransaction_init_type(void);
|
||||
extern PyObject *PLy_subtransaction_new(PyObject *, PyObject *);
|
||||
extern PyObject *PLy_subtransaction_new(PyObject *self, PyObject *unused);
|
||||
|
||||
#endif /* PLPY_SUBXACTOBJECT */
|
||||
|
@ -26,35 +26,35 @@
|
||||
|
||||
|
||||
/* I/O function caching */
|
||||
static void PLy_input_datum_func2(PLyDatumToOb *, Oid, HeapTuple);
|
||||
static void PLy_output_datum_func2(PLyObToDatum *, HeapTuple);
|
||||
static void PLy_input_datum_func2(PLyDatumToOb *arg, Oid typeOid, HeapTuple typeTup);
|
||||
static void PLy_output_datum_func2(PLyObToDatum *arg, HeapTuple typeTup);
|
||||
|
||||
/* conversion from Datums to Python objects */
|
||||
static PyObject *PLyBool_FromBool(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyFloat_FromFloat4(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyFloat_FromFloat8(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyFloat_FromNumeric(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyInt_FromInt16(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyInt_FromInt32(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyLong_FromInt64(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyBytes_FromBytea(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyString_FromDatum(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyList_FromArray(PLyDatumToOb *, Datum);
|
||||
static PyObject *PLyBool_FromBool(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyFloat_FromFloat4(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyFloat_FromFloat8(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyFloat_FromNumeric(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyInt_FromInt16(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyInt_FromInt32(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyLong_FromInt64(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyBytes_FromBytea(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyString_FromDatum(PLyDatumToOb *arg, Datum d);
|
||||
static PyObject *PLyList_FromArray(PLyDatumToOb *arg, Datum d);
|
||||
|
||||
/* conversion from Python objects to Datums */
|
||||
static Datum PLyObject_ToBool(PLyObToDatum *, int32, PyObject *);
|
||||
static Datum PLyObject_ToBytea(PLyObToDatum *, int32, PyObject *);
|
||||
static Datum PLyObject_ToComposite(PLyObToDatum *, int32, PyObject *);
|
||||
static Datum PLyObject_ToDatum(PLyObToDatum *, int32, PyObject *);
|
||||
static Datum PLySequence_ToArray(PLyObToDatum *, int32, PyObject *);
|
||||
static Datum PLyObject_ToBool(PLyObToDatum *arg, int32 typmod, PyObject *plrv);
|
||||
static Datum PLyObject_ToBytea(PLyObToDatum *arg, int32 typmod, PyObject *plrv);
|
||||
static Datum PLyObject_ToComposite(PLyObToDatum *arg, int32 typmod, PyObject *plrv);
|
||||
static Datum PLyObject_ToDatum(PLyObToDatum *arg, int32 typmod, PyObject *plrv);
|
||||
static Datum PLySequence_ToArray(PLyObToDatum *arg, int32 typmod, PyObject *plrv);
|
||||
|
||||
/* conversion from Python objects to heap tuples (used by triggers and SRFs) */
|
||||
static HeapTuple PLyMapping_ToTuple(PLyTypeInfo *, TupleDesc, PyObject *);
|
||||
static HeapTuple PLySequence_ToTuple(PLyTypeInfo *, TupleDesc, PyObject *);
|
||||
static HeapTuple PLyGenericObject_ToTuple(PLyTypeInfo *, TupleDesc, PyObject *);
|
||||
static HeapTuple PLyMapping_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *mapping);
|
||||
static HeapTuple PLySequence_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *sequence);
|
||||
static HeapTuple PLyGenericObject_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *object);
|
||||
|
||||
/* make allocations in the TopMemoryContext */
|
||||
static void perm_fmgr_info(Oid, FmgrInfo *);
|
||||
static void perm_fmgr_info(Oid functionId, FmgrInfo *finfo);
|
||||
|
||||
void
|
||||
PLy_typeinfo_init(PLyTypeInfo *arg)
|
||||
|
@ -87,21 +87,21 @@ typedef struct PLyTypeInfo
|
||||
ItemPointerData typrel_tid;
|
||||
} PLyTypeInfo;
|
||||
|
||||
extern void PLy_typeinfo_init(PLyTypeInfo *);
|
||||
extern void PLy_typeinfo_dealloc(PLyTypeInfo *);
|
||||
extern void PLy_typeinfo_init(PLyTypeInfo *arg);
|
||||
extern void PLy_typeinfo_dealloc(PLyTypeInfo *arg);
|
||||
|
||||
extern void PLy_input_datum_func(PLyTypeInfo *, Oid, HeapTuple);
|
||||
extern void PLy_output_datum_func(PLyTypeInfo *, HeapTuple);
|
||||
extern void PLy_input_datum_func(PLyTypeInfo *arg, Oid typeOid, HeapTuple typeTup);
|
||||
extern void PLy_output_datum_func(PLyTypeInfo *arg, HeapTuple typeTup);
|
||||
|
||||
extern void PLy_input_tuple_funcs(PLyTypeInfo *, TupleDesc);
|
||||
extern void PLy_output_tuple_funcs(PLyTypeInfo *, TupleDesc);
|
||||
extern void PLy_input_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc);
|
||||
extern void PLy_output_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc);
|
||||
|
||||
extern void PLy_output_record_funcs(PLyTypeInfo *, TupleDesc);
|
||||
extern void PLy_output_record_funcs(PLyTypeInfo *arg, TupleDesc desc);
|
||||
|
||||
/* conversion from Python objects to heap tuples */
|
||||
extern HeapTuple PLyObject_ToTuple(PLyTypeInfo *, TupleDesc, PyObject *);
|
||||
extern HeapTuple PLyObject_ToTuple(PLyTypeInfo *info, TupleDesc desc, PyObject *plrv);
|
||||
|
||||
/* conversion from heap tuples to Python dictionaries */
|
||||
extern PyObject *PLyDict_FromTuple(PLyTypeInfo *, HeapTuple, TupleDesc);
|
||||
extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc);
|
||||
|
||||
#endif /* PLPY_TYPEIO_H */
|
||||
|
@ -6,10 +6,10 @@
|
||||
#ifndef PLPY_UTIL_H
|
||||
#define PLPY_UTIL_H
|
||||
|
||||
extern void *PLy_malloc(size_t);
|
||||
extern void *PLy_malloc0(size_t);
|
||||
extern char *PLy_strdup(const char *);
|
||||
extern void PLy_free(void *);
|
||||
extern void *PLy_malloc(size_t bytes);
|
||||
extern void *PLy_malloc0(size_t bytes);
|
||||
extern char *PLy_strdup(const char *str);
|
||||
extern void PLy_free(void *ptr);
|
||||
|
||||
extern PyObject *PLyUnicode_Bytes(PyObject *unicode);
|
||||
extern char *PLyUnicode_AsString(PyObject *unicode);
|
||||
|
Loading…
Reference in New Issue
Block a user