[Rt-devel] DBIx::SearchBuilder and two database connections

Tina Schade Tina.Schade at gmx.de
Fri Jul 23 07:54:25 EDT 2004


Am Freitag, 23. Juli 2004 11:54 schrieb Ruslan U. Zakirov:
> Tina Schade wrote:
> > Hello folks,
> >
> > I have the problem that my RT-Search doesn´t work correctly. The reason
> > is that I have createt a second local DBIx::Handle for my own database
> > connection. Now RT  searches for tickets in my database sometimes, but of
> > course it couldn´t find relation tickets in my database. But RT does it
> > not always. Sometimes I get results, when I click two or three time the
> > reload button!
> >
> >
> > When I created the $CDB::Handle global, so RT works but searchs always in
> > my own database, although the Handle has different names and parameters.
>
> How do you create this object? Some code?
>
Ruslan, I forgot to post the mail to list...here it comes.

I create a new folder CDB in ../rt3/lib/ and put there my files for my own 
database-connection (see attachment). There are also a Handle.pm. In 
./rt3/lib/ I put CDB.pm and called it in webmux.pl with use CDB and 
CDB::Init(). In Init() I create a new instance  of my CDB::Handle, but the 
database-connection I create in my own autohandler.

When I create my own SearchBuilder and Record in folder CDB, so it could maybe 
work. Does I have to regard something else?


> > I create the local $CDB::Handle connection in my own autohandler, which
> > is in path /rt3/share/html/Ticket/. I also tried to disconnect my
> > database in /rt3/share/html/autohandler, with no success.
> >
> > It also doesn´t work to create my $handle = DBIx::SearchBuilder->new() in
> > my own autohandler.
>
> It's wrong idea.  You shoul subclass DBIx::SearchBuilder and
> DBIx::SearchBuilder::Record or use RT's classes.
>
> > Now my question. Does I can use DBIx::SearchBuilder for my second
> > database connection? Does SearchBuilder bear up more than one
> > database-connection in one application, expecially RT?
> > How can I realise two database-connection else, without creating  and
> > closing a connection in every file I need it?
>
> It's not a problem of DBIx::SB as I think. IMHO you override something
> in RT namespace that break things in RT.
>
> > I use DBIx::SearchBuilder 1.00_06, a Postgres database, RT 3.0.11, with
> > Apache 2 and mod_perl2 on a SuSE 9.1 system.
> >
> > Thanks for your help!
> >
> > Grettings,
> > Tina
> > _______________________________________________
> > Rt-devel mailing list
> > Rt-devel at lists.bestpractical.com
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel



More information about the Rt-devel mailing list