On 4/6/2011 1:47 PM, Eike Jordan wrote:

Cool, Thx alot! Not the first time, i ran into that kind of casting problems ;-)
Something like "typeof(value)" as in javascript whould be really useful.

Concerning the differences in time handling when upgrading from 0.11.4 to 0.12.1 i struggle with two more SQL expressions that don't give the expected results anymore:

1. calculate the difference between "now" and the ticket changetime and compare it
   with a number (of days)

   ((julianday('now') - julianday(changetime, 'unixepoch')) < 31)

Well, changetime is also expressed in microseconds in Trac 0.12, so you need to / 1000000.


2. calculate the difference between "now" and a given date (e.g. ticket_due)

round(julianday('now') - julianday(strftime("%s", ('2011-01-14'), 'unixepoch')) as days

Are you sure this ever worked? http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions might be useful reading here, e.g.

sqlite> select round(julianday('now') - julianday(strftime('%s', '2011-01-14'), 'unixepoch'));
  84.0

or simply:

  sqlite>  select round(julianday('now') - julianday('2011-01-14'));
  84.0




I tried out a similar syntax as in report 23 [1] on the edgewall site, but

(SELECT ((time.now * 1000000 - changetime) / 1000000.0) AS delta

resulted in an execution error: "Report execution failed: no such column: time.now"

Right now, i don't have a clue what i'm missing :-/

That particular site is using PostgreSQL and not SQLite, so I've now added a caveat for all those reports ;-)


[1] http://trac.edgewall.org/report?id=21&format=sql

Hope this helps!

-- Christian

--
You received this message because you are subscribed to the Google Groups "Trac 
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/trac-users?hl=en.

Reply via email to