[Cl-perec-devel] Idea to query language
alexeys9 at mail.ru
Fri Dec 12 19:10:02 UTC 2008
I have an idea about query language.
Often I write conditions for querying objects that contains in their
slots (objects have the same class) one of values containing in the
list, and form "from" of query turn into long form "or" (or (eq slot 1)
(eq slot 2) ...), i create function that construct this condition:
(defun in (slot-name values)
`(or ,@(mapcar (lambda (v) `(eq (quote ,slot-name) ,v)) values)))
Then I can write:
(from (o rank))
(where ,(in 'name '("one" "two" "three"))))))
in PostgreSQL query language this presented as:
WHERE slot IN VALUES (1::int,2,3)
In databases that query languages support this syntax construction,
transform this as is,
in databases that query language not support this syntax, extract to
long form "OR".
As I know this feature included in SQL standard.
Maybe this would be worth to include as form in cl-perec query language?
We will can be use it without quote and outer "eval".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cl-perec-devel