Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 35863 invoked from network); 8 Dec 2005 22:31:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Dec 2005 22:31:04 -0000 Received: (qmail 62501 invoked by uid 500); 8 Dec 2005 22:30:57 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 62413 invoked by uid 500); 8 Dec 2005 22:30:56 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 62349 invoked by uid 99); 8 Dec 2005 22:30:56 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2005 14:30:56 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [83.247.21.91] (HELO wis.nl) (83.247.21.91) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Dec 2005 14:30:54 -0800 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: RE: Multiple deletes? [signed] Date: Thu, 8 Dec 2005 23:29:55 +0100 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Message-ID: <50CA25BD6EEA954FA592C097399942E309313A5C@CM1.wis.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Multiple deletes? [signed] Thread-Index: AcX8HI3n/P+3DRggTuON2WUCuQbojwAB+NEgAAiO4UA= From: "Niels Beekman" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Larry means iterating your list, that would still result in one query, but one that works and still protects against SQL injection. Niels -----Original Message----- From: Michael Laccetti [c] [mailto:michael@s2g-limited.com]=20 Sent: donderdag 8 december 2005 23:12 To: user-java@ibatis.apache.org Subject: RE: Multiple deletes? [signed] If I used iteration, I'd have a lot of queries. Since this database can scale to be pretty huge, I'd prefer to not do that. Also, the information isn't blindly pulled from a form, and then jammed into the database. Validation does happen. And it worked. Thanks kindly. :)=20 -----Original Message----- From: larry.meadors@gmail.com [mailto:larry.meadors@gmail.com] On Behalf Of Larry Meadors Sent: December 8, 2005 12:26 PM To: user-java@ibatis.apache.org Subject: Re: Multiple deletes? You could do this: DELETE FROM ALERTS WHERE ID IN ($value$) It is beggin for SQL injection, but...it will work. A better route would be to use iteration to do it. Larry On 12/8/05, Michael Laccetti [c] wrote: > I have the following statement defined in iBATIS: > > > DELETE FROM ALERTS WHERE ID IN (#value#) > > I pass it a String in the form of 322,321,320,319,318,317,316,315,314,313. > > Now, when I call it, I get the following: > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23] > java.sql.PreparedStatement - {pstm-100004} PreparedStatement: DELETE > FROM ALERTS WHERE ID IN (?) > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23]=20 > java.sql.PreparedStatement - {pstm-100004} Parameters: > [322,321,320,319,318,317,316,315,314,313] > DEBUG [08 Dec 05 11:19:26] [http-8080-Processor23]=20 > java.sql.PreparedStatement - {pstm-100004} Types: [java.lang.String]=20 > ERROR [08 Dec 05 11:19:26] [http-8080-Processor23]=20 > com.cibcwm.go.otis.gowmon.web.struts.action.IndexAction - Could not=20 > remove > alert(s) from database. > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in conf/gowmon.xml. > --- The error occurred while applying a parameter map. > --- Check the deleteAlerts-InlineParameterMap. > --- Check the statement (update failed). > --- Cause: org.apache.derby.client.am.SqlException: Invalid character=20 > string format for type INTEGER. > > I know that the statement itself is valid; I can run it directly no problem. > The question is, how do I get this to work with iBATIS. > > Mike > > > > --=20 ------------------------ [ SECURITY NOTICE ] ------------------------ To: user-java@ibatis.apache.org. For your security, michael@s2g-limited.com digitally signed this message on 08 December 2005 at 22:12:00 UTC. Verify this digital signature at http://www.ciphire.com/verify. ------------------- [ CIPHIRE DIGITAL SIGNATURE ] ------------------- Q2lwaGlyZSBTaWcuAjh1c2VyLWphdmFAaWJhdGlzLmFwYWNoZS5vcmcAbWljaGFlbEBzM mctbGltaXRlZC5jb20AZW1haWwgYm9keQAWBwAAfAB8AAAAAQAAALCvmEMWBwAA1AIAAg ACAAIAIIXYnAvwVJnXYkeNqqLiR5ZyHRK7W0tiTAYcV7p1uX8mAQAxTkdmLdtsIbMe4FE 6BpyDx/u9eVN0WyoQPcWCmWDyD4nx1YYqYYJFhJjvEsvbzUkcDGWnSTD5jThDnRCEWtKE XaAcU2lnRW5k --------------------- [ END DIGITAL SIGNATURE ] ---------------------