db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6388) Example WHERE CURRENT OF clause in Reference Guide is nonsense
Date Mon, 13 Jan 2014 20:22:52 GMT

    [ https://issues.apache.org/jira/browse/DERBY-6388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13869925#comment-13869925
] 

ASF subversion and git services commented on DERBY-6388:
--------------------------------------------------------

Commit 1557834 from [~chaase3] in branch 'docs/trunk'
[ https://svn.apache.org/r1557834 ]

DERBY-6388  Example WHERE CURRENT OF clause in Reference Guide is nonsense

Modified a Reference Manual topic.

Patch: DERBY-6388-2.diff

> 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
>             Fix For: 10.10.1.4, 10.11.0.0
>
>         Attachments: DERBY-6388-2.diff, DERBY-6388.diff, rrefsqlj15309.html, rrefsqlj15309.html
>
>
> 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.5#6160)

Mime
View raw message