[postmodern-devel] Selecting dao's

Renato Lucindo lucindo at gmail.com
Thu Sep 27 03:48:21 UTC 2007


I think (a) is just a problem in sense the of the mixing optional and
keyword arguments because on the select-dao macro the generated sql
aways have a 'where' clause, with the default being "where true".

"select .... where true limit ? offset ?" and/or "select .... where
true order-by ?" should work.

Off course, the (:limit ...) and (:order-by ...) should only be added
to the S-SQL inside select-dao when the keywords paramaters are
specified.

On 9/26/07, Ryszard Szopa <ryszard.szopa at gmail.com> wrote:
> On 9/26/07, Renato Lucindo <lucindo at gmail.com> wrote:
>
> > There is some way to select a limited number of daos without using query-dao?
> >
> > I think in something like that: the function select-dao accepting some
> > key parameters, like :limit, :offset, :order-by...
>
> SELECT-DAO already accepts an optional argument, i.e. TEST. Adding
> additional arguments could be done in three ways: (a) by keeping TEST
> optional and making the rest keyword arguments, (b) by making all
> arguments optional, or (c) by making all arguments keywords. Approach
> (a) doesn't seem nice: we mix optional and keyword arguments, and we
> cannot naturally make e.g. a query with a limit but without a test.
> (b) doesn't seem sensible, because you would have to memorize the
> order of the arguments, plus the second part of the argument against
> (a). (c) breaks older code, which usually is perceived as bad.
>
> >
> > (select-dao 'my-entity :limit 100)
> >
> > to be same as
> >
> > (query-dao 'my-entity (:limit (:select '* :from 'my-entity) 100))
> >
> > I think this would be useful in many applications, and allow the
> > developer to write code without SQL.
>
> Well, writing the (:select '* :from... indeed may be annoying. But do
> you feel it is annoying enough to risk any of the problems I mentioned
> above?
>
> Cheers,
>
>     -- Richard
> --
> http://szopa.tasak.gda.pl/
> _______________________________________________
> postmodern-devel mailing list
> postmodern-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/postmodern-devel
>



More information about the postmodern-devel mailing list