Patch attached and applied.

-- Start of PGP signed section.
> Folks-
> 
>   Got two patches that were found by folks on the Castor list, that we'd like to
> submit.  These were done for the jdbc2 driver.  The first one is for support
> of the Types.BIT in the PreparedStatement class.  The following lines need to be
> inserted in the switch statment, at around line 530:
> 
> 
> (Prepared statment, line 554, before the default: switch
> case Types.BIT:
>      if (x instanceof Boolean) {
>           set(parameterIndex, ((Boolean)x).booleanValue() ? "TRUE" : "FALSE");
>      } else {
>           throw new PSQLException("postgresql.prep.type");
>      }
>      break;
> 
> 
> The second one is dealing with blobs, 
> 
> inserted in PreparedStatemant.java (After previous patch line, 558):
>          case Types.BINARY:
>          case Types.VARBINARY:
>                               setObject(parameterIndex,x);
>                               break;
> and in ResultSet.java (Around line 857):
>         case Types.BINARY:
>         case Types.VARBINARY:
>                         return getBytes(columnIndex);
> 
> 
> 
> Virtually, 
> Ned Wolpert <[EMAIL PROTECTED]>
> 
> D08C2F45:  28E7 56CB 58AC C622 5A51  3C42 8B2B 2739 D08C 2F45 
-- End of PGP signed section.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  [EMAIL PROTECTED]               |  (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.6
diff -c -r1.6 PreparedStatement.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java     2001/05/16 
17:22:25     1.6
--- src/interfaces/jdbc/org/postgresql/jdbc1/PreparedStatement.java     2001/06/11 
21:53:37
***************
*** 489,494 ****
--- 489,505 ----
                        case Types.TIMESTAMP:
                                setTimestamp(parameterIndex, (Timestamp)x);
                                break;
+                       case Types.BIT:
+                               if (x instanceof Boolean) {
+                                       set(parameterIndex, 
+((Boolean)x).booleanValue() ? "TRUE" : "FALSE");
+                               } else {
+                                       throw new 
+PSQLException("postgresql.prep.type");
+                               }
+                               break;
+                       case Types.BINARY:
+                       case Types.VARBINARY:
+                               setObject(parameterIndex,x);
+                               break;
                        case Types.OTHER:
                                setString(parameterIndex, ((PGobject)x).getValue());
                                break;
Index: src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java
===================================================================
RCS file: 
/home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java,v
retrieving revision 1.14
diff -c -r1.14 ResultSet.java
*** src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java     2001/05/28 00:36:59    
 1.14
--- src/interfaces/jdbc/org/postgresql/jdbc1/ResultSet.java     2001/06/11 21:53:37
***************
*** 806,811 ****
--- 806,814 ----
        return getTime(columnIndex);
        case Types.TIMESTAMP:
        return getTimestamp(columnIndex);
+       case Types.BINARY:
+       case Types.VARBINARY:
+       return getBytes(columnIndex);   
        default:
        return connection.getObject(field.getTypeName(), getString(columnIndex));
        }
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.10
diff -c -r1.10 PreparedStatement.java
*** src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java     2001/05/16 
17:22:25     1.10
--- src/interfaces/jdbc/org/postgresql/jdbc2/PreparedStatement.java     2001/06/11 
21:53:38
***************
*** 549,554 ****
--- 549,565 ----
                        case Types.TIMESTAMP:
                                setTimestamp(parameterIndex, (Timestamp)x);
                                break;
+                       case Types.BIT:
+                               if (x instanceof Boolean) {
+                                       set(parameterIndex, 
+((Boolean)x).booleanValue() ? "TRUE" : "FALSE");
+                               } else {
+                                       throw new 
+PSQLException("postgresql.prep.type");
+                               }
+                               break;
+                       case Types.BINARY:
+                       case Types.VARBINARY:
+                               setObject(parameterIndex,x);
+                               break;
                        case Types.OTHER:
                                setString(parameterIndex, ((PGobject)x).getValue());
                                break;
Index: src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java
===================================================================
RCS file: 
/home/projects/pgsql/cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java,v
retrieving revision 1.26
diff -c -r1.26 ResultSet.java
*** src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java     2001/05/30 16:34:49    
 1.26
--- src/interfaces/jdbc/org/postgresql/jdbc2/ResultSet.java     2001/06/11 21:53:39
***************
*** 855,860 ****
--- 855,863 ----
        return getTime(columnIndex);
        case Types.TIMESTAMP:
        return getTimestamp(columnIndex);
+       case Types.BINARY:
+       case Types.VARBINARY:
+       return getBytes(columnIndex);   
        default:
        return connection.getObject(field.getTypeName(), getString(columnIndex));
        }

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to