Well, I ran into another ticket that said that the % in the strftime
call needed to be 'escaped' with another %. Seems to have fixed
it...needless to say pretty opaque and strange error.

 

Dan Winslow
Director of Information Technology, AIM INSTITUTE
1905 Harney Street, Suite 700
Omaha, NE 68102
402-345-5025 x156
dwins...@aiminstitute.org
www.aiminstitute.org

________________________________

From: trac-users@googlegroups.com [mailto:trac-us...@googlegroups.com]
On Behalf Of Dan Winslow
Sent: Thursday, August 27, 2009 7:47 AM
To: trac-users@googlegroups.com
Subject: [Trac] $USER in query

 

Hi Folks. Using TRAC 0.11, I am trying to run the following query :

 

SELECT

   id AS ticket,

   summary,

   priority,

   severity,

   status,

   type as __group__,

   owner,

   date(time,"unixepoch") as 'Created',

   date(changetime,"unixepoch") as 'Modified',

   reporter,

   (case when c.value is NULL then '' else c.value end) as 'estimate',

   (case when c3.value is NULL then '' else c3.value end) as 'actual',

   (case when c1.value is NULL then '' when c1.value = '<click to set
date>'

      then '' else c1.value end) as 'date desired',

   (case when c2.value is NULL then '' when c2.value = '<click to set
date>'

      then '' else c2.value end) as 'date due'

  FROM ticket t

     LEFT OUTER JOIN ticket_custom c ON (t.id = c.ticket AND c.name =
'estimate_hours')

     LEFT OUTER JOIN ticket_custom c1 ON (t.id = c1.ticket AND c1.name =
'date_desired')

     LEFT OUTER JOIN ticket_custom c2 ON (t.id = c2.ticket AND c2.name =
'date_due')

     LEFT OUTER JOIN ticket_custom c3 ON (t.id = c3.ticket AND c3.name =
'actual_hours')

  WHERE 

       owner = '$USER' and

       c2.value is not NULL and

       c2.value != '<click to set date>' and

       strftime("%s",substr(c2.value,7,4) || "-" || substr(c2.value,1,2)
||

                "-" || substr(c2.value,4,2)) < strftime('%s','now') and

       t.status != 'closed' and

       t.status != 'completed' and

       type not in ( 'Collaboration Ticket', 'Information Request' )

  ORDER BY lower(type),t.changetime desc

 

When doing so, I get :

 

Report execution failed: not enough arguments for format string

 

I can use '$USER' successfully in simpler queries ( select * from
tickets where owner='$USER' ), but not in more complex ones. Any
suggestions?

 

 

 

Dan Winslow
Director of Information Technology, AIM INSTITUTE
1905 Harney Street, Suite 700
Omaha, NE 68102
402-345-5025 x156
dwins...@aiminstitute.org
www.aiminstitute.org

 





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to trac-users@googlegroups.com
To unsubscribe from this group, send email to 
trac-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to