From derby-dev-return-16560-apmail-db-derby-dev-archive=db.apache.org@db.apache.org Wed Mar 08 12:51:07 2006 Return-Path: Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: (qmail 91610 invoked from network); 8 Mar 2006 12:51:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Mar 2006 12:51:05 -0000 Received: (qmail 37247 invoked by uid 500); 8 Mar 2006 12:51:04 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 37005 invoked by uid 500); 8 Mar 2006 12:51:03 -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 36995 invoked by uid 99); 8 Mar 2006 12:51:03 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Mar 2006 04:51:03 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Mar 2006 04:51:02 -0800 Received: from ajax (localhost.localdomain [127.0.0.1]) by ajax (Postfix) with ESMTP id 3920E6ACA9 for ; Wed, 8 Mar 2006 12:50:41 +0000 (GMT) Message-ID: <1441519752.1141822241231.JavaMail.jira@ajax> Date: Wed, 8 Mar 2006 12:50:41 +0000 (GMT) From: "Andreas Korneliussen (JIRA)" To: derby-dev@db.apache.org Subject: [jira] Commented: (DERBY-1087) Updatable result sets behave different depending on whether indexes are used or not In-Reply-To: <294821727.1141817198974.JavaMail.jira@ajax> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/DERBY-1087?page=comments#action_12369435 ] Andreas Korneliussen commented on DERBY-1087: --------------------------------------------- > If the first query is "SELECT a, b FROM t1 WHERE a <= 5", the output will be: > Cursor 'SQLCUR0' is not on a row. > A = 1 > A = 3 > A = 4 > A = 5 > A = 6 > A = 7 > A = 8 > A = 9 > A = 10 > A = 22 The fact that you get "Cursor 'SQLCUR0' is not on a row." when using indexes seems like a bug. Can you confirm that if the query is "SELECT a, b FROM t1 WHERE a <= 5", and there is no index on the table (no primary key), you do not get this error ? > Updatable result sets behave different depending on whether indexes are used or not > ----------------------------------------------------------------------------------- > > Key: DERBY-1087 > URL: http://issues.apache.org/jira/browse/DERBY-1087 > Project: Derby > Type: Bug > Reporter: Fernanda Pizzorno > Assignee: Fernanda Pizzorno > > Running the following code with different queries in the first statement produces different results. > Where t1 has two columns: "a" of type int is the primary key, and "b" of type varchar(50); and contains 10 rows of data. > Statement st1 = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, > ResultSet.CONCUR_UPDATABLE); > Statement st2 = conn.createStatement(); > > ResultSet rs = st1.executeQuery("SELECT a, b FROM t1"); > rs.next(); > rs.next(); > st2.executeUpdate("UPDATE t1 SET a = a + 20 WHERE a = " + > rs.getInt(1)); > try { > rs.updateInt(1, rs.getInt(1) + 30); > rs.updateRow(); > } catch (SQLException se) { > System.out.println(se.getMessage()); > } > rs.close(); > > rs = st2.executeQuery("SELECT a FROM t1"); > while(rs.next()) { > System.out.println("A = " + rs.getInt(1)); > } > rs.close(); > > st2.close(); > st1.close(); > If the first query is "select a, b from t1", the output will be: > A = 1 > A = 3 > A = 4 > A = 5 > A = 6 > A = 7 > A = 8 > A = 9 > A = 10 > A = 32 > If the first query is "SELECT a, b FROM t1 WHERE a <= 5", the output will be: > Cursor 'SQLCUR0' is not on a row. > A = 1 > A = 3 > A = 4 > A = 5 > A = 6 > A = 7 > A = 8 > A = 9 > A = 10 > A = 22 > If the first query is "SELECT a FROM t1", the output will be: > Cursor 'SQLCUR0' is not on a row. > A = 1 > A = 3 > A = 4 > A = 5 > A = 6 > A = 7 > A = 8 > A = 9 > A = 10 > A = 22 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira