PS.
For now you can do:
db('(time_stop-time_start)>0.0034722').select(db.PINGER_RESULTS.ALL)
On Feb 12, 1:02 am, Alexey Nezhdanov <[email protected]> wrote:
> Hmmm. I thought that the code snippets I provided is enough. NP, here is
> more:
> db.define_table('PINGER_RESULTS',
> Field('ip','string',length=16),
> Field('time_start','datetime'),
> Field('time_stop' ,'datetime'), # -> time_stop
> Field('active','integer'), # 0 = archive, 1 = active
> )
>
> It's a simple app - it pings set of IP addresses. If some address stops
> pinging - it creates a record in db.
> If it comes back - record is closed w/.
> There are a lot of tiny alerts like 'server was inaccessible for 30
> seconds'. When browsing archive I'd like to filter these out
> So I tried to display only these which were longer than 5 minutes.
> So PINGER_RESULTS.time_stop-PINGER_RESULTS.time_start must be more than 300
> seconds.
> Indeed, in Oracle shell this query works as I need it:
>
> select * from PINGER_RESULTS where (time_stop-time_start)>0.0034722;
> -- Oracle measured datetime difference as floating number - days.
>
> On Thu, Feb 11, 2010 at 9:14 PM, mdipierro <[email protected]> wrote:
> > can you provide an example of usage?
>
> > On Feb 11, 12:48 am, Alexey Nezhdanov <[email protected]> wrote:
> > > Hi.
> > > Sorry, didn't check if that bug still exists in latest version.
> > > Here is the problem: in Oracle substracting one datetime column from the
> > > other gives the floating number (days).
> > > However the web2py considers the result to be another datetime, so this
> > Set
> > > produces invalid condition string:
>
> > > (Pdb) print (table.time_stop-table.time_start)>300/24.0/3600
>
> > (PINGER_RESULTS.time_stop-PINGER_RESULTS.time_start)>to_date('0.00347222222222','yyyy-mm-dd
> > > hh24:mi:ss')
>
> > > I worked around it with:
> > > 31 diff = (table.time_stop-table.time_start)
> > > 32 diff.type = 'double'
> > > 33 import pdb;pdb.set_trace()
>
> > > (Pdb) print diff > 3600.0/24/3600
> > > (PINGER_RESULTS.time_stop-PINGER_RESULTS.time_start)>0.041666666666666664
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<web2py%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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.