diff options
Diffstat (limited to 'util.c')
| -rw-r--r-- | util.c | 43 |
1 files changed, 24 insertions, 19 deletions
@@ -15,30 +15,35 @@ #include "mb/pg_wchar.h" #include "utils/syscache.h" +/* + * getTypeInfo + * Retrieve information about a type, along with either its + * input, output, binary receive, or binary send procedure. + * + * which_func should be one of: + * IOFunc_input + * IOFunc_output + * IOFunc_receive + * IOFunc_send + * + * mcxt is the memory context the IO function selected will use to store + * subsidiary data. The memory context should live at least as long as + * the TypeInfo structure you specify. + */ void -initTypeInfo(TypeInfo *d, MemoryContext mcxt) +getTypeInfo(TypeInfo *d, Oid type, IOFuncSelector which_func, MemoryContext mcxt) { + d->type = type; + d->which_func = which_func; d->mcxt = mcxt; - d->not_set = true; -} -void -getTypeInfo(TypeInfo *d, Oid type, IOFuncSelector which_func) -{ - if (d->not_set || d->type != type || d->which_func != which_func) - { - get_type_io_data(type, which_func, - &d->typlen, &d->typbyval, &d->typalign, - &d->typdelim, &d->typioparam, &d->typiofunc); - fmgr_info_cxt(d->typiofunc, &d->proc, d->mcxt); + get_type_io_data(type, which_func, + &d->typlen, &d->typbyval, &d->typalign, + &d->typdelim, &d->typioparam, &d->typiofunc); + fmgr_info_cxt(d->typiofunc, &d->proc, d->mcxt); - get_type_category_preferred(type, - &d->typcategory, &d->typispreferred); - - d->type = type; - d->which_func = which_func; - d->not_set = false; - } + get_type_category_preferred(type, + &d->typcategory, &d->typispreferred); } Oid |
