Go to the documentation of this file.00001
00002
00003
00004
00005 #ifndef PLPY_TYPEIO_H
00006 #define PLPY_TYPEIO_H
00007
00008 #include "access/htup.h"
00009 #include "access/tupdesc.h"
00010 #include "fmgr.h"
00011 #include "storage/itemptr.h"
00012
00013 struct PLyDatumToOb;
00014 typedef PyObject *(*PLyDatumToObFunc) (struct PLyDatumToOb *, Datum);
00015
00016 typedef struct PLyDatumToOb
00017 {
00018 PLyDatumToObFunc func;
00019 FmgrInfo typfunc;
00020 Oid typoid;
00021 int32 typmod;
00022 Oid typioparam;
00023 bool typbyval;
00024 int16 typlen;
00025 char typalign;
00026 struct PLyDatumToOb *elm;
00027 } PLyDatumToOb;
00028
00029 typedef struct PLyTupleToOb
00030 {
00031 PLyDatumToOb *atts;
00032 int natts;
00033 } PLyTupleToOb;
00034
00035 typedef union PLyTypeInput
00036 {
00037 PLyDatumToOb d;
00038 PLyTupleToOb r;
00039 } PLyTypeInput;
00040
00041
00042
00043
00044 struct PLyObToDatum;
00045 typedef Datum (*PLyObToDatumFunc) (struct PLyObToDatum *, int32, PyObject *);
00046
00047 typedef struct PLyObToDatum
00048 {
00049 PLyObToDatumFunc func;
00050 FmgrInfo typfunc;
00051 Oid typoid;
00052 int32 typmod;
00053 Oid typioparam;
00054 bool typbyval;
00055 int16 typlen;
00056 char typalign;
00057 struct PLyObToDatum *elm;
00058 } PLyObToDatum;
00059
00060 typedef struct PLyObToTuple
00061 {
00062 PLyObToDatum *atts;
00063 int natts;
00064 } PLyObToTuple;
00065
00066 typedef union PLyTypeOutput
00067 {
00068 PLyObToDatum d;
00069 PLyObToTuple r;
00070 } PLyTypeOutput;
00071
00072
00073
00074
00075 typedef struct PLyTypeInfo
00076 {
00077 PLyTypeInput in;
00078 PLyTypeOutput out;
00079
00080
00081
00082
00083
00084 int is_rowtype;
00085
00086 Oid typ_relid;
00087 TransactionId typrel_xmin;
00088 ItemPointerData typrel_tid;
00089 } PLyTypeInfo;
00090
00091 extern void PLy_typeinfo_init(PLyTypeInfo *arg);
00092 extern void PLy_typeinfo_dealloc(PLyTypeInfo *arg);
00093
00094 extern void PLy_input_datum_func(PLyTypeInfo *arg, Oid typeOid, HeapTuple typeTup);
00095 extern void PLy_output_datum_func(PLyTypeInfo *arg, HeapTuple typeTup);
00096
00097 extern void PLy_input_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc);
00098 extern void PLy_output_tuple_funcs(PLyTypeInfo *arg, TupleDesc desc);
00099
00100 extern void PLy_output_record_funcs(PLyTypeInfo *arg, TupleDesc desc);
00101
00102
00103 extern Datum PLyObject_ToCompositeDatum(PLyTypeInfo *info, TupleDesc desc, PyObject *plrv);
00104
00105
00106 extern PyObject *PLyDict_FromTuple(PLyTypeInfo *info, HeapTuple tuple, TupleDesc desc);
00107
00108 #endif