Custom SQL Query for RT at a glance

Hello,

I have now spent hours to find out how to integrate custom SQL commands
into an extension for the RT at a glance page.
I know that I could easily use PERLs SQL interface to do the job.
But I wonder if I could not use the existing SQL handle of RT to execute
an SQL command on the RT database.

I want to get the count of transactions grouped by users and different
time spans.
With that it would be possible to get an activity overview of my users.

I do not want to use the search builder as I find it too complicated and
slow.
On the other side I have already a problem with another query which is
very slow with TicketSQL but not on mySQL directly.

Thank you in advance.

Best regards,
Michel Kohl

Hello,

I have now spent hours to find out how to integrate custom SQL commands
into an extension for the RT at a glance page.
I know that I could easily use PERLs SQL interface to do the job.
But I wonder if I could not use the existing SQL handle of RT to execute
an SQL command on the RT database.

Michel,

This will get you a DBI-style database handle:

my $dbh = $RT::Handle->dbh;

I’d only use this for reading from the DB. You could ruin your day by
doing direct SQL updates.

Steve

Stephen Turner
Senior Programmer/Analyst - SAIS
MIT IS&T

Stephen Turner schrieb:

This will get you a DBI-style database handle:
my $dbh = $RT::Handle->dbh;
I’d only use this for reading from the DB. You could ruin your day by
doing direct SQL updates.
Steve

Steve,

Thank you very much, works great!

Michel