#3465: SQL parse problem with $USER and strftime("%s", changetime)
-----------------------------------------+----------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  daniel
     Type:  defect                       |      Status:  new   
 Priority:  normal                       |   Milestone:        
Component:  report system                |     Version:  0.9.5 
 Severity:  normal                       |    Keywords:        
-----------------------------------------+----------------------------------
 I was just trying to create a report that shows all tickets of currently
 logged user that have had any activity in last month.

 Being fairly new to SQL, I tried the following SQL statement:
 {{{
 SELECT id AS ticket, summary, component, status,
    resolution, changetime AS modified,
    time AS _time FROM ticket
    WHERE strftime ("%s", current_date) - 60*60*24*30 < changetime
 ORDER BY changetime
 }}}
 This seems to work fine.

 However, when I add another condition (" and owner = $USER"), I get the
 following error:
 "Report execution failed: not enough arguments for format string".

 Funny thing is, if I hardcode the value, as in " and owner = "joe" ", it
 works fine. I've tried putting parentheses around both conditions, but
 that did not help.
 It seems to me like a parsing problem (when both %s and $USER are present,
 the parser is somehow confused).

 Can anyone else confirm this problem? Or just kick me into my head for
 doing something obviously wrong?
 (Before you ask, the value of "$USER" was perfectly normal "joe" and
 worked fine alone.)

-- 
Ticket URL: <http://trac.edgewall.org/ticket/3465>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets

Reply via email to