X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id C01DC52970 for ; Wed, 29 Jun 2005 11:57:53 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 79825-06 for ; Wed, 29 Jun 2005 14:57:47 +0000 (GMT) Received: from net2.micro-automation.com (net2.micro-automation.com [64.7.141.29]) by svr1.postgresql.org (Postfix) with SMTP id 0D80452801 for ; Wed, 29 Jun 2005 11:57:45 -0300 (ADT) Received: (qmail 19708 invoked from network); 29 Jun 2005 14:55:51 -0000 Received: from dcdsl.ebox.com (HELO ?192.168.1.2?) (64.7.143.116) by net2.micro-automation.com with SMTP; 29 Jun 2005 14:55:51 -0000 In-Reply-To: <1F04D083-97E3-4C00-8806-B107991AE27E@fastcrypt.com> References: <688EEEFD-78B1-4C09-8CE8-E17520725AA2@fastcrypt.com> <42C29F6D.4060001@opencloud.com> <1F04D083-97E3-4C00-8806-B107991AE27E@fastcrypt.com> Mime-Version: 1.0 (Apple Message framework v730) Content-Type: multipart/alternative; boundary=Apple-Mail-21-15948022 Message-Id: <27012342-159F-4F96-837C-82BB7F666DB2@fastcrypt.com> Cc: Oliver Jowett , List From: Dave Cramer Subject: Re: jdbc cts final diff for review Date: Wed, 29 Jun 2005 10:57:48 -0400 To: Dave Cramer X-Mailer: Apple Mail (2.730) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, HTML_60_70, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200506/163 X-Sequence-Number: 13125 --Apple-Mail-21-15948022 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Oliver regarding the real/double muck below They have a "real table" which ostensibly holds REAL values, however one test does the following takes the max value from the int_table which is a large integer, then stores it into the 'REAL' table and then reads it back as an integer this was failing due to precision issues until I change the underlying type of the REAL table to FLOAT8 (which is what Oracle, and Mysql do ) then they have another test which registers an out parameter as a REAL and reads from the 'REAL_TABLE' which is now uses the underlying type double if someone else can find a way to get this to pass, I'm all ears. Dave On 29-Jun-05, at 10:28 AM, Dave Cramer wrote: > > On 29-Jun-05, at 9:17 AM, Oliver Jowett wrote: > >> Dave Cramer wrote: >> >>> Attached is the patch for review. QueryExecutor is unchanged now. >>> The only iffy bit is where I check for the in parameter being >>> bound to void type. It could be done in checkAllParametersSet >>> I'd like to commit this shortly. >>> >> >> Ok, comments from just reading the patch.. I like the approach >> much better than the previous one, but the details need some cleanup. >> >> Rather than putting knowledge of parameter direction into >> ParameterList, how about just allowing access to the type OID, and >> the caller checks for Oid.VOID? Then the ParameterList interface >> changes less and the change to use a Parameter class is >> unnecessary as the list doesn't need to store a direction value. >> >> If you must store a direction value in the list, then another >> array might be better than wrapping everything up in an object >> (generates less garbage overall). Also, there are a few places >> that return magic values for the direction that should be using >> the symbolic constants you've defined elsewhere. > I thought of this, however even arrays have to be garbage > collected.. Is there really much difference internally between new > Parameter and new int? > > I'm ambivalent though it's not a big change either way. >> >> The change to checkAllParametersSet to not check OUT parameters >> seems unnecessary -- won't OUT parameters be set to the (non-null) >> NULL_OBJECT anyway? >> >> >>> ! // this is here for the sole purpose of >>> passing the cts >>> ! if ( columnType == Types.DOUBLE && >>> functionReturnType[i] == Types.REAL ) >>> ! { >>> ! // return it as a float >>> ! if ( callResult[i] != null) >>> ! callResult[i] = new Float(((Double) >>> callResult[i]).floatValue()); >>> ! } > > I'll go through my notes, but I can tell you it was a catch 22 > problem mostly likely an artifact of Oracle not having a REAL type. >> We can't do that! If it's failing that's probably because we're >> not doing the necessary implicit typecasts required by the spec.. >> >> Please explain what's going on here: > > from an SQL point of view FLOAT, and double are FLOAT8 types, REAL > is the only one that is FLOAT4 >> >> >>> + case Types.FLOAT: // TODO: FLOAT and >>> REAL were FLOAT8 for the cts >>> >> >> >>> public void setFloat(int parameterIndex, float x) throws >>> SQLException >>> { >>> checkClosed(); >>> ! bindLiteral(parameterIndex, Float.toString(x), >>> Oid.FLOAT8); >>> } >>> >>> >> >> (the bind changed from Oid.FLOAT4 to Oid.FLOAT8..) >> >> You seem to have reverted your earlier changes and put back the >> types/* classes -- why? > huh ? they should be in there in HEAD, I did remove the creation of > an object, and went to static methods >> >> adjustParamIndex() should be removed entirely if it's now always a >> no-op. > yeah >> >> Why is type translation for JDBC2 types only done in the JDBC3 >> code (in registerOutParameter)? -- shouldn't that be in the JDBC2 >> code? >> > Good point >> There are a bunch of gratuitous changes to the test code that >> probably shouldn't be committed, e.g. in BatchExecuteTest: >> > agreed, they are for my own testing >> >>> + try >>> + { >>> + Class.forName("org.postgresql.Driver"); >>> + } >>> + catch( Exception ex){} >>> >> >> similarly in many other test classes. >> >> .... >> >> It might be an idea to break this up into "support new-style OUT >> parameters" and "other fixes necessary to pass the CTS" as >> currently it's quite unclear which is which.. > Well, they are all related OUT parameters are required to support > the CTS >> >> -O >> >> > --Apple-Mail-21-15948022 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=ISO-8859-1 Oliver

regarding the real/double = muck below

They= have a "real table" which ostensibly holds REAL values, = however

one = test does the following

takes the max value from = the int_table which is a large integer, then stores it into the 'REAL' = table and then reads it back as an integer=A0

this was failing due to=A0 = precision issues until I change the underlying type of the REAL table to = FLOAT8 (which is what Oracle, and Mysql do )

then they have another = test=A0

which = registers an out parameter as a REAL and reads from the 'REAL_TABLE' = which is now uses the underlying type double

if someone else=A0 can find = a way to get this to pass, I'm all ears.

Dave
On = 29-Jun-05, at 10:28 AM, Dave Cramer wrote:


On 29-Jun-05, at 9:17 AM, Oliver Jowett = wrote:

Dave Cramer wrote:
=
Attached is = the patch for review. QueryExecutor is unchanged now.
The only iffy bit is where I check for the in = parameter being bound=A0 to = void type. It could be done in checkAllParametersSet
I'd like to commit this shortly.
=

Ok, comments from just reading the patch.. I like = the approach much better than the previous one, but the details need = some cleanup.

Rather than putting knowledge of parameter direction = into ParameterList, how about just allowing access to the type OID, and = the caller checks for Oid.VOID? Then the ParameterList interface changes = less and the change to use a Parameter class is unnecessary as the list = doesn't need to store a direction value.

If you must = store a direction value in the list, then another array might be better = than wrapping everything up in an object (generates less garbage = overall). Also, there are a few places that return magic values for the = direction that should be using the symbolic constants you've defined = elsewhere.
I thought of this, however even arrays have = to be garbage collected.. Is there really much difference internally = between new Parameter and new int?

I'm=A0ambivalent though = it's not a big change either way.=A0

The = change to checkAllParametersSet to not check OUT parameters seems = unnecessary -- won't OUT parameters be set to the (non-null) NULL_OBJECT = anyway?

=
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = // this is here for the sole purpose of passing the cts
! =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ( columnType =3D=3D Types.DOUBLE = && functionReturnType[i] =3D=3D Types.REAL )
! =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 {
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 // return it as a float
! =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 if ( callResult[i] !=3D null)
! =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 callResult[i] =3D new = Float(((Double)callResult[i]).floatValue());
! =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 = }

I'll go through my notes, = but I can tell you it was a catch 22 problem mostly likely an artifact = of Oracle not having=A0a REAL type.
We can't do that! If it's failing that's probably = because we're not doing the necessary implicit typecasts required by the = spec..

Please explain what's going on = here:

from an SQL point of view FLOAT, = and double are FLOAT8 types, REAL is the only one that is = FLOAT4


+ =A0 =A0 =A0 =A0 case = Types.FLOAT:=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = // TODO: FLOAT and REAL were FLOAT8 for the cts
=

=
=A0 =A0 =A0 public void = setFloat(int parameterIndex, float x) throws SQLException
=A0 =A0 =A0 = {
=A0 =A0 =A0 =A0 =A0 = checkClosed();
! =A0 =A0 =A0 =A0 = bindLiteral(parameterIndex, Float.toString(x), = Oid.FLOAT8);
=A0 =A0 =A0 }
=A0=A0


(the = bind changed from Oid.FLOAT4 to Oid.FLOAT8..)

You seem = to have reverted your earlier changes and put back the types/* classes = -- why?
huh ? they should be in there in HEAD, I did = remove the creation of an object, and went to static = methods=A0

adjustParamIndex() should be = removed entirely if it's now always a = no-op.
yeah

Why is = type translation for JDBC2 types only done in the JDBC3 code (in = registerOutParameter)? -- shouldn't that be in the JDBC2 code?

Good = point
There are a bunch of gratuitous = changes to the test code that probably shouldn't be committed, e.g. in = BatchExecuteTest:

+ =A0 =A0 =A0 =A0 try
+ =A0 =A0 =A0 = =A0 {
+ =A0 =A0 =A0 =A0 =A0 =A0 = Class.forName("org.postgresql.Driver");
+ =A0 =A0 =A0 = =A0 }
+ =A0 =A0 =A0 =A0 catch( Exception = ex){}


similarly in many other test = classes.

....

It might be an idea to break = this up into "support new-style OUT parameters" and "other fixes = necessary to pass the CTS" as currently it's quite unclear which is = which..
Well, they are all related OUT parameters are = required to support the CTS





= --Apple-Mail-21-15948022--