[plt-scheme] Snooze and how to delete objects?

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Jan 4 07:42:30 EST 2010

ccwu wrote:
> Hi,
> I'm using Snooze.
> I can do a sql select using
> (find-all (sql (select #:from person #:where (= age 20 ))))
> Could I also do a sql delete with #:where?
> Could I using a condition #:where (> age 20)?
> If I couldn't, how should I do to achieve a sql statement
>  delete from person where age > 20?

You can't, I'm afraid, although we could add that in the future.

At the moment you'd do this:

  (for-each delete! (find-all (sql (select #:from person #:where (> age 20 )))))

This is less efficient than what you propose as the code has to load and parse each record before it deletes it, but that's all we've got for now.

-- Dave

Posted on the users mailing list.