table of contents
PQregisterUserDefinedTypes(3) | libpqtypes Manual | PQregisterUserDefinedTypes(3) |
NAME¶
PQregisterUserDefinedTypes - Registers a user-defined types.SYNOPSIS¶
#include <libpqtypes.h>int PQregisterUserDefinedTypes(PGconn *conn, PGregisterType *types, int count);
DEPRECATED¶
THIS FUNCTION IS DEPRECATED. New applications should use PQregisterTypes. This function is now a wrapper to PQregisterTypes.DESCRIPTION¶
The PQregisterUserDefinedTypes() 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 types argument is an array containing count 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 types array.
NOTE: The typname member of the PGregisterType structure can optionally contain the type's schema: schema.typname.
WARNING: PQparamCreate 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.
User-defined Types Registration
This example registers two user-defined types.
PGregisterType types[] = { {"graphics.rgb", rgb_put, rgb_get}, {"graphics.digon", digon_put, digon_get} }; if (!PQregisterUserDefinedTypes(conn, types, 2)) fprintf(stderr, "PQregisterUserDefinedTypes: %s\n", PQgeterror());
RETURN VALUE¶
On success, a non-zero value is returned. On error, zero is returned and PQgeterror(3) will contain an error message.EXAMPLES¶
None.AUTHOR¶
A contribution of eSilo, LLC. for the PostgreSQL Database Management System. Written by Andrew Chernow and Merlin Moncure.REPORTING BUGS¶
Report bugs to <libpqtypes@esilo.com>.COPYRIGHT¶
Copyright (c) 2011 eSilo, LLC. All rights reserved.This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
SEE ALSO¶
pqt-handlers(3), PQputf(3), PQgetf(3)2011 | libpqtypes |