Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 78321 invoked from network); 18 Apr 2008 14:21:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Apr 2008 14:21:32 -0000 Received: (qmail 12132 invoked by uid 500); 18 Apr 2008 14:21:33 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 12119 invoked by uid 500); 18 Apr 2008 14:21:33 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 12108 invoked by uid 99); 18 Apr 2008 14:21:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Apr 2008 07:21:33 -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; Fri, 18 Apr 2008 14:20:58 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 9D4AB234C0DF for ; Fri, 18 Apr 2008 07:18:21 -0700 (PDT) Message-ID: <608639064.1208528301642.JavaMail.jira@brutus> Date: Fri, 18 Apr 2008 07:18:21 -0700 (PDT) From: "Brendan Miller (JIRA)" To: torque-dev@db.apache.org Subject: [jira] Commented: (TORQUE-113) doDelete with invalid column should throw exception, not delete all rows In-Reply-To: <48218368.1208453241659.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/TORQUE-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590465#action_12590465 ] Brendan Miller commented on TORQUE-113: --------------------------------------- For this reason, we *always* use the Peer class constants. It is a good way to a) only have one string literal defined in the codebase for each column and b) a good way to let the compiler tell you when someone changed a column name in the schema, but didn't update code using the column names. Nonetheless, it might be wise to add a note in some documentation somewhere about the behavior. I do think that Criteria validation, if already being performed by ProcessTables should throw an Exception and refuse to delete records over deleting all records. > doDelete with invalid column should throw exception, not delete all rows > ------------------------------------------------------------------------ > > Key: TORQUE-113 > URL: https://issues.apache.org/jira/browse/TORQUE-113 > Project: Torque > Issue Type: Bug > Components: Runtime > Affects Versions: 3.3 > Reporter: Julian Zinn > Fix For: 3.3, 4.0 > > > The following (incorrect) client code should cause an exception to be thrown. Instead of an exception, all rows in table T1 are deleted. > {code} > T1Peer.doDelete(new Criteria().add(T2Peer.COL, 2)); > {code} > This code appeared in a project I am working on. The intent was to delete rows from table T2. > Before the fix for TORQUE-93, this code had the intended effect becaue {{T1Peer.doDelete(criteria)}} just passed the criteria object to {{BasePeer.doDelete(criteria)}}. Since the only reference BasePeer had to a table was table T2 in the criteria, only rows in table T2 were deleted. > Now that {{T1Peer.doDelete(criteria)}} calls {{BasePeer.doDelete(criteria, TABLE_NAME)}} instead, the test {{if (crit.containsKey(key))}} in {{BasePeer.processTables()}} always fails. This leads to an empty where clause, causing all rows in table T1 to be deleted. > *Expect*: All Criterion objects in a Criteria should be used in the final where clause. If not, an exception should be thrown. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org