ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Laccetti [c]" <mich...@s2g-limited.com>
Subject RE: Multiple deletes? [signed]
Date Thu, 08 Dec 2005 23:28:25 GMT
Yeah, I just saw Eric's suggestion.  That looks pretty good, I'm going to
switch it to that tomorrow.

Mike 

-----Original Message-----
From: Niels Beekman [mailto:n.beekman@wis.nl] 
Sent: December 8, 2005 5:30 PM
To: user-java@ibatis.apache.org
Subject: RE: Multiple deletes?

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]
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.  :) 

-----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] <michael@s2g-limited.com> wrote:
> I have the following statement defined in iBATIS:
>
> <delete id="deleteAlerts" parameterClass="java.lang.String">
>   DELETE FROM ALERTS WHERE ID IN (#value#) </delete>
>
> 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] 
> 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] 
> java.sql.PreparedStatement - {pstm-100004} Types: [java.lang.String] 
> ERROR [08 Dec 05 11:19:26] [http-8080-Processor23] 
> com.cibcwm.go.otis.gowmon.web.struts.action.IndexAction - Could not 
> 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 
> 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
>
>
>
>








-- 
------------------------ [ SECURITY NOTICE ]
------------------------
To: user-java@ibatis.apache.org.
For your security, michael@s2g-limited.com
digitally signed this message on 08 December 2005 at 23:28:26 UTC.
Verify this digital signature at http://www.ciphire.com/verify.
------------------- [ CIPHIRE DIGITAL SIGNATURE ]
-------------------
Q2lwaGlyZSBTaWcuAjh1c2VyLWphdmFAaWJhdGlzLmFwYWNoZS5vcmcAbWljaGFlbEBzM
mctbGltaXRlZC5jb20AZW1haWwgYm9keQAmCQAAfAB8AAAAAQAAAJrBmEMmCQAA4gIAAg
ACAAIAIIXYnAvwVJnXYkeNqqLiR5ZyHRK7W0tiTAYcV7p1uX8mAQAxTkdmLdtsIbMe4FE
6BpyDx/u9eVN0WyoQPcWCmWDyD3Tk9a6CzZGZZZHs9QMS46dnovwOKE/ECrHXb0+o/yGh
iPQGU2lnRW5k
--------------------- [ END DIGITAL SIGNATURE ]
---------------------



Mime
View raw message