From: | "Jeroen Habets" <Jeroen(at)twofoldmedia(dot)com> |
---|---|
To: | <pgsql-patches(at)postgresql(dot)org> |
Subject: | Patch AbstractJdbc1Statement.setBoolean support BIT and INTEGER columns |
Date: | 2003-02-19 17:18:16 |
Message-ID: | LHEKIEALPFANFIKAIAPJCECFCLAA.Jeroen@twofoldmedia.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
I use SMALLINT columns for booleans for compatibility with other DB's.
However the JDBC driver does not support this.
It can be fixed simply by using '1' and '0' instead of 't' and 'f' in
AbstractJdbc1Statement.setBoolean(int parameterIndex, boolean x)
Actual patch:
cvs diff -wb -i AbstractJdbc1Statement.java (in directory
E:\cvswork\postgresql_jdbc\pgsql-server\src\interfaces\jdbc\org\postgresql\j
dbc1\)
Index: AbstractJdbc1Statement.java
===================================================================
RCS file:
/projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/Abst
ractJdbc1Statement.java,v
retrieving revision 1.17
diff -w -b -i -r1.17 AbstractJdbc1Statement.java
910c910
< bind(parameterIndex, x ? "'t'" : "'f'", PG_BOOLEAN);
---
> bind(parameterIndex, x ? "'1'" : "'0'", PG_BOOLEAN);Met
vriendelijke groet,
Column type test:
castor=> create table testje ( bitje bit, booltje boolean, smallintje int,
intje int );
CREATE TABLE
castor=> insert into testje (bitje, booltje, smallintje, intje) values ('0',
'0', '0', '0');
INSERT 1643931 1
castor=> insert into testje (bitje, booltje, smallintje, intje) values ('1',
'1', '1', '1');
INSERT 1643932 1
castor=> select * from testje;
bitje | booltje | smallintje | intje
-------+---------+------------+-------
0 | f | 0 | 0
1 | t | 1 | 1
(2 rows)
Jeroen Habets
Technology manager
Twofold Mediamarkt
Atlantic House
Westplein 2
3016 BL Rotterdam
The Netherlands
T: +31 (0)20 615 35 64
F: +31 (0)10 214 01 84
M: +31 (0)6 483 55 718
e-mail: jeroen(at)twofoldmedia(dot)com
website: http://www.twofoldmediamarkt.nl
Attachment | Content-Type | Size |
---|---|---|
Jeroen Habets.vcf | text/x-vcard | 476 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2003-02-19 20:45:00 | Re: implement query_start for pg_stat_activity |
Previous Message | Matthew T. O'Connor | 2003-02-19 16:06:30 | Re: pg_avd |