From derby-dev-return-66070-apmail-db-derby-dev-archive=db.apache.org@db.apache.org Wed Feb 04 14:52:22 2009 Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 66405 invoked from network); 4 Feb 2009 14:52:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Feb 2009 14:52:22 -0000 Received: (qmail 92124 invoked by uid 500); 4 Feb 2009 14:52:21 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 92098 invoked by uid 500); 4 Feb 2009 14:52:21 -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: Delivered-To: mailing list derby-dev@db.apache.org Received: (qmail 92088 invoked by uid 99); 4 Feb 2009 14:52:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 06:52:21 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Feb 2009 14:52:20 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 243C5234C48C for ; Wed, 4 Feb 2009 06:52:00 -0800 (PST) Message-ID: <489258027.1233759120147.JavaMail.jira@brutus> Date: Wed, 4 Feb 2009 06:52:00 -0800 (PST) From: "Rick Hillegas (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-2201) Calling functions that return Blob/Clob does not work. In-Reply-To: <896851.1167309621015.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/DERBY-2201?page=3Dcom.atlassian= .jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1267= 0340#action_12670340 ]=20 Rick Hillegas commented on DERBY-2201: -------------------------------------- Thanks for the quick feedback, Kristian. This new kind of java.sql.[BC]ob is never returned to the user. Having a SQ= L[BC]lob return an Embed[BC]lob feels to me like a layering violation for t= wo reasons: 1) it would mean that an iapi package would be reaching into an impl packag= e 2) it would mean that the internal datatype layer would be reaching up into= the JDBC layer, inverting the normal layering of these components We could create vacuous implementations of java.sql.[BC]lob in the iapi pac= kage next to SQL[BC]lob. Let's call them [BC]lobImpl. A [BC]lobImpl would = wrap the byte or stream contents of a SQL[BC]lob, either by being construct= ed from the bytes or streams or by simply forwarding its methods to the SQL= [BC]lob. That might be easier to understand than having SQL[BC]lob implemen= t java.sql.[BC]lob. Your point about the complexity of writing another implementation of java.s= ql.[BC]lob is well founded. Writing a vacuous implementation of java.sql.[B= C]lob is easy--but as you know better than anyone else, handling the stream= ing methods is very hard. In this particular code path, I think that SQL[BC]lob.getObject() should no= t return a SQL[BC]lob or an Embed[BC]lob but rather a User[BC]lob, where th= e User[BC]lob is what's returned by the user-defined function. That is, the= nesting/wrapping of these classes should be: Embed[BC]lob ( SQL[BC]lob ( User[BC]lob ) ) I tried to get this to work a couple months ago, but my User[BC]lob kept ge= tting lost in the SQLBinary pinball machine. I will put some more effort in= to this approach. For the record, the tests ran cleanly for me. > Calling functions that return Blob/Clob does not work. > ------------------------------------------------------ > > Key: DERBY-2201 > URL: https://issues.apache.org/jira/browse/DERBY-2201 > Project: Derby > Issue Type: Bug > Components: SQL > Affects Versions: 10.3.1.4 > Environment: Derby, head of trunk. Sun JVM 5. Solaris 10 (x86). > Reporter: =C3=98ystein Gr=C3=B8vlen > Priority: Minor > Attachments: ClobFunction.java, derby-2201-aa-01-crudeDog.diff, g= etClobDataValue.diff > > > Calling functions that return Blob/Clob results in NoSuchMethodException = (See stackTrace below). It fails because DataValueFactory.getClobDataValue= (Clob, StringDataValue) does not exist. However, getClobDataValue(String,= StringDataValue) exists. I will attach program to repro this. > java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFac= tory.getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringData= Value) at java.lang.Class.getDeclaredMethod(Class.java:1909) > at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMeth= od(d_BCValidate.java:133) > at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BC= Method.java:745) > at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDat= aValue(BaseTypeCompiler.java:135) > at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.gener= ateDataValue(ExpressionClassBuilder.java:918) > at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateE= xpression(JavaToSQLValueNode.java:179) > at org.apache.derby.impl.sql.compile.CastNode.generateExpression(= CastNode.java:884) > at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateS= QLValue(SQLToJavaValueNode.java:361) > at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateE= xpression(SQLToJavaValueNode.java:341) > at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateE= xpression(JavaToSQLValueNode.java:176) > at org.apache.derby.impl.sql.compile.ResultColumn.generateExpress= ion(ResultColumn.java:884) > at org.apache.derby.impl.sql.compile.ResultColumnList.generateCor= e(ResultColumnList.java:1097) > at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate= Minion(ProjectRestrictNode.java:1516) > at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate= (ProjectRestrictNode.java:1303) > at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNo= de.generate(ScrollInsensitiveResultSetNode.java:110) > at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNo= de.java:565) > at org.apache.derby.impl.sql.compile.StatementNode.generate(State= mentNode.java:333) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericS= tatement.java:447) > at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStat= ement.java:88) > at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContex= t.prepareInternalStatement(GenericLanguageConnectionContext.java:741) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement.(Embed= PreparedStatement.java:129) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.(Emb= edPreparedStatement20.java:83) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.(Emb= edPreparedStatement30.java:63) > at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Drive= r30.java:93) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Em= bedConnection.java:742) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Em= bedConnection.java:586) > at lobtests.ClobFunction.main(ClobFunction.java:87) > Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache= .derby.iapi.types.StringDataValue getClobDataValue(java.sql.Clob, org.apach= e.derby.iapi.types.StringDataValue) because java.lang.NoSuchMethodException= : org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Cl= ob, org.apache.derby.iapi.types.StringDataValue) > java.sql.SQLException: Java exception: 'ASSERT FAILED Invalid method org.= apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.Str= ingDataValue getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.St= ringDataValue) because java.lang.NoSuchMethodException: org.apache.derby.ia= pi.types.DataValueFactory.getClobDataValue(java.sql.Clob, org.apache.derby.= iapi.types.StringDataValue): org.apache.derby.shared.common.sanity.AssertFa= ilure'. > org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Invali= d method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.i= api.types.StringDataValue getClobDataValue(java.sql.Clob, org.apache.derby.= iapi.types.StringDataValue) because java.lang.NoSuchMethodException: org.ap= ache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob, org.= apache.derby.iapi.types.StringDataValue) > at org.apache.derby.shared.common.sanity.SanityManager.THROWASSER= T(SanityManager.java:149) > at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMeth= od(d_BCValidate.java:192) > at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BC= Method.java:745) > at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDat= aValue(BaseTypeCompiler.java:135) > at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.gener= ateDataValue(ExpressionClassBuilder.java:918) > at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateE= xpression(JavaToSQLValueNode.java:179) > at org.apache.derby.impl.sql.compile.CastNode.generateExpression(= CastNode.java:884) > at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateS= QLValue(SQLToJavaValueNode.java:361) > at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateE= xpression(SQLToJavaValueNode.java:341) > at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateE= xpression(JavaToSQLValueNode.java:176) > at org.apache.derby.impl.sql.compile.ResultColumn.generateExpress= ion(ResultColumn.java:884) > at org.apache.derby.impl.sql.compile.ResultColumnList.generateCor= e(ResultColumnList.java:1097) > at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate= Minion(ProjectRestrictNode.java:1516) > at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate= (ProjectRestrictNode.java:1303) > at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNo= de.generate(ScrollInsensitiveResultSetNode.java:110) > at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNo= de.java:565) > at org.apache.derby.impl.sql.compile.StatementNode.generate(State= mentNode.java:333) > at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericS= tatement.java:447) > at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStat= ement.java:88) > at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContex= t.prepareInternalStatement(GenericLanguageConnectionContext.java:741) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement.(Embed= PreparedStatement.java:129) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.(Emb= edPreparedStatement20.java:83) > at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.(Emb= edPreparedStatement30.java:63) > at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Drive= r30.java:93) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Em= bedConnection.java:742) > at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(Em= bedConnection.java:586) > at lobtests.ClobFunction.main(ClobFunction.java:87) --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.