Hi Hugh

The VirtusosStatement.getMoreResults() method does not meet the contract
of the Statement interface API.

I don't think it handles multiple results at all, and always returns
true .

The contract of the Statement interface  method Statement.
getMoreResults() states :

"Returns: true if the next result is a ResultSet object; false if it is
an update count or there are no more results"

http://java.sun.com/j2se/1.4.2/docs/api/java/sql/Statement.html#getMoreR
esults()

 

the code in VirtusosStatement.getMoreResults() does the following:

{....

   vresultSet.getMoreResults();   // this always returns true (see my
previous email)

   return true;   // this method returns true regardless

... }

 

Thus any implementing code which need to handle multiple result sets (ie
Hibernate/iBatis) is going to fail.

 

Regards

Paul

 

 

From: Paul Wilton [mailto:paul.wil...@bbc.com] 
Sent: 24 June 2009 09:54
To: Hugh Williams; Jem Rayfield
Cc: Sonja Nevitt; Julian Everett; virtuoso-users@lists.sourceforge.net
Subject: Re: [Virtuoso-users] JDBC feature

 

Hi Hugh

I have looked at the source for the JDBC driver and the error seem to be
in the VirtuosoResultSet.getMoreResults() method

The member variable  more_result    is always set to true at the end of
the method regardless of any processing logic.  (see source pasted
below).

 

I have to say the quality of the source is a bit worrying (to say the
least)  -there  also seems to be a lack of test coverage (unit tests)

For example, there is a openlink.util.Vector class being used which
seems to be a copy of the Java 1.1 Vector except the synchronisation has
been omitted.  Why are the Collection classes not being used ?

The code I have looked at (the HEAD of the trunk in CVS), only seems to
have a (source) package for the JDBCType4 driver, but the comments
throughout the code refer to JDBC2.  Also compiler directives are being
used etc etc...

 

Sorry to be so negative,

regards Paul

 

 

   /**

    * Method uses to get next rows of this result set.

    *

    * @exception virtuoso.jdbc2.VirtuosoException An internal error
occurred

    */

   protected void getMoreResults() throws VirtuosoException

   {

     synchronized (statement.connection)

       {

        //System.err.println ("getMoreResults");

        // Reset some flags

        rowIsDeleted = rowIsUpdated = rowIsInserted = is_complete =
false;

        currentRow = 0;

        // Delete older rows

        if(rows == null)

          rows = new openlink.util.Vector(20);

        else

          rows.removeAllElements();

        // One more time

        process_result();

        more_result = true;

        //System.err.print ("more_results: after process : rows :");

        //System.err.println (rows.toString());

       }

   }

 

 

From: Hugh Williams [mailto:hwilli...@openlinksw.com] 
Sent: 23 June 2009 15:36
To: Jem Rayfield
Cc: Sonja Nevitt; virtuoso-users@lists.sourceforge.net List; Paul Wilton
Subject: Re: JDBC feature

 

Hi Jem,

 

We are looking into this and shall report back with our findings ...

 

Best Regards

Hugh Williams

Professional Services

OpenLink Software

Web: http://www.openlinksw.com

Support: http://support.openlinksw.com

Forums: http://boards.openlinksw.com/support

 

 

 

On 23 Jun 2009, at 15:18, Jem Rayfield wrote:

 

Hi,

 

We are experience an interesting feature with the availible JDBC
drivers. (JDBC3 and JDBC4).

(Driver version: 05.10.3038. Transaction isolation level : 4.)

 

When an SQL invocation returns zero results we get into an infinte loop
situation.

 

We are using iBatis as an ORM mapping tool. 

iBatis checks the first result set which returns nothing. At this point
we are in good shape. After which iBatis contiunes to check further
result sets to ensure that there are no other results.

However at this point the following is always true within the Driver
code base: 

 

   VirtuosoPreparedStatement .vresultset.more_result=true

   VirtuosoPreparedStatement.getMoreResults()

 

iBatis in turn continues iterating and checking empty result sets. The
produces an infinte loop and a hanging process.

The driver should return FALSE as there are no results.

 

 

The query being invoked is as follows:

 

        select * from DB.METADATA.STORY  where id in (        

                        SPARQL PREFIX md:
<http://nolapps34.newsonline.tc.nca.bbc.co.uk:8890/md#
<http://nolapps34.newsonline.tc.nca.bbc.co.uk:8890/md> >        

                        SELECT ?id  FROM
<http://nolapps34.newsonline.tc.nca.bbc.co.uk:8890/md#
<http://nolapps34.newsonline.tc.nca.bbc.co.uk:8890/md> >        

                        WHERE {

                        ?x md:id ?id .

                        ?x md:title 'SOME STORY'

                        }

        )    

 

FYI:

The version of iBatis is as follows: iBatis version (2.3.4.726) (latest
stable). 

The iBatis line of code which checks the resultset status is as follows:
SqlExecutor.java   line 354

Can you let us have your thoughts as this is a real pain.

 

 

FYI: We are unable to use hibernate as there is currently no hibernate
dialect and wish to use an ORM tool.

 

Thanks 

Jem  


http://www.bbc.co.uk
This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.

 

Reply via email to