Eneboo - Documentación para desarrolladores
src/libpq/include/utils/typcache.h
Ir a la documentación de este archivo.
00001 /*-------------------------------------------------------------------------
00002  *
00003  * typcache.h
00004  *        Type cache definitions.
00005  *
00006  * The type cache exists to speed lookup of certain information about data
00007  * types that is not directly available from a type's pg_type row.
00008  *
00009  * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
00010  * Portions Copyright (c) 1994, Regents of the University of California
00011  *
00012  * $PostgreSQL: pgsql/src/include/utils/typcache.h,v 1.8.2.1 2005/11/22 18:23:29 momjian Exp $
00013  *
00014  *-------------------------------------------------------------------------
00015  */
00016 #ifndef TYPCACHE_H
00017 #define TYPCACHE_H
00018 
00019 #include "access/tupdesc.h"
00020 #include "fmgr.h"
00021 
00022 
00023 typedef struct TypeCacheEntry
00024 {
00025         /* typeId is the hash lookup key and MUST BE FIRST */
00026         Oid                     type_id;                /* OID of the data type */
00027 
00028         /* some subsidiary information copied from the pg_type row */
00029         int16           typlen;
00030         bool            typbyval;
00031         char            typalign;
00032         char            typtype;
00033         Oid                     typrelid;
00034 
00035         /*
00036          * Information obtained from opclass entries
00037          *
00038          * These will be InvalidOid if no match could be found, or if the
00039          * information hasn't yet been requested.
00040          */
00041         Oid                     btree_opc;              /* OID of the default btree opclass */
00042         Oid                     hash_opc;               /* OID of the default hash opclass */
00043         Oid                     eq_opr;                 /* OID of the equality operator */
00044         Oid                     lt_opr;                 /* OID of the less-than operator */
00045         Oid                     gt_opr;                 /* OID of the greater-than operator */
00046         Oid                     cmp_proc;               /* OID of the btree comparison function */
00047 
00048         /*
00049          * Pre-set-up fmgr call info for the equality operator and the btree
00050          * comparison function.  These are kept in the type cache to avoid
00051          * problems with memory leaks in repeated calls to array_eq and array_cmp.
00052          * There is not currently a need to maintain call info for the lt_opr or
00053          * gt_opr.
00054          */
00055         FmgrInfo        eq_opr_finfo;
00056         FmgrInfo        cmp_proc_finfo;
00057 
00058         /*
00059          * Tuple descriptor if it's a composite type (row type).  NULL if not
00060          * composite or information hasn't yet been requested.  (NOTE: this is
00061          * actually just a link to information maintained by relcache.c.)
00062          */
00063         TupleDesc       tupDesc;
00064 } TypeCacheEntry;
00065 
00066 /* Bit flags to indicate which fields a given caller needs to have set */
00067 #define TYPECACHE_EQ_OPR                        0x0001
00068 #define TYPECACHE_LT_OPR                        0x0002
00069 #define TYPECACHE_GT_OPR                        0x0004
00070 #define TYPECACHE_CMP_PROC                      0x0008
00071 #define TYPECACHE_EQ_OPR_FINFO          0x0010
00072 #define TYPECACHE_CMP_PROC_FINFO        0x0020
00073 #define TYPECACHE_TUPDESC                       0x0040
00074 
00075 extern TypeCacheEntry *lookup_type_cache(Oid type_id, int flags);
00076 
00077 extern TupleDesc lookup_rowtype_tupdesc(Oid type_id, int32 typmod);
00078 
00079 extern TupleDesc lookup_rowtype_tupdesc_noerror(Oid type_id, int32 typmod,
00080                                                            bool noError);
00081 
00082 extern void assign_record_type_typmod(TupleDesc tupDesc);
00083 
00084 extern void flush_rowtype_cache(Oid type_id);
00085 
00086 #endif   /* TYPCACHE_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'