Skip to content

Null clause #56

Description

I don't know if anyone's actually maintaining this package anymore, but I looked at the source and can't figure out how to solve it.

The problem here is sometimes I want to use a where or limit clause, and sometimes I don't. So given that select is a macro, how do I selectively include or exclude a clause?

Here's what I tried:

(defun select-from-db (my-limit my-where)
 (select columns
  (from mytable)
  (and my-limit (where my-limit)
  (and my-where (limit my-where)))

The idea being that I can pass nil for these values, and have the clauses omitted. But this doesn't work. The package complains that "you can't have null twice" or some such.

Without duplicating my code four times, how can I selectively include or exclude clauses?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions