Return-Path: X-Original-To: apmail-db-derby-dev-archive@www.apache.org Delivered-To: apmail-db-derby-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ACBD910A9B for ; Tue, 22 Oct 2013 17:14:57 +0000 (UTC) Received: (qmail 1617 invoked by uid 500); 22 Oct 2013 17:14:53 -0000 Delivered-To: apmail-db-derby-dev-archive@db.apache.org Received: (qmail 548 invoked by uid 500); 22 Oct 2013 17:14:50 -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 467 invoked by uid 99); 22 Oct 2013 17:14:46 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Oct 2013 17:14:46 +0000 Date: Tue, 22 Oct 2013 17:14:46 +0000 (UTC) From: "Kim Haase (JIRA)" To: derby-dev@db.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Assigned] (DERBY-6388) Example WHERE CURRENT OF clause in Reference Guide is nonsense MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DERBY-6388?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kim Haase reassigned DERBY-6388: -------------------------------- Assignee: Kim Haase > Example WHERE CURRENT OF clause in Reference Guide is nonsense > -------------------------------------------------------------- > > Key: DERBY-6388 > URL: https://issues.apache.org/jira/browse/DERBY-6388 > Project: Derby > Issue Type: Bug > Components: Documentation > Affects Versions: 10.11.0.0 > Reporter: Rick Hillegas > Assignee: Kim Haase > > The Reference Guide section titled "WHERE CURRENT OF clause" provides some sample code. The code doesn't even compile. It has a number of defects: > 1) Autocommit needs to be turned on. > 2) The cursor name needs to be ALL CAPS in the s.setCursorName() statement. > 3) The ResultSet needs to be created from the statement and can't be created directly from the connection. > 4) The ResultSet needs to be positioned before the UPDATE is run. > The following cleaned-up code compiles and runs correctly: > conn.setAutoCommit( false ); > Statement s = conn.createStatement(); > s.setCursorName("AIRLINESRESULTS"); > ResultSet rs = s.executeQuery( > "SELECT Airline, basic_rate " + > "FROM Airlines FOR UPDATE OF basic_rate"); > rs.next(); > Statement s2 = conn.createStatement(); > s2.executeUpdate("UPDATE Airlines SET basic_rate = basic_rate " + > "+ .25 WHERE CURRENT OF AirlinesResults"); -- This message was sent by Atlassian JIRA (v6.1#6144)