diff options
author | Peter Eisentraut | 2011-12-18 19:14:16 +0000 |
---|---|---|
committer | Peter Eisentraut | 2011-12-18 19:24:00 +0000 |
commit | 147c2482542868d1f9dcf7d2ecfeac58d845335c (patch) | |
tree | 11617370d58bfc7ff6cca2b5b78212dd804a1147 /src/pl/plpython/plpy_procedure.h | |
parent | 59e242a4969d2efa6ce68dc7aab3cbd8cf975b08 (diff) |
Split plpython.c into smaller pieces
This moves the code around from one huge file into hopefully logical
and more manageable modules. For the most part, the code itself was
not touched, except: PLy_function_handler and PLy_trigger_handler were
renamed to PLy_exec_function and PLy_exec_trigger, because they were
not actually handlers in the PL handler sense, and it makes the naming
more similar to the way PL/pgSQL is organized. The initialization of
the procedure caches was separated into a new function
init_procedure_caches to keep the hash tables private to
plpy_procedures.c.
Jan UrbaĆski and Peter Eisentraut
Diffstat (limited to 'src/pl/plpython/plpy_procedure.h')
-rw-r--r-- | src/pl/plpython/plpy_procedure.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/pl/plpython/plpy_procedure.h b/src/pl/plpython/plpy_procedure.h new file mode 100644 index 00000000000..632b975cc19 --- /dev/null +++ b/src/pl/plpython/plpy_procedure.h @@ -0,0 +1,52 @@ +/* + * src/pl/plpython/plpy_procedure.h + */ + +#ifndef PLPY_PROCEDURE_H +#define PLPY_PROCEDURE_H + +#include "plpy_typeio.h" + + +extern void init_procedure_caches(void); + + +/* cached procedure data */ +typedef struct PLyProcedure +{ + char *proname; /* SQL name of procedure */ + char *pyname; /* Python name of procedure */ + TransactionId fn_xmin; + ItemPointerData fn_tid; + bool fn_readonly; + PLyTypeInfo result; /* also used to store info for trigger tuple + * type */ + bool is_setof; /* true, if procedure returns result set */ + PyObject *setof; /* contents of result set. */ + char *src; /* textual procedure code, after mangling */ + char **argnames; /* Argument names */ + PLyTypeInfo args[FUNC_MAX_ARGS]; + int nargs; + PyObject *code; /* compiled procedure code */ + PyObject *statics; /* data saved across calls, local scope */ + PyObject *globals; /* data saved across calls, global scope */ +} PLyProcedure; + +/* the procedure cache entry */ +typedef struct PLyProcedureEntry +{ + Oid fn_oid; /* hash key */ + PLyProcedure *proc; +} 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 *); + + +/* currently active plpython function */ +extern PLyProcedure *PLy_curr_procedure; + +#endif /* PLPY_PROCEDURE_H */ |