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] Created: (DERBY-2848) Missing method referenced in generated code
Date Tue, 19 Jun 2007 21:38:26 GMT
Missing method referenced in generated code
-------------------------------------------

                 Key: DERBY-2848
                 URL: https://issues.apache.org/jira/browse/DERBY-2848
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.3.0.0
            Reporter: Rick Hillegas


The following script raises an error during byte code generation:

ij version 10.3
ij> --connect 'jdbc:derby://localhost:8246/auth10.3;create=true;user="rick";password=rickspassword';
connect 'jdbc:derby:db10.3;create=true';
WARNING 01J01: Database 'db10.3' not created, connection made to existing database instead.
ij> drop function makeBlob;
0 rows inserted/updated/deleted
ij> drop table lobtable;
0 rows inserted/updated/deleted
ij> create table lobtable
(
   keyCol int generated always as identity,
   clob1 clob,
   descCol  varchar( 50 ),
   clob2 clob,
   blob1  blob,
   updateCount int,
   blob2  blob
);
0 rows inserted/updated/deleted
ij> create function makeBlob
(
    byteString varchar( 50 )
)
returns blob
language java
parameter style java
no sql
external name 'other.MyBlob.makeBlob'
;
0 rows inserted/updated/deleted
ij> insert into lobtable
( clob1, descCol, clob2, blob1,  updateCount, blob2 )
values
(
  'Who put the bop ',
  'Doo wop', 'in the bopshebop ',
  makeBlob( 'Had we but world enough and time ' ),
  1,
  makeBlob( 'this coyness, mistress, would be no crime ' )
);
java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob,
org.apache.derby.iapi.types.BitDataValue)
        at java.lang.Class.getDeclaredMethod(Class.java:1264)
        at org.apache.derby.impl.services.bytecode.d_BCValidate.checkMethod(d_BCValidate.java:132)
        at org.apache.derby.impl.services.bytecode.BCMethod.callMethod(BCMethod.java:745)
        at org.apache.derby.impl.sql.compile.BaseTypeCompiler.generateDataValue(BaseTypeCompiler.java:194)
        at org.apache.derby.impl.sql.compile.ExpressionClassBuilder.generateDataValue(ExpressionClassBuilder.java:899)
        at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:169)
        at org.apache.derby.impl.sql.compile.CastNode.generateExpression(CastNode.java:855)
        at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateSQLValue(SQLToJavaValueNode.java:352)
        at org.apache.derby.impl.sql.compile.SQLToJavaValueNode.generateExpression(SQLToJavaValueNode.java:332)
        at org.apache.derby.impl.sql.compile.JavaToSQLValueNode.generateExpression(JavaToSQLValueNode.java:166)
        at org.apache.derby.impl.sql.compile.ResultColumn.generateExpression(ResultColumn.java:891)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generateCore(ResultColumnList.java:1176)
        at org.apache.derby.impl.sql.compile.ResultColumnList.generate(ResultColumnList.java:1015)
        at org.apache.derby.impl.sql.compile.RowResultSetNode.generate(RowResultSetNode.java:690)
        at org.apache.derby.impl.sql.compile.NormalizeResultSetNode.generate(NormalizeResultSetNode.java:122)
        at org.apache.derby.impl.sql.compile.InsertNode.generate(InsertNode.java:837)
        at org.apache.derby.impl.sql.compile.StatementNode.generate(StatementNode.java:347)
        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:748)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:579)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(EmbedStatement.java:528)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:330)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java:522)
        at org.apache.derby.impl.tools.ij.utilMain.runScriptGuts(utilMain.java:364)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:262)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:215)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:181)
        at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:56)
        at org.apache.derby.tools.ij.main(ij.java:71)
Invalid method org.apache.derby.iapi.types.DataValueFactory >> org.apache.derby.iapi.types.BitDataValue
getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue) because java.lang.NoSuchMethodException:
org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue)
ERROR XJ001: Java exception: 'ASSERT FAILED Invalid method org.apache.derby.iapi.types.DataValueFactory
>> org.apache.derby.iapi.types.BitDataValue getBlobDataValue(java.sql.Blob, org.apache.derby.iapi.types.BitDataValue)
because java.lang.NoSuchMethodException: org.apache.derby.iapi.types.DataValueFactory.getBlobDataValue(java.sql.Blob,
org.apache.derby.iapi.types.BitDataValue): org.apache.derby.shared.common.sanity.AssertFailure'.

The script is attempting to stuff a user-generated blob into a blob column. Here is the user
function which creates the blob:

package other;

import java.io.*;
import java.sql.*;

/**
 * <p>
 * A crude Blob implementation for datatype testing.
 * </p>
 */
public class MyBlob	implements	Blob
{

    private	byte[]	_bytes;

    public  static  Blob    makeBlob( String byteString )
    {
        return new MyBlob( byteString );
    }
    
    public	MyBlob( String byteString )
    {
        _bytes = byteString.getBytes();
    }
    
    public	MyBlob( byte[] bytes )
    {
        _bytes = bytes;
    }
    
    public	InputStream	getBinaryStream()
    {
        return new ByteArrayInputStream( _bytes );
    }
    
    public	byte[]	getBytes( long position, int length ) { return _bytes; }
    
    public	long	length() { return (long) _bytes.length; }
    
    public	long	position( Blob pattern, long start ) { return 0L; }
    public	long	position( byte[] pattern, long start ) { return 0L; }
        
    public	boolean	equals( Object other )
    {
        if ( other == null ) { return false; }
        if ( !( other instanceof Blob ) ) { return false; }
            
        Blob	that = (Blob) other;
            
        try {
            if ( this.length() != that.length() ) { return false; }
                
            InputStream	thisStream = this.getBinaryStream();
            InputStream	thatStream = that.getBinaryStream();
                
            while( true )
            {
                int		nextByte = thisStream.read();
                    
                if ( nextByte < 0 ) { break; }
                if ( nextByte != thatStream.read() ) { return false; }
            }
        }
        catch (Exception e)
        {
            System.err.println( e.getMessage() );
            e.printStackTrace();
            return false;
        }
            
        return true;
    }
        
    public int setBytes(long arg0, byte[] arg1) throws SQLException {
        throw new SQLException("not implemented for this test");
    }
        
    public int setBytes(long arg0, byte[] arg1, int arg2, int arg3) throws SQLException {
        throw new SQLException("not implemented for this test");
    }
        
    public OutputStream setBinaryStream(long arg0) throws SQLException {
        throw new SQLException("not implemented for this test");
    }
        
    public void truncate(long arg0) throws SQLException {
        throw new SQLException("not implemented for this test");
    }
        
}
    


-- 
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