Re: Problem with PGStatement.getLastOID()

Поиск
Список
Период
Сортировка
От ListMan
Тема Re: Problem with PGStatement.getLastOID()
Дата
Msg-id 6.0.1.1.0.20031203164536.01cefad0@mail.cybermaccara.com
обсуждение исходный текст
Ответ на Problem with PGStatement.getLastOID()  (ListMan <listman@cybermaccara.com>)
Список pgsql-jdbc
At 06:22 2.12.2003, Oliver Jowett wrote:
>If you do discover what triggers this behaviour, let me know & maybe we can
>find a workaround.

Well, I asked a former colleague who has some experience fixing early
pgsql7.3 jdbc problems. He suggested to check if there is a proxy
implementation introduced for statements.

I found that the following patch seems to fix the ClassCastException.

The reason this didn't exhibit itself with 7.3 drivers is because proxy
instances were not implemented (or so I was told, didn't check the 7.3
sources myself ;) for statements, only for connections (and they had
similar problems in the beginning).

I briefly tested my changes and it fixed the problem we had. Didn't raise
any immediate new problems either. (my test did only test createStatement case)

Maybe you might like to review the patch and possibly commit the results to
CVS?

B Rgds,
Jari Paljakka

diff -c -r1.7 PooledConnectionImpl.java
*** org/postgresql/jdbc2/optional/PooledConnectionImpl.java     25 Mar 2003
02:46:23 -0000      1.7
--- org/postgresql/jdbc2/optional/PooledConnectionImpl.java     3 Dec 2003
14:44:22 -0000
***************
*** 266,282 ****
               else if(method.getName().equals("createStatement"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{Statement.class}, new StatementHandler(this, st));
               }
               else if(method.getName().equals("prepareCall"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{CallableStatement.class}, new StatementHandler(this, st));
               }
               else if(method.getName().equals("prepareStatement"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{PreparedStatement.class}, new StatementHandler(this, st));
               }
                         else
                         {
--- 266,282 ----
               else if(method.getName().equals("createStatement"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{Statement.class, org.postgresql.PGStatement.class}, new
StatementHandler(this, st));
               }
               else if(method.getName().equals("prepareCall"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{CallableStatement.class, org.postgresql.PGStatement.class}, new
StatementHandler(this, st));
               }
               else if(method.getName().equals("prepareStatement"))
               {
                   Statement st = (Statement)method.invoke(con, args);
!                 return
Proxy.newProxyInstance(getClass().getClassLoader(), new
Class[]{PreparedStatement.class, org.postgresql.PGStatement.class}, new
StatementHandler(this, st));
               }
                         else
                         {


В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Dave Cramer
Дата:
Сообщение: Re: string character corruption problem and broken
Следующее
От: "CRAIG GOLBY"
Дата:
Сообщение: RecordSets