Problem:
 - Boolean not on list of SQLKeywords (The JDBC CTS seems to think that
it should be)
 - setObject(x,y,Types.INTEGER) will throw exceptions if y is a Boolean.

Fix:
 - Added Boolean to Keywords list.
 - Added check in setObject() under Types.INTEGER to check if a boolean
is passed. True=1. False=0. Is consistent with the rest of the code.

Cheers,

Kim
Index: org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java
===================================================================
RCS file: /projects/cvsroot/pgsql-server/src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java,v
retrieving revision 1.22
diff -c -p -c -p -r1.22 AbstractJdbc1DatabaseMetaData.java
*** org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java	29 May 2003 04:39:49 -0000	1.22
--- org/postgresql/jdbc1/AbstractJdbc1DatabaseMetaData.java	17 Jun 2003 15:30:59 -0000
*************** public abstract class AbstractJdbc1Datab
*** 12,18 ****
  {
  
  	private static final String keywords = "abort,acl,add,aggregate,append,archive," +
! 										   "arch_store,backward,binary,change,cluster," +
  										   "copy,database,delimiter,delimiters,do,extend," +
  										   "explain,forward,heavy,index,inherits,isnull," +
  										   "light,listen,load,merge,nothing,notify," +
--- 12,18 ----
  {
  
  	private static final String keywords = "abort,acl,add,aggregate,append,archive," +
! 										   "arch_store,backward,binary,boolean,change,cluster," +
  										   "copy,database,delimiter,delimiters,do,extend," +
  										   "explain,forward,heavy,index,inherits,isnull," +
  										   "light,listen,load,merge,nothing,notify," +
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	17 Jun 2003 15:31:00 -0000
*************** public abstract class AbstractJdbc1State
*** 1462,1468 ****
  		switch (targetSqlType)
  		{
  			case Types.INTEGER:
! 				bind(parameterIndex, x.toString(), PG_INTEGER);
  				break;
  			case Types.TINYINT:
  			case Types.SMALLINT:
--- 1462,1471 ----
  		switch (targetSqlType)
  		{
  			case Types.INTEGER:
! 				if (x instanceof Boolean)
! 					bind(parameterIndex,((Boolean)x).booleanValue() ? "1" :"0", PG_BOOLEAN);
! 				else
! 					bind(parameterIndex, x.toString(), PG_INTEGER);
  				break;
  			case Types.TINYINT:
  			case Types.SMALLINT:
---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Reply via email to