Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 77517 invoked from network); 6 Oct 2005 06:07:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Oct 2005 06:07:02 -0000 Received: (qmail 53887 invoked by uid 500); 6 Oct 2005 06:07:00 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 53644 invoked by uid 500); 6 Oct 2005 06:06:59 -0000 Mailing-List: contact derby-dev-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Development" Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 53633 invoked by uid 99); 6 Oct 2005 06:06:59 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 23:06:59 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=HTML_20_30,HTML_MESSAGE,RCVD_BY_IP,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of msatoor@gmail.com designates 64.233.184.207 as permitted sender) Received: from [64.233.184.207] (HELO wproxy.gmail.com) (64.233.184.207) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Oct 2005 23:07:03 -0700 Received: by wproxy.gmail.com with SMTP id i17so161367wra for ; Wed, 05 Oct 2005 23:06:37 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:references; b=lz2EyjTDjKMBl+qQwkGV7VTDGZXqAzWSxNoioqPRqlmiJjL0qqpkzxIrA42ZTIYer/chQqoot2t2FSnlAnoXph30cyHfr0rz1jd0WXTHTOEEFE0GrUsHVeW7U5p5t5spl5yuo6aHN/nDNd/Li2lsJEqZDUBfx0S9e4doaFPNga0= Received: by 10.54.118.9 with SMTP id q9mr834262wrc; Wed, 05 Oct 2005 23:06:37 -0700 (PDT) Received: by 10.54.132.6 with HTTP; Wed, 5 Oct 2005 23:06:37 -0700 (PDT) Message-ID: Date: Wed, 5 Oct 2005 23:06:37 -0700 From: Mamta Satoor Reply-To: Mamta Satoor To: Derby Development Subject: Re: [PATCH]Derby-582 Dynamic parameter should be allowed to be the operand of unary operator "-". In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_11642_10175807.1128578797331" References: <4343DEC0.5070805@debrunners.com> <4343FA11.90406@debrunners.com> <4343FDFF.4090007@debrunners.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N ------=_Part_11642_10175807.1128578797331 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Other than the ParameterNode casting for setDescriptor method, I found 3 additional places where an object gets casted to ParameterNode to get to methods getJSQLType, getParameterNumber and getDefaultValue. These happen i= n SQLToJavaValueNode, StaticMethodCallNod and BinaryRelationOperator. Just to see how the tests will run, I have removed the Parameter casting in these 3 instances and have added the 3 methods to ValueNode with the following implementations public JSQLType getJSQLType() { if (dataTypeServices !=3D null) return(new JSQLType( dataTypeServices )); else return null; } public int getParameterNumber() { return -1; } DataValueDescriptor getDefaultValue() { return null; } My intention behind this is to see how the existing tests and my unary arithmetic test would run without making UnaryOperatorNode a superclass of ParameterNode. I have added methods isParameterNode & setDescriptor to UnaryOperatorNode and I don't do parameter binding for -?/+? until the type of the underneath parameter gets set. (I haven't yet looked at consolidatin= g the 2 type setter methods, but I feel uneasy about putting the 3 ParameterNode specific methods into ValueNode.) Any thoughts? Mamta On 10/5/05, Mamta Satoor wrote: > > Hi Dan, > I will take you up on your offer to "I'm willing to help out on any > issues you discover on this new path." :) > While trying out the implementation you suggested (still not completely > done), I noticed that when I try to sue +?/-? in function calls, the code > flow is as follows > at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.getJSQLType( > SQLToJavaValueNode.java:154) > at org.apache.derby.impl.sql.compile.MethodCallNode.bindParameters( > MethodCallNode.java:331) > at org.apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression = ( > StaticMethodCallNode.java:170) > at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.bindExpression( > JavaToSQLValueNode.java:250) > at org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression( > BinaryOperatorNode.java :309) > at > org.apache.derby.impl.sql.compile.BinaryComparisonOperatorNode.bindExpres= sion > (BinaryComparisonOperatorNode.java:137) > at org.apache.derby.impl.sql.compile.SelectNode.bindExpressions( > SelectNode.java:512) > at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions( > DMLStatementNode.java:247) > at org.apache.derby.impl.sql.compile.DMLStatementNode.bind( > DMLStatementNode.java:161) > at org.apache.derby.impl.sql.compile.ReadCursorNode.bind ( > ReadCursorNode.java:74) > at org.apache.derby.impl.sql.compile.CursorNode.bind(CursorNode.java:250) > at org.apache.derby.impl.sql.GenericStatement.prepMinion( > GenericStatement.java:333) > at org.apache.derby.impl.sql.GenericStatement.prepare ( > GenericStatement.java:107) > at > org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareIn= ternalStatement > (GenericLanguageConnectionContext.java:704) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement .( > EmbedPreparedStatement.java:118) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.( > EmbedPreparedStatement20.java:82) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.( > EmbedPreparedStatement30.java:62) > at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java > :92) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement( > EmbedConnection.java:678) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement ( > EmbedConnection.java:522) > at > org.apache.derbyTesting.functionTests.tests.lang.unaryArithmeticDynamicPa= rameter.main > (unaryArithmeticDynamicParameter.java:90) > SQLToJavaValueNode.getJSQLType after checking isParameterNode does > ParameterNode casting so it can get to getJSQLType method. But since > UnaryOperatorNode is not of the type ParameterNode, the casting fails, as > expected. I can remove the casting but that would mean to implement > getJSQLType method in ValueNode as well. But does this method make a sens= e > for ValueNode? If we do decide to add this method, UnaryOperatorNode will > simply call the same method on it's operand. > thanks, > Mamta > > On 10/5/05, Daniel John Debrunner wrote: > > > > Daniel John Debrunner wrote: > > > > > > > On this it seems that there is some current confusion in the code, > > > ValueNode has two methods to set the type, setType and setDescriptor. > > > So why does ParameterNode need a special set type method > > setDescriptor, > > > and the associated required casting? > > > > I got confused here, ParameterNode.setDescriptor is overriding > > ValueNode.setDescriptor, so I'm not sure why the casting to > > ParameterNode is required. > > > > Still a move to a single method would be a good thing. > > > > Dan. > > > > > ------=_Part_11642_10175807.1128578797331 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
Other than the ParameterNode casting for setDescriptor method, I found=  3 additional places where an object gets casted to ParameterNode= to get to methods getJSQLType, getParameterNumber and getDefaultValue= . These happen in SQLToJavaValueNode, StaticMethodCallNod and BinaryRelatio= nOperator. Just to see how the tests will run, I have removed the Parameter= casting in these 3 instances and have added the 3 methods to ValueNod= e with the following implementations
 public JSQLType getJSQLType()
 {
  = ;if (dataTypeServices !=3D null)
   return(new JSQLType( = dataTypeServices ));
  else
   return null;<= br> }
 public int getParameterNumber()
 {
&nbs= p; return -1;
 }
 DataValueDescriptor getDefaultValue()
 {
  = return null;
 }
 
My intention behind this is to see how the existing tests and my unary= arithmetic test would run without making UnaryOperatorNode a superclass of= ParameterNode. I have added methods isParameterNode & setDescript= or to UnaryOperatorNode and I don't do parameter binding for -?/+? until th= e type of the underneath parameter gets set. (I haven't yet looked at conso= lidating the 2 type setter methods, but I feel uneasy about putting the 3 P= arameterNode specific methods into ValueNode.) Any thoughts?
 
Mamta

 
On 10/5/05, = Mamta Satoor <msatoor@gmail.com= > wrote:
Hi Dan,
 
I will take you up on your offer to "I'm willing to help out on a= ny issues you discover on this new path." :)
 
While trying out the implementation you suggested (still not completel= y done), I noticed that when I try to sue +?/-? in function calls, the code= flow is as follows
 at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.getJSQLT= ype(SQLToJavaValueNode.java:154)
 at org.apache.derby.impl.sql.comp= ile.MethodCallNode.bindParameters(MethodCallNode.java:331)
 at org.= apache.derby.impl.sql.compile.StaticMethodCallNode.bindExpression (StaticMethodCallNode.java:170)
 at org.apache.derby.impl.sql.comp= ile.JavaToSQLValueNode.bindExpression(JavaToSQLValueNode.java:250)
 = ;at org.apache.derby.impl.sql.compile.BinaryOperatorNode.bindExpression(Bin= aryOperatorNode.java :309)
 at org.apache.derby.impl.sql.compile.BinaryComparisonOperat= orNode.bindExpression(BinaryComparisonOperatorNode.java:137)
 at or= g.apache.derby.impl.sql.compile.SelectNode.bindExpressions(SelectNode.java:= 512)
 at org.apache.derby.impl.sql.compile.DMLStatementNode.bindExpressions= (DMLStatementNode.java:247)
 at org.apache.derby.impl.sql.compile.D= MLStatementNode.bind(DMLStatementNode.java:161)
 at org.apache.derb= y.impl.sql.compile.ReadCursorNode.bind (ReadCursorNode.java:74)
 at org.apache.derby.impl.sql.compile.Cur= sorNode.bind(CursorNode.java:250)
 at org.apache.derby.impl.sql.Gen= ericStatement.prepMinion(GenericStatement.java:333)
 at org.apache.= derby.impl.sql.GenericStatement.prepare (GenericStatement.java:107)
 at org.apache.derby.impl.sql.conn.Gen= ericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConne= ctionContext.java:704)
 at org.apache.derby.impl.jdbc.EmbedPrepared= Statement .<init>(EmbedPreparedStatement.java:118)
 at org.apache.derb= y.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.= java:82)
 at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.&l= t;init>(=20 EmbedPreparedStatement30.java:62)
 at org.apache.derby.jdbc.Driver3= 0.newEmbedPreparedStatement(Driver30.java:92)
 at org.apache.derby.= impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:678)
&nb= sp;at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement (EmbedConnection.java:522)
 at org.apache.derbyTesting.functionTes= ts.tests.lang.unaryArithmeticDynamicParameter.main(unaryArithmeticDynamicPa= rameter.java:90)
 
SQLToJavaValueNode.getJSQLType after checking isParameterNode doe= s ParameterNode casting so it can get to getJSQLType method. But since Unar= yOperatorNode is not of the type ParameterNode, the casting fails, as expec= ted. I can remove the casting but that would mean to implement getJSQL= Type method in ValueNode as well. But does this method make a sense fo= r ValueNode? If we do decide to add this method, UnaryOperatorNode will sim= ply call the same method on it's operand.=20
 
thanks,
Mamta

 
On 10/5/05, Daniel John Debrunner < djd@debrunners.com> wrote:
Daniel John Debrunner wrote:
=

> On this it seems that there is some current confusion in the c= ode,=20
> ValueNode has two methods to set the type, setType and setDescript= or.
> So why does ParameterNode need a special set type method setDes= criptor,
> and the associated required casting?

I got confused= here,=20 ParameterNode.setDescriptor is overriding
ValueNode.setDescriptor, so I'= m not sure why the casting to
ParameterNode is required.

Still a = move to a single method would be a good thing.

Dan.



------=_Part_11642_10175807.1128578797331--