00001 /* 00002 * src/pl/plpython/plpy_procedure.h 00003 */ 00004 00005 #ifndef PLPY_PROCEDURE_H 00006 #define PLPY_PROCEDURE_H 00007 00008 #include "plpy_typeio.h" 00009 00010 00011 extern void init_procedure_caches(void); 00012 00013 00014 /* cached procedure data */ 00015 typedef struct PLyProcedure 00016 { 00017 char *proname; /* SQL name of procedure */ 00018 char *pyname; /* Python name of procedure */ 00019 TransactionId fn_xmin; 00020 ItemPointerData fn_tid; 00021 bool fn_readonly; 00022 PLyTypeInfo result; /* also used to store info for trigger tuple 00023 * type */ 00024 bool is_setof; /* true, if procedure returns result set */ 00025 PyObject *setof; /* contents of result set. */ 00026 char *src; /* textual procedure code, after mangling */ 00027 char **argnames; /* Argument names */ 00028 PLyTypeInfo args[FUNC_MAX_ARGS]; 00029 int nargs; 00030 PyObject *code; /* compiled procedure code */ 00031 PyObject *statics; /* data saved across calls, local scope */ 00032 PyObject *globals; /* data saved across calls, global scope */ 00033 } PLyProcedure; 00034 00035 /* the procedure cache key */ 00036 typedef struct PLyProcedureKey 00037 { 00038 Oid fn_oid; /* function OID */ 00039 Oid fn_rel; /* triggered-on relation or InvalidOid */ 00040 } PLyProcedureKey; 00041 00042 /* the procedure cache entry */ 00043 typedef struct PLyProcedureEntry 00044 { 00045 PLyProcedureKey key; /* hash key */ 00046 PLyProcedure *proc; 00047 } PLyProcedureEntry; 00048 00049 /* PLyProcedure manipulation */ 00050 extern char *PLy_procedure_name(PLyProcedure *proc); 00051 extern PLyProcedure *PLy_procedure_get(Oid fn_oid, Oid fn_rel, bool is_trigger); 00052 extern void PLy_procedure_compile(PLyProcedure *proc, const char *src); 00053 extern void PLy_procedure_delete(PLyProcedure *proc); 00054 00055 #endif /* PLPY_PROCEDURE_H */