Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 96480 invoked from network); 1 Apr 2005 18:30:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Apr 2005 18:30:08 -0000 Received: (qmail 90488 invoked by uid 500); 1 Apr 2005 18:30:06 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 90457 invoked by uid 500); 1 Apr 2005 18:30:06 -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 90443 invoked by uid 99); 1 Apr 2005 18:30:06 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from e35.co.us.ibm.com (HELO e35.co.us.ibm.com) (32.97.110.133) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 01 Apr 2005 10:30:04 -0800 Received: from westrelay02.boulder.ibm.com (westrelay02.boulder.ibm.com [9.17.195.11]) by e35.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j31IU1Lg170626 for ; Fri, 1 Apr 2005 13:30:01 -0500 Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by westrelay02.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j31IU130235716 for ; Fri, 1 Apr 2005 11:30:01 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j31IU1j7032490 for ; Fri, 1 Apr 2005 11:30:01 -0700 Received: from [127.0.0.1] (sig-9-48-115-242.mts.ibm.com [9.48.115.242]) by d03av04.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j31ITuNo032168 for ; Fri, 1 Apr 2005 11:30:00 -0700 Message-ID: <424D9348.8020006@Sourcery.Org> Date: Fri, 01 Apr 2005 10:30:32 -0800 From: Satheesh Bandaram User-Agent: Mozilla Thunderbird 0.7.3 (Windows/20040803) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Development Subject: Re: [jira] Commented: (DERBY-186) isFirst() returns true when relative(x) goes beyond result set References: <1977747854.1112079800835.JavaMail.jira@ajax.apache.org> <42493A5D.4010604@Sun.com> <424976DC.4040700@Sun.com> <42498D2C.7030200@Sun.com> <424A3288.20802@Sun.com> <424A8854.6020902@Sun.com> <424D8793.60203@sun.com> In-Reply-To: <424D8793.60203@sun.com> X-Enigmail-Version: 0.85.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N I will do it today... Got side tracked for few days.. Satheesh Shreyas Kaushik wrote: > Did anyone get a chance to look at this and commit it? > > ~ Shreyas > > Shreyas Kaushik wrote: > >> Attached the latest patch. This addition to this patch from the old >> one is that I have added the test >> in the jdbcapi.runall file for it to run in both Embedded and Network >> Server mode. >> >> ~ Shreyas >> >> Shreyas Kaushik wrote: >> >>> Hi Mamta, >>> >>> Thanks for all the info. This definitely gave more insight into this >>> test framework. >>> I recently submitted a patch for Derby-174 and Derby-175 for which I >>> have just submitted a >>> patch for for jdbcapi.runall file. After that gets in I will >>> definitely add this one as well >>> and submit all of it in a fresh patch. I am waiting for that to go >>> in as there could be conflicts >>> in the jdbcapi.runall file. >>> >>> ~ Shreyas >>> >>> Mamta Satoor wrote: >>> >>>> On Tue, 29 Mar 2005 22:45:24 +0530, Shreyas Kaushik >>>> wrote: >>>> >>>> >>>>> Hi Mamta, >>>>> >>>>> Thanks for all the info. >>>>> From this I see that adding it in jdbcapi will run in both >>>>> embedded and >>>>> netwrok server mode. >>>>> Should I add some properties file specifically for my test? >>>>> I'm sorry I ask this again, I'm not clear what changes I have to >>>>> do to >>>>> my patch ? >>>>> >>>>> ~ Shreyas >>>>> >>>>> >>>> >>>> >>>> >>>> >>>> Hi Shreyas, >>>> >>>> You will see that each of the directories under functionTests/tests >>>> have their own default properties file. If a newly added test does not >>>> have a test specific properties file, then the default properties file >>>> gets picked up. For eg, test declareGlobalTempTableJavaJDBC30.java has >>>> its own properties file because we do not want the test to be run with >>>> some jdks and we speify that >>>> declareGlobalTempTableJavaJDBC30_app.properties. Since the test you >>>> are adding has no special requirements, you donot need a properties >>>> file for it and harness will automatically use the default properties >>>> file for your test. >>>> >>>> Feel free to ask more questions if you have any. Since I have been >>>> working on this test harness for so long, I might not be visualizing >>>> some questions that a new developer might have. >>>> >>>> thanks, >>>> Mamta >>>> >>>> >> ------------------------------------------------------------------------ >> >> Index: >> java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java >> >> =================================================================== >> --- >> java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java >> (revision 159474) >> +++ >> java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java >> (working copy) >> @@ -750,6 +750,7 @@ >> else >> { >> afterLast = true; >> + currentPosition = positionInSource + 1; >> } >> } >> >> Index: >> java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/testRelative.java >> >> =================================================================== >> --- >> java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/testRelative.java >> (revision 0) >> +++ >> java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/testRelative.java >> (revision 0) >> @@ -0,0 +1,98 @@ >> +package org.apache.derbyTesting.functionTests.tests.jdbcapi; >> + >> + >> +import java.sql.*; >> + >> +import org.apache.derby.tools.ij; >> +import org.apache.derby.tools.JDBCDisplayUtil; >> + >> +public class testRelative { >> + public static void main(String[] args) { >> + test1(args); + } >> + + public static void test1(String []args) { >> + Connection con; >> + ResultSet rs; >> + PreparedStatement stmt = null; >> + PreparedStatement pStmt = null; >> + Statement stmt1 = null; >> + String returnValue = null; >> + >> + System.out.println("Test testRelative starting"); >> + >> + try >> + { >> + // use the ij utility to read the property >> file and >> + // make the initial connection. >> + ij.getPropertyArg(args); >> + con = ij.startJBMS(); >> + >> + >> con.setAutoCommit(false); >> + + stmt = >> con.prepareStatement("create table testRelative(name varchar(10), i >> int)"); >> + stmt.executeUpdate(); >> + con.commit(); >> + >> + pStmt = con.prepareStatement("insert into >> testRelative values (?,?)"); >> + >> + pStmt.setString(1,"work1"); >> + pStmt.setNull(2,1); >> + pStmt.addBatch(); >> + >> + pStmt.setString(1,"work2"); >> + pStmt.setNull(2,2); >> + pStmt.addBatch(); >> + >> + pStmt.setString(1,"work3"); >> + pStmt.setNull(2,3); >> + pStmt.addBatch(); >> + >> + pStmt.setString(1,"work4"); >> + pStmt.setNull(2,4); >> + pStmt.addBatch(); >> + >> + >> + pStmt.executeBatch(); >> + con.commit(); >> + >> + stmt1 = >> con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY); >> >> + rs = stmt1.executeQuery("select * from >> testRelative"); >> + >> + rs.next(); // First Record >> + returnValue = rs.getString("name"); >> + System.out.println("Value="+returnValue); >> + >> + rs.relative(2); >> + System.out.println("isFirst=" + rs.isFirst() + " >> isLast=" + rs.isLast() + " isAfterLast=" + rs.isAfterLast()); >> + returnValue = rs.getString("name"); >> + System.out.println("Value="+returnValue); >> + >> + rs.relative(-2); >> + returnValue = rs.getString("name"); >> + System.out.println("Value="+returnValue); >> + >> + rs.relative(10); >> + System.out.println("isFirst=" + rs.isFirst() + " >> isLast=" + rs.isLast() + " isAfterLast=" + rs.isAfterLast()); >> + >> + returnValue = rs.getString("name"); >> + System.out.println("Value="+returnValue); >> + >> + } catch(SQLException sqle) { >> + dumpSQLExceptions(sqle); >> + sqle.printStackTrace(); >> + } catch(Throwable e) { >> + System.out.println("FAIL -- unexpected exception: "+e); >> + e.printStackTrace(); >> + >> + } >> + } >> + + static private void dumpSQLExceptions (SQLException se) { >> + System.out.println("FAIL -- unexpected exception"); >> + while (se != null) { >> + >> System.out.println("SQLSTATE("+se.getSQLState()+"): "+se); >> + se = se.getNextException(); >> + } >> + } >> +} >> \ No newline at end of file >> Index: >> java/testing/org/apache/derbyTesting/functionTests/master/testRelative.out >> >> =================================================================== >> --- >> java/testing/org/apache/derbyTesting/functionTests/master/testRelative.out >> (revision 0) >> +++ >> java/testing/org/apache/derbyTesting/functionTests/master/testRelative.out >> (revision 0) >> @@ -0,0 +1,9 @@ >> +Test testRelative starting >> +Value=work1 >> +isFirst=false isLast=false isAfterLast=false >> +Value=work3 >> +Value=work1 >> +isFirst=false isLast=false isAfterLast=true >> +FAIL -- unexpected exception >> +SQLSTATE(24000): SQL Exception: Invalid cursor state - no current row. >> +SQL Exception: Invalid cursor state - no current row. >> Index: >> java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall >> =================================================================== >> --- >> java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall >> (revision 159474) >> +++ >> java/testing/org/apache/derbyTesting/functionTests/suites/jdbcapi.runall >> (working copy) >> @@ -14,4 +14,5 @@ >> jdbcapi/parameterMapping.java >> jdbcapi/setTransactionIsolation.java >> jdbcapi/prepStmtNull.java >> +jdbcapi/testRelative.java >> >> >> > > >