Hey Thomas, Am 07.09.2007 um 09:40 schrieb Thomas Vander Stichele: > I am trying to figure out what the syntax is for SQL for reports. > There > is some explanation in the Trac documentation, but I've seen mails and > tricks that are not documented there, and I was wondering about what > else can be done. > > For example, I've seen > datetime(time, 'unixepoch', 'localtime') AS created > > and I seem to remember I've also seen casts to integer in some report. > > What was the SQL syntax copied/derived from, what other hidden > treasures > can I expect ?
The SQL is simply passed on to the database verbatim, there's no translation of any kind going on. The only thing Trac does is inspect the column names in the results, and applies styling, grouping, and the like to the HTML output, as described in the docs > Here are some example things I wonder about if I can do them: > - The CC field is a text value, with comma-separated email addresses. > I'd like to make a report that, for each ticket, lists the number of > cc'd people, so I need to split on comma then count number of items. > Can this be done ? > - Assume I have a custom field that references a master ticket. Can I > use an inner query to count the number of tickets referencing my > master > ticket ? These would be at least tricky. I'm no big reports user, so I'll let someone else chime in here :P > Also, while looking for more information, I found a note in the docs > saying that reports are deprecated and that queries can do all that > reports can do. > > In some ways queries are more powerful, because you can easily > customize > them to drill deeper. But on the other hand, it doesn't seem like a > complete replacement yet compared to the full power of SQL. > > Also, I noticed that I cannot group by a custom field, even though > I can > filter by a custom field. Is this a simple oversight, or by design ? Hmm, custom fields show up for me. What type is the field you're missing? > Are there other things that ticket query will support before > reports get > deprecated ? The most important thing IMO is date-based and OR'ed queries. Note also that if/when we phase out reports, there will definitely be an external plugin to replace the core module, so the functionality won't really be gone, it'll just no longer be out-of-the-box. Cheers, Chris -- Christopher Lenz cmlenz at gmx.de http://www.cmlenz.net/ --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
