Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 42592 invoked from network); 10 Jun 2008 02:02:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jun 2008 02:02:38 -0000 Received: (qmail 73547 invoked by uid 500); 10 Jun 2008 02:02:40 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 73173 invoked by uid 500); 10 Jun 2008 02:02:39 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@cocoon.apache.org List-Id: Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 73082 invoked by uid 99); 10 Jun 2008 02:02:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Jun 2008 19:02:38 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 Jun 2008 02:01:57 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 1FB4B234C13A for ; Mon, 9 Jun 2008 19:01:45 -0700 (PDT) Message-ID: <2083523671.1213063305128.JavaMail.jira@brutus> Date: Mon, 9 Jun 2008 19:01:45 -0700 (PDT) From: =?utf-8?Q?J=C3=B6rg_Heinicke_=28JIRA=29?= To: dev@cocoon.apache.org Subject: [jira] Updated: (COCOON-1740) Modular DatabaseSelectAction incorrectly handles multiple rows In-Reply-To: <412081811.1138101588733.JavaMail.jira@ajax.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/COCOON-1740?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] J=C3=B6rg Heinicke updated COCOON-1740: ---------------------------------- Status: Continued (was: On Hold) Missing test case isn't really a reason for on hold. > Modular DatabaseSelectAction incorrectly handles multiple rows > -------------------------------------------------------------- > > Key: COCOON-1740 > URL: https://issues.apache.org/jira/browse/COCOON-1740 > Project: Cocoon > Issue Type: Bug > Components: Blocks: Databases > Affects Versions: 2.1.8, 2.1.9, 2.2 > Reporter: Tuomo Lesonen > Priority: Minor > Attachments: 20060310-cocoon-databases, DatabaseAction.java, Data= baseSelectAction.java > > > When one needs to select multiple rows from a table, and the keys used to= identify the rows vary, for example when request-param inputmodule is used= with parameter-value of "id[*]", the outputted parameters are not unique.= For example, when there are 3 different variations of the keys, and every = variation returns a single row, the following is outputted: > =3D=3D> row #0 > o.a.c.components.modules.output.OutputModule:user.id[0] > o.a.c.components.modules.output.OutputModule:user.username[0] > o.a.c.components.modules.output.OutputModule:user.password[0] > =3D=3D> row #1 > o.a.c.components.modules.output.OutputModule:user.id[1] > o.a.c.components.modules.output.OutputModule:user.username[0] > o.a.c.components.modules.output.OutputModule:user.password[0] > =3D=3D> row #2 > o.a.c.components.modules.output.OutputModule:user.id[2] > o.a.c.components.modules.output.OutputModule:user.username[0] > o.a.c.components.modules.output.OutputModule:user.password[0] > What happens is that on every row the names of the previous output-parame= ters from the value-fields (in descriptor) are overwritten with the new nam= es, since the index is always forced back to zero. > Because of this, the values from matching rows cannot be "forwarded" to o= ther actions for additional processing (ie. DatabaseDeleteAction). > The correct output should be: > =3D=3D> row #0 > o.a.c.components.modules.output.OutputModule:user.id[0] > o.a.c.components.modules.output.OutputModule:user.username[0] > o.a.c.components.modules.output.OutputModule:user.password[0] > =3D=3D> row #1 > o.a.c.components.modules.output.OutputModule:user.id[1] > o.a.c.components.modules.output.OutputModule:user.username[1] > o.a.c.components.modules.output.OutputModule:user.password[1] > =3D=3D> row #2 > o.a.c.components.modules.output.OutputModule:user.id[2] > o.a.c.components.modules.output.OutputModule:user.username[2] > o.a.c.components.modules.output.OutputModule:user.password[2] > The only way this output can be achieved is when the keys do not vary, an= d multiple rows are returned. But this is not always the case, as the examp= le above demonstrates. > Here's the descriptor-snippet from the previous example: > > > > > > > > > > >
> I have fixed this by adding a class variable "sumIndex" to DatabaseAction= .java, which is incremented in DatabaseSelectAction.java in method "process= Row". sumIndex is then used to produce unique names for the output-paramete= rs. Finally sumIndex contains the total rows selected. > Patched files (2) attached. --=20 This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.