On 9/26/07, Renato Lucindo lucindo@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