Register arbitrary types Framework - Mailing list pgsql-jdbc

From Markus Schaber
Subject Register arbitrary types Framework
Date
Msg-id 20040310174958.0cefc23d@kingfisher.intern.logi-track.com
Whole thread Raw
Responses Re: Register arbitrary types Framework
List pgsql-jdbc
Hello @all,

I don't know whether this List is the correct place to ask this, and so
I added an similar Feature Request to the gborg project:
http://gborg.postgresql.org/project/pgjdbc/bugs/bugupdate.php?709


For my project, I need to register third-party classes as postgres
classes, (specifically, I want JTS objects to be directly created when
calling getObject(int)) and it is not eligible to patch those
third-party classes.

However, the current user-type register system only allows subtypes of
PGObject to be registered. I have two Ideas on how to change this,
whereas I would prefer the second one, and am willing to write and
provide patches for both of them if they are to be accepted:

- When a registered object is no subclass of PGObject, use the
constructor that uses a single String as arguments for reading and
toString() for writing.

- Allow instances of a factory Interface to be registered to the
PostGreSQL connection. Then, when reading this type, a creator function
of the factory is called, and when writing, we can use a map to find the
factory from the object's class.

At least the second solution would also allow cleaning up of the PostGIS
jdbc drivers as they now use a PGGeometry class that acts as a pure
Wrapper function, and the user has to call getGeometry() on the received
PGGeometry to get the real Geometry.



Thanks for your patience,

Markus
--
markus schaber | dipl. informatiker
logi-track ag | rennweg 14-16 | ch 8001 zürich
phone +41-43-888 62 52 | fax +41-43-888 62 53
mailto:schabios@logi-track.com | www.logi-track.com

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Backup of users and groups?
Next
From: Dave Cramer
Date:
Subject: Re: Backup of users and groups?