Allow setObject(x,y,Types.BIT) if y is a Number & getObject() on bit columns

Lists: pgsql-jdbcpgsql-patches
From: Kim Ho <kho(at)redhat(dot)com>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>
Subject: Allow setObject(x,y,Types.BIT) if y is a Number & getObject() on bit columns
Date: 2003-06-18 17:09:12
Message-ID: 1055956152.13900.31.camel@topanga.toronto.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

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

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

Cheers,

Kim

Attachment Content-Type Size
fixbits.diff text/x-patch 4.0 KB

From: Kim Ho <kho(at)redhat(dot)com>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Cc: pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, Darin Ohashi <DOhashi(at)maplesoft(dot)com>, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Date: 2003-06-27 22:28:27
Message-ID: 1056752907.5081.29.camel@cpe000475c4cd62-cm013279901416.cpe.net.cable.rogers.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

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


From: Barry Lind <blind(at)xythos(dot)com>
To: kho(at)redhat(dot)com
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, Darin Ohashi <DOhashi(at)maplesoft(dot)com>, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Date: 2003-06-30 16:44:16
Message-ID: 3F0068E0.9070704@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

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
>


From: Kim Ho <kho(at)redhat(dot)com>
To: Barry Lind <blind(at)xythos(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>, pgsql-jdbc-list <pgsql-jdbc(at)postgresql(dot)org>, Darin Ohashi <DOhashi(at)maplesoft(dot)com>, Fernando Nasser <fnasser(at)redhat(dot)com>
Subject: Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Date: 2003-06-30 16:56:56
Message-ID: 1056992216.1022.0.camel@topanga.toronto.redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

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
> >
>
>

Attachment Content-Type Size
fixbits.diff text/plain 4.9 KB

From: Dave Cramer <Dave(at)micro-automation(dot)net>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Allow setObject(x,y,Types.BIT) if y is a Number &
Date: 2003-06-30 21:09:46
Message-ID: 1057007386.3272.95.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-jdbc pgsql-patches

Patch applied,

thanks,
Dave
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
>
> 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
>
>
> Cheers,
>
> Kim
>
> ______________________________________________________________________
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
--
Dave Cramer <Dave(at)micro-automation(dot)net>