Oops. Forgot to attach it last time.
On Mon, 2003-06-30 at 12:44, Barry Lind wrote:
> Kim,
>
> Are you going to be submitting a patch for this?
>
> thanks,
> --Barry
>
>
> Kim Ho wrote:
> > On Wed, 2003-06-18 at 13:09, Kim Ho wrote:
> >
> >>Problem:
> >> - setObject(x,y,Types.BIT) throws an exception if y is a Number
> >> - getObject() on a bit column will return null instead of True or False
> >>Boolean objects
> >>
> >
> > Added Problem:
> > - Doesn't set bit columns
> >
> >
> >>Fix:
> >> - Added check in setObject() to check to that the Number has value==1.
> >>If so, set to True. False otherwise. This seems to be consistent with
> >>the rest of the code.
> >> - Added BIT to JDBC datatype list
> >
> > - Using way to set values in both boolean/bit type columns
> >
> > It works now.
> >
> > The following program works now:
> >
> > Statement stmt = con.createStatement();
> > stmt.execute("Create Table bit_tab (b bit)");
> >
> > PreparedStatement pstmt = con.prepareStatement("insert into bit_tab
> > values (?)");
> > pstmt.setBoolean(1,true);
> > pstmt.execute();
> >
> > Sorry bout the delay.
> >
> > Cheers,
> >
> > Kim
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
> >
>
>
? cloudscape.LOG
Index: org/postgresql/jdbc1/AbstractJdbc1Connection.java
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java,v
retrieving revision 1.20
diff -c -p -c -p -r1.20 AbstractJdbc1Connection.java
*** org/postgresql/jdbc1/AbstractJdbc1Connection.java 29 May 2003 21:44:47 -0000
1.20
--- org/postgresql/jdbc1/AbstractJdbc1Connection.java 30 Jun 2003 13:07:38 -0000
*************** public abstract class AbstractJdbc1Conne
*** 1740,1745 ****
--- 1740,1746 ----
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz"
*************** public abstract class AbstractJdbc1Conne
*** 1763,1768 ****
--- 1764,1770 ----
Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
+ Types.BIT,
Types.BIT,
Types.DATE,
Types.TIME,
Index: org/postgresql/jdbc1/AbstractJdbc1Statement.java
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Statement.java,v
retrieving revision 1.24
diff -c -p -c -p -r1.24 AbstractJdbc1Statement.java
*** org/postgresql/jdbc1/AbstractJdbc1Statement.java 29 May 2003 04:52:44 -0000
1.24
--- org/postgresql/jdbc1/AbstractJdbc1Statement.java 30 Jun 2003 13:07:39 -0000
*************** public abstract class AbstractJdbc1State
*** 905,911 ****
*/
public void setBoolean(int parameterIndex, boolean x) throws SQLException
{
! bind(parameterIndex, x ? "'t'" : "'f'", PG_BOOLEAN);
}
/*
--- 905,911 ----
*/
public void setBoolean(int parameterIndex, boolean x) throws SQLException
{
! bind(parameterIndex, x ? "'1'" : "'0'", PG_BOOLEAN);
}
/*
*************** public abstract class AbstractJdbc1State
*** 1492,1500 ****
setTimestamp(parameterIndex, (Timestamp)x);
break;
case Types.BIT:
if (x instanceof Boolean)
{
! bind(parameterIndex,
((Boolean)x).booleanValue() ? "TRUE" : "FALSE", PG_TEXT);
}
else
{
--- 1492,1509 ----
setTimestamp(parameterIndex, (Timestamp)x);
break;
case Types.BIT:
+ case Types.BOOLEAN:
if (x instanceof Boolean)
{
! bind(parameterIndex,
((Boolean)x).booleanValue() ? "'1'" : "'0'", PG_TEXT);
! }
! else if (x instanceof String)
! {
! bind(parameterIndex,
Boolean.valueOf(x.toString()).booleanValue() ? "'1'" : "'0'", PG_BOOLEAN);
! }
! else if (x instanceof Number)
! {
! bind(parameterIndex, ((Number)x).intValue()==1
? "'1'" : "'0'", PG_TEXT);
}
else
{
Index: org/postgresql/jdbc2/AbstractJdbc2Connection.java
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc2/AbstractJdbc2Connection.java,v
retrieving revision 1.5
diff -c -p -c -p -r1.5 AbstractJdbc2Connection.java
*** org/postgresql/jdbc2/AbstractJdbc2Connection.java 29 May 2003 04:39:48 -0000
1.5
--- org/postgresql/jdbc2/AbstractJdbc2Connection.java 30 Jun 2003 13:07:39 -0000
*************** public abstract class AbstractJdbc2Conne
*** 126,131 ****
--- 126,132 ----
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz",
*************** public abstract class AbstractJdbc2Conne
*** 153,158 ****
--- 154,160 ----
Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
+
Types.BIT,
Types.BIT,
Types.DATE,
Types.TIME,
Index: org/postgresql/jdbc3/AbstractJdbc3Connection.java
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc3/AbstractJdbc3Connection.java,v
retrieving revision 1.3
diff -c -p -c -p -r1.3 AbstractJdbc3Connection.java
*** org/postgresql/jdbc3/AbstractJdbc3Connection.java 7 May 2003 03:03:30 -0000
1.3
--- org/postgresql/jdbc3/AbstractJdbc3Connection.java 30 Jun 2003 13:07:39 -0000
*************** public abstract class AbstractJdbc3Conne
*** 415,420 ****
--- 415,421 ----
"varchar", "text", "name", "filename",
"bytea",
"bool",
+ "bit",
"date",
"time",
"abstime", "timestamp", "timestamptz",
*************** public abstract class AbstractJdbc3Conne
*** 442,447 ****
--- 443,449 ----
Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR, Types.CHAR,
Types.CHAR,
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
Types.BINARY,
+ Types.BIT,
Types.BIT,
Types.DATE,
Types.TIME,
---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?
http://www.postgresql.org/docs/faqs/FAQ.html