On 22 jun, 20:58, mdipierro <[email protected]> wrote:
> It is not possible. We cannot ask the SQL engine to run a function
> (date+timedelta) that is only defined in the client (*).
> The only two ways to do it are:
>
> 1) the function only need to act on constant data (i.e. the right hand
> side) and we support that already
>
> 2) fetch all the data and apply the filter client (*)-side. You can do
> this yourself:
>
> rows=db().select(db.my_table.ALL)
> rows=[row for row in rows if row.start_date+datetime.timedelta
> (days=row.ndays)>=current_date]
>
> You can do this already and I think it is better to explicit when a
> filtering is done client (*)-side.
>
> (*) Here by client I mean database client (i.e. web2py) not the http
> client (i.e. the browser)
>
> Massimo
>

In firebird can do:

select * from my_table where start_date <= (current_date - ndays);

or

select * from my_table where (start_date + ndays) >= current_date;

I do not know in other engines

Jose


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to