[Cl-perec-devel] [patch] (select (foo) (from foo)) / (select (foo) (from (foo foo))) inconsistency

Levente Mészáros levente.meszaros at gmail.com
Fri Jun 27 15:18:38 UTC 2008


2008/6/27 Stanislaw Halik <sthalik+perec at tehran.lain.pl>:
> Heya,
>
> The query structure generated by the query:
>
>  (select (foo) (from (foo foo)))
>
> asserts (typep foo 'foo).
>
> The query "(select (foo) (from foo))" doesn't. This has an effect of
> pulling objects from other classes into the result:
>
>  PRC> (with-transaction
>         (select (foo) (from foo)))
That's not an accident.

When the from clause contains only a symbol (as is in your second
query) then it is the name of the query variable which can be used to
refer to instances within the where clause, for example:

(select (foo) (from foo)
  (where (and (typep foo 'bar)
                      (baz? foo)))

If you don't provide the name of persistent class in the from clause
then the variable will scan through all persistent instances. Try:

(select (alma) (from alma))

even if you don't have a class named alma you will get all persistent instances.

When the from clause is a list of two symbols, then the first is the
name and the second is the type. So

Hope this helps,
levy

-- 
There's no perfectoin



More information about the cl-perec-devel mailing list