1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
.TH "PQregisterUserDefinedTypes" 3 2011 "libpqtypes" "libpqtypes Manual"
.SH NAME
PQregisterUserDefinedTypes \- Registers a user-defined types.
.SH SYNOPSIS
.LP
\fB#include <libpqtypes.h>
.br
.sp
int PQregisterUserDefinedTypes(PGconn *\fIconn\fP, PGregisterType *\fItypes\fP,
.br
int \fIcount\fP);
\fP
.SH DEPRECATED
.LP
THIS FUNCTION IS DEPRECATED. New applications should use PQregisterTypes.
This function is now a wrapper to PQregisterTypes.
.SH DESCRIPTION
.LP
The \fIPQregisterUserDefinedTypes\fP() function allows an application
to register one or more user-defined types at runtime. User-defined types
are custom types in a backend that implement their own C procedures for
in/out/send/recv.
This function must execute a query against the backend to retrieve type
information for each user-defined type, thus this should not be called
from within a transaction. It is recommended to register multiple types at
the same time to avoid round trip overhead.
The \fItypes\fP argument is an array containing \fIcount\fP user-defined
types to register. If any type does not exist, the register
is aborted. Either typput and/or typget must be specified for each type
in the \fItypes\fP array.
NOTE: The typname member of the PGregisterType structure can optionally
contain the type's schema: schema.typname.
WARNING: \fIPQparamCreate\fP is only aware of types that have already been
registered. If you need to put a type into a param, make sure it is first
registered.
\fBUser-defined Types Registration\fP
.br
This example registers two user-defined types.
.nf
.RS
.LP
\fBPGregisterType types[] = {
{"graphics.rgb", rgb_put, rgb_get},
{"graphics.digon", digon_put, digon_get}
};
if (!PQregisterUserDefinedTypes(conn, types, 2))
fprintf(stderr, "PQregisterUserDefinedTypes: %s\\n", PQgeterror());
\fP
.RE
.fi
.SH RETURN VALUE
.LP
On success, a non-zero value is returned. On error, zero is
returned and \fIPQgeterror(3)\fP will contain an error message.
.SH EXAMPLES
.LP
None.
.SH AUTHOR
.LP
A contribution of eSilo, LLC. for the PostgreSQL Database Management System.
Written by Andrew Chernow and Merlin Moncure.
.SH REPORTING BUGS
.LP
Report bugs to <libpqtypes@esilo.com>.
.SH COPYRIGHT
.LP
Copyright (c) 2011 eSilo, LLC. All rights reserved.
.br
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.
.SH SEE ALSO
.LP
\fIpqt-handlers(3)\fP, \fIPQputf(3)\fP, \fIPQgetf(3)\fP
|