<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.18.3">
</HEAD>
<BODY>
Hello.<BR>
I have an idea about query language.<BR>
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:<BR>
<BR>
(defun in (slot-name values)<BR>
`(or ,@(mapcar (lambda (v) `(eq (quote ,slot-name) ,v)) values)))<BR>
<BR>
Then I can write:<BR>
<BR>
(eval `(with-transaction<BR>
(select (p)<BR>
(from (o rank))<BR>
(where ,(in 'name '("one" "two" "three"))))))<BR>
<BR>
in PostgreSQL query language this presented as:<BR>
<BR>
SELECT *<BR>
FROM class_table<BR>
WHERE slot IN VALUES (1::int,2,3)<BR>
<BR>
<A HREF="http://www.postgresql.org/docs/8.3/interactive/sql-values.html">http://www.postgresql.org/docs/8.3/interactive/sql-values.html</A><BR>
<BR>
In databases that query languages support this syntax construction, transform this as is,<BR>
in databases that query language not support this syntax, extract to long form "OR".<BR>
<BR>
As I know this feature included in SQL standard.<BR>
<BR>
Maybe this would be worth to include as form in cl-perec query language?<BR>
We will can be use it without quote and outer "eval".
</BODY>
</HTML>