Re: Another patch - Mailing list pgsql-jdbc

From Bruce Momjian
Subject Re: Another patch
Date
Msg-id 200105161721.f4GHLWu18533@candle.pha.pa.us
Whole thread Raw
In response to Another patch  ("Dave Cramer" <Dave@micro-automation.net>)
List pgsql-jdbc
Patch applied and attached.  Thanks.

[ Charset ISO-8859-1 unsupported, converting... ]
> *** PreparedStatement.java.orig Wed May  9 07:17:37 2001
> --- PreparedStatement.java      Sat Apr 21 13:23:03 2001
> ***************
> *** 515,520 ****
> --- 515,524 ----
>          */
>         public void setObject(int parameterIndex, Object x, int
> targetSqlType, int scale) throws SQLException
>         {
> +               if (null == x){
> +                       setNull(parameterIndex,Types.OTHER);
> +                       return;
> +               }
>                 switch (targetSqlType)
>                 {
>                         case Types.TINYINT:
> ***************
> *** 566,571 ****
> --- 570,579 ----
>      */
>         public void setObject(int parameterIndex, Object x) throws
> SQLException
>         {
> +               if (null == x){
> +                       setNull(parameterIndex,Types.OTHER);
> +                       return;
> +               }
>                 if (x instanceof String)
>                         setString(parameterIndex, (String)x);
>                 else if (x instanceof BigDecimal)
>
> ----- Original Message -----
> From: "Bruce Momjian" <pgman@candle.pha.pa.us>
> To: "Dave Cramer" <Dave@micro-automation.net>
> Sent: Wednesday, May 09, 2001 10:17 AM
> Subject: Re: [JDBC] Another patch
>
>
> >
> > Sorry, sure.  diff -c.
> >
> >
> > [ Charset ISO-8859-1 unsupported, converting... ]
> > > Bruce,
> > >
> > > Sure, can you tell me how?
> > >
> > > --dc--
> > > ----- Original Message -----
> > > From: "Bruce Momjian" <pgman@candle.pha.pa.us>
> > > To: "Dave Cramer" <Dave@micro-automation.net>
> > > Sent: Wednesday, May 09, 2001 9:37 AM
> > > Subject: Re: [JDBC] Another patch
> > >
> > >
> > > >
> > > > Can you send a context diff?  Thanks.
> > > >
> > > > [ Charset ISO-8859-1 unsupported, converting... ]
> > > > > Hopefully we can slip this in before 7.1.1
> > > > >
> > > > > This patch fixes a bug which occurs when setObject(1,obj) is called
> and
> > > obj
> > > > > is of type Object, and is null
> > > > >
> > > > > Regards,
> > > > >
> > > > > Dave
> > > > >
> > > > > [root@ebox2 jdbc2]# diff PreparedStatement.java.orig
> > > PreparedStatement.java
> > > > > 517a518,521
> > > > > >               if (null == x){
> > > > > >                       setNull(parameterIndex,Types.OTHER);
> > > > > >                       return;
> > > > > >               }
> > > > > 568a573,576
> > > > > >               if (null == x){
> > > > > >                       setNull(parameterIndex,Types.OTHER);
> > > > > >                       return;
> > > > > >               }
> > > > >
> > > > >
> > > > >
> > > > > ---------------------------(end of
> broadcast)---------------------------
> > > > > TIP 5: Have you checked our extensive FAQ?
> > > > >
> > > > > http://www.postgresql.org/users-lounge/docs/faq.html
> > > > >
> > > >
> > > > --
> > > >   Bruce Momjian                        |  http://candle.pha.pa.us
> > > >   pgman@candle.pha.pa.us               |  (610) 853-3000
> > > >   +  If your life is a hard drive,     |  830 Blythe Avenue
> > > >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania
> 19026
> > > >
> > > >
> > >
> > >
> >
> > --
> >   Bruce Momjian                        |  http://candle.pha.pa.us
> >   pgman@candle.pha.pa.us               |  (610) 853-3000
> >   +  If your life is a hard drive,     |  830 Blythe Avenue
> >   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
> >
> >
>
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
Index: src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java,v
retrieving revision 1.5
diff -c -r1.5 PreparedStatement.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java    2001/01/24 23:41:04    1.5
--- src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java    2001/05/16 17:18:01
***************
*** 455,460 ****
--- 455,464 ----
       */
      public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
      {
+         if (x == null){
+             setNull(parameterIndex,Types.OTHER);
+             return;
+         }
          switch (targetSqlType)
          {
              case Types.TINYINT:
***************
*** 506,511 ****
--- 510,519 ----
     */
      public void setObject(int parameterIndex, Object x) throws SQLException
      {
+         if (x == null){
+             setNull(parameterIndex,Types.OTHER);
+             return;
+         }
          if (x instanceof String)
              setString(parameterIndex, (String)x);
          else if (x instanceof BigDecimal)
Index: src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java,v
retrieving revision 1.9
diff -c -r1.9 PreparedStatement.java
*** src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java    2001/02/16 16:45:00    1.9
--- src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java    2001/05/16 17:18:01
***************
*** 515,520 ****
--- 515,524 ----
       */
      public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException
      {
+         if (x == null){
+             setNull(parameterIndex,Types.OTHER);
+             return;
+         }
          switch (targetSqlType)
          {
              case Types.TINYINT:
***************
*** 566,571 ****
--- 570,579 ----
     */
      public void setObject(int parameterIndex, Object x) throws SQLException
      {
+         if (x == null){
+             setNull(parameterIndex,Types.OTHER);
+             return;
+         }
          if (x instanceof String)
              setString(parameterIndex, (String)x);
          else if (x instanceof BigDecimal)

pgsql-jdbc by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: getScale() and getPrecision() patch
Next
From: "Mark D. Apolinski"
Date:
Subject: Help: Postgresql/JDBC database access error