Re: Register arbitrary types Framework
| От | Kris Jurka |
|---|---|
| Тема | Re: Register arbitrary types Framework |
| Дата | |
| Msg-id | Pine.BSO.4.56.0403181209080.11134@leary.csoft.net обсуждение исходный текст |
| Ответ на | Re: Register arbitrary types Framework (Markus Schaber <schabios@logi-track.com>) |
| Ответы |
Re: Register arbitrary types Framework
|
| Список | 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
В списке pgsql-jdbc по дате отправления: