The doDelete method is very limited. It looks at the criteria for a primary key and then deletes the single row referenced by that pk. Long ago, doUpdate worked similarly. It was modified so that the where clause was built similarly to the doSelect method. doDelete could use the same overhaul, but no one has ever taken the time to do it. If someone does, feel free to remove the cascading code as it very likely does not work anyway, and recoding will be easier without it. Until then BasePeer.executeStatement is your best bet for deletions.
john mcnally Pete Kazmier wrote: > > A followup question, how do you do the following in Torque: > > DELETE FROM table WHERE id=5 OR id=23 > > I tried (from an exmample using Criteria in the Peers HOWTO, although > that was for a doSelect()): > > Criteria crit = new Criteria(); > Criteria.Criterion c1 = > crit.getNewCriterion(BookPeer.ISBN, "123", Criteria.EQUAL); > Criteria.Criterion c2 = > crit.getNewCriterion(BookPeer.ISBN, "456", Criteria.EQUAL); > crit.add(c1.or(c2)); > BookPeer.doDelete(crit); > > Did I do something incorrect? The doDelete() only deleted one row, not > both. > > Thanks, appreciate your help, and promise to stick answer in the > tutorial I am writing. > > Thanks, > Pete > > On Wed, Jan 23, 2002 at 03:48:46PM -0500, Pete Kazmier wrote: > > Quick question for any torque users out there (trying to finish up a > > Torque tutorial for the community), should BasePeer.doDelete(crit) with > > an empty Criteria object (crit = new Criteria()) delete everything or > > nothing in my table? > > > > I saw the BasePeer.deleteAll() convience method, but was wondering why > > doDelete() didn't emulate doSelect() when passed an empty Criteria > > object. I was expecting it to delete everything, just as doSelect() > > would have selected everything. > > > > Thanks, > > Pete > > > > -- > > Peter Kazmier http://www.kazmier.com > > PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654 > > > > -- > > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > > > > -- > Peter Kazmier http://www.kazmier.com > PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654 > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
