Yeah I hear you about the query operator, I was just looking for the
quickest solution.  The idea of exposing functions is nice.  It would
need to be trivial to add arbitrary functions to the list of
acceptable ones. Maybe even a Functions class with a class level
method_missing that returns a Functions object with the method name
and any attrs added

f = Functions.rand(5) => "#<Function method=:rand, attrs=[5]>"
f.to_s => "rand(5)"

If it was implemented this way I would shy away from abstracting the
differences between postgres and mysql...

Chris

On Mon, Nov 24, 2008 at 6:01 PM, Oleg Andreev <[EMAIL PROTECTED]> wrote:
>
>
> On 25.11.2008, at 4:37, Chris Van Pelt wrote:
>
>>
>> I'm not seeing a way to do this with postgres or mysql outside of
>> talking directly to the adapter.  Postgres uses random() and MySQL
>> uses RAND.  Maybe :rand should become a query operator?
>>
>> Peace
>
> I think, there should be a layer of adapter-independent functions:
>
> DMF = DataMapper::Functions
>
> Person.all(:order => [ DMF::Random[] ])
> Person.all(DMF::LowerCase[:name] => "oleg")
>
> random() is not an operator anyway.
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to