db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2201) Calling functions that return Blob/Clob does not work.
Date Thu, 05 Feb 2009 21:59:59 GMT

     [ https://issues.apache.org/jira/browse/DERBY-2201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Hillegas updated DERBY-2201:
---------------------------------

    Attachment: derby-2201-02-aa-wrapUserLob.diff

Attaching derby-2201-02-aa-wrapUserLob.diff. This is a second approach to the problem. In
this patch, SQL[BC]lob.getObject() return the [BC]lob instantiated by the user-defined function.
When writing LOBs to this store, this approach takes advantage of the stream api on the user
[BC]lob in order to stream the user data into the store--I expect that this approach will
perform better on large LOBs.

Item (1) from the previous patch remains unchanged.

Item (2) is replaced with

2') Previously SQL[BC]lob could contain the data as a raw array of bytes/chars, a string,
or as a stream attached to Derby's on-disk storage of the value. With this patch, SQL[BC]lob
can contain the data in yet another form, namely as a java.sql.[BC]lob.

I'm running regression tests now. I will write additional tests.

Given the following script, during the final insert, this approach should cause SQL[BC]lob
to stream data out of the [BC]lob returned by the user-defined functions and directly into
the store. That is, this approach should not materialize the [BC]lobs in memory on the way
to writing them to disk.

drop function "blob_Blob_String";
create function "blob_Blob_String"
(
	a_0 varchar( 10 )
)
returns blob
language java
parameter style java
no sql
external name 'org.apache.derbyTesting.functionTests.tests.lang.AnsiSignatures.blob_Blob_String'
;
drop function "clob_Clob_String";
create function "clob_Clob_String"
(
	a_0 varchar( 10 )
)
returns clob
language java
parameter style java
no sql
external name 'org.apache.derbyTesting.functionTests.tests.lang.AnsiSignatures.clob_Clob_String'
;
drop table t;
create table t( a clob, b blob );

insert into t( a, b ) values( "clob_Clob_String"( 'abc' ), "blob_Blob_String"( 'abc' ) );



Touches the following files:

M      java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
M      java/engine/org/apache/derby/iapi/types/DataValueFactory.java

As in the previous patch, the changes above implement (1).


M      java/engine/org/apache/derby/iapi/types/BitDataValue.java
M      java/engine/org/apache/derby/iapi/types/SQLBinary.java
M      java/engine/org/apache/derby/iapi/types/SQLBlob.java

The changes above implement (2') for Blobs. That is, binary data types can now hold the user
data as a java.sql.Blob as well as the old forms (byte array and Derby storage stream).


M      java/engine/org/apache/derby/iapi/types/StringDataValue.java
M      java/engine/org/apache/derby/iapi/types/SQLChar.java
M      java/engine/org/apache/derby/iapi/types/SQLVarchar.java
M      java/engine/org/apache/derby/iapi/types/SQLClob.java

The changes above implement (2') for Clobs. That is, string data types can now hold the user
data as a java.sql.Clob as well as the old forms of char array, String, and Derby storage
stream.


M      java/testing/org/apache/derbyTesting/unitTests/store/T_Recovery.java

Small change to disambiguate the new SQLChar( Clob ) constructor from the SQLChar( String
) constructor.


M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/AnsiSignaturesTest.java

Uncomments some tests which were introduced by DERBY-3652 but which had to be commented out
because of this bug.


> 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: Øystein Grøvlen
>            Priority: Minor
>         Attachments: ClobFunction.java, derby-2201-02-aa-wrapUserLob.diff, derby-2201-aa-01-crudeDog.diff,
getClobDataValue.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.DataValueFactory.getClobDataValue(java.sql.Clob,
org.apache.derby.iapi.types.StringDataValue)        at java.lang.Class.getDeclaredMethod(Class.java:1909)
>         at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMethod(d_BCValidate.java:133)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BCMethod.java:745)
>         at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDataValue(BaseTypeCompiler.java:135)
>         at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.generateDataValue(ExpressionClassBuilder.java:918)
>         at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:179)
>         at org.apache.derby.impl.sql.compile.CastNode.generateExpression(CastNode.java:884)
>         at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateSQLValue(SQLToJavaValueNode.java:361)
>         at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateExpression(SQLToJavaValueNode.java:341)
>         at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:176)
>         at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(ResultColumn.java:884)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1097)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1516)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1303)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(ScrollInsensitiveResultSetNode.java:110)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNode.java:565)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:333)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:447)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:741)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:129)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:83)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:63)
>         at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java:93)
>         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:742)
>         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.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.apache.derby.iapi.types.StringDataValue) because java.lang.NoSuchMethodException:
org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob, 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.StringDataValue getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue)
because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob,
org.apache.derby.iapi.types.StringDataValue): org.apache.derby.shared.common.sanity.AssertFailure'.
> org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED Invalid method org.apache.derby.iapi.types.DataValueFactory
>> org.apache.derby.iapi.types.StringDataValue getClobDataValue(java.sql.Clob, org.apache.derby.iapi.types.StringDataValue)
because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getClobDataValue(java.sql.Clob,
org.apache.derby.iapi.types.StringDataValue)
>         at org.apache.derby.shared.common.sanity.SanityManager.THROWASSERT(SanityManager.java:149)
>         at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMethod(d_BCValidate.java:192)
>         at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BCMethod.java:745)
>         at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDataValue(BaseTypeCompiler.java:135)
>         at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.generateDataValue(ExpressionClassBuilder.java:918)
>         at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:179)
>         at org.apache.derby.impl.sql.compile.CastNode.generateExpression(CastNode.java:884)
>         at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateSQLValue(SQLToJavaValueNode.java:361)
>         at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateExpression(SQLToJavaValueNode.java:341)
>         at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:176)
>         at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(ResultColumn.java:884)
>         at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1097)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generateMinion(ProjectRestrictNode.java:1516)
>         at org.apache.derby.impl.sql.compile.ProjectRestrictNode.generate(ProjectRestrictNode.java:1303)
>         at org.apache.derby.impl.sql.compile.ScrollInsensitiveResultSetNode.generate(ScrollInsensitiveResultSetNode.java:110)
>         at org.apache.derby.impl.sql.compile.CursorNode.generate(CursorNode.java:565)
>         at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:333)
>         at org.apache.derby.impl.sql.GenericStatement.prepMinion(GenericStatement.java:447)
>         at org.apache.derby.impl.sql.GenericStatement.prepare(GenericStatement.java:88)
>         at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(GenericLanguageConnectionContext.java:741)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement.<init>(EmbedPreparedStatement.java:129)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement20.<init>(EmbedPreparedStatement20.java:83)
>         at org.apache.derby.impl.jdbc.EmbedPreparedStatement30.<init>(EmbedPreparedStatement30.java:63)
>         at org.apache.derby.jdbc.Driver30.newEmbedPreparedStatement(Driver30.java:93)
>         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:742)
>         at org.apache.derby.impl.jdbc.EmbedConnection.prepareStatement(EmbedConnection.java:586)
>         at lobtests.ClobFunction.main(ClobFunction.java:87)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message