From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Markus Schaber <schabios(at)logi-track(dot)com> |
Cc: | PostGreSQL JDBC <pgsql-jdbc(at)postgresql(dot)org> |
Subject: | Re: Register arbitrary types Framework |
Date: | 2004-03-18 17:16:13 |
Message-ID: | Pine.BSO.4.56.0403181209080.11134@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Thu, 18 Mar 2004, Markus Schaber wrote:
> > With getObject you can register the factory with a pg internal type
> > name that the driver knows, but with setObject you have nothing to
> > determine which (if any) factory to use other than the object itself.
> > You could work on some kind of reflection based scheme, but this is
> > certainly not symmetric with how getObject works.
>
> Every Object's class can be obtained with the getClass() method. So (as
> I weakly hinted in my original post) we can have a Map with the
> classes (or fully qualified class names) as keys, and the factories as
> values. Using a HashMap as Map, this allows us to find the factory in
> constant time (*).
>
> I also think that the current setObject(int, Object) using an 13-branch
> if(instanceof)-else construct could be sped up by this - of course, at
> the cost of creating the appropriate factory classes.
>
Well this cleanup is something I'm actually more interested in, my work on
adding COPY support to the driver has kind of stalled because I need the
ability to read/write internal data types and all of this knowledge is
contained in the Statement/ResultSet classes.
> (*) Of course, correct handling of subclasses is a little more tricky,
> but I already have some ideas on how to handle this problem. But
> as I don't want to overload this message, I'll outline them in another
> Followup.
Yes, this is an issue I hadn't considered and am interested to see your
reply.
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Jowett | 2004-03-18 21:19:58 | Re: Register arbitrary types Framework |
Previous Message | Waldomiro | 2004-03-18 15:10:37 | Select for Update |