JDBC: One more autocommit use to work around - Mailing list pgsql-jdbc

From Fernando Nasser
Subject JDBC: One more autocommit use to work around
Date
Msg-id 3ED6111B.1080600@redhat.com
Whole thread Raw
Responses Re: JDBC: One more autocommit use to work around  (Barry Lind <blind@xythos.com>)
List pgsql-jdbc
Last night's patch to remove uses of autocommit missed this spot.

Note that here one cannot use the same strategy of ignoring the
existence of autocommit for 7.3 as it was done on the other cases as
someone may have configured their backend to start in SQL standard mode
(i.e., autocommit off).

--
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9
Index: org/postgresql/jdbc1/AbstractJdbc1Connection.java
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java,v
retrieving revision 1.19
diff -c -p -r1.19 AbstractJdbc1Connection.java
*** org/postgresql/jdbc1/AbstractJdbc1Connection.java    29 May 2003 03:21:32 -0000    1.19
--- org/postgresql/jdbc1/AbstractJdbc1Connection.java    29 May 2003 13:54:02 -0000
*************** public abstract class AbstractJdbc1Conne
*** 778,784 ****
          //We also set the client encoding so that the driver only needs
          //to deal with utf8.  We can only do this in 7.3 because multibyte
          //support is now always included
!         if (haveMinimumServerVersion("7.3"))
          {
              BaseResultSet acRset =
                  execSQL("set client_encoding = 'UNICODE'; show autocommit");
--- 778,784 ----
          //We also set the client encoding so that the driver only needs
          //to deal with utf8.  We can only do this in 7.3 because multibyte
          //support is now always included
!         if (haveMinimumServerVersion("7.3") && !haveMinimumServerVersion("7.4"))
          {
              BaseResultSet acRset =
                  execSQL("set client_encoding = 'UNICODE'; show autocommit");
*************** public abstract class AbstractJdbc1Conne
*** 798,803 ****
--- 798,813 ----
              {
                  execSQL("set autocommit = on; commit;");
              }
+         }
+         // On 7.4 there is no more backend autocommit, but we still need
+         // to set the client encoding.
+         else if (haveMinimumServerVersion("7.4"))
+         {
+             BaseResultSet acRset =
+                 execSQL("set client_encoding = 'UNICODE'");
+
+             //set encoding to be unicode
+             encoding = Encoding.getEncoding("UNICODE", null);
          }

          // Initialise object handling

pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: Newbie postgres/JDBC question.
Next
From: Barry Lind
Date:
Subject: Re: JDBC: One more autocommit use to work around