RE: [PEAR-DEV] [PATCH] DB::connect(): stuff that should be in DB::factory()
| From: | Lukas Smith | Date: | Sun, 21 Sep 2003 20:34:45 +0000 |
| Subject: | RE: [PEAR-DEV] [PATCH] DB::connect(): stuff that should be in DB::factory() | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-21870@lists.php.net to get a copy of this message | ||
> From: Roman Neuhauser [mailto:neuhauser@bellavista.cz]
> Sent: Sunday, September 21, 2003 10:30 PM
> # neuhauser@bellavista.cz / 2003-06-03 15:14:05 +0200:
> > # cox@idecnet.com / 2003-06-03 14:27:05 +0200:
> > > From: "Roman Neuhauser" <neuhauser@bellavista.cz>
> > > Subject: [PEAR-DEV] [PATCH] DB::connect(): stuff that should be in
> DB::factory()
> > >
> > > > DB::connect() uses DB::factory() to instantiate the
appropriate
> > > > class.
> > > >
> > > > Body of factory() was replaced with instantiation code from
> > > > connect() (better error message, etc).
> > > >
> > > > factory() now takes two arguments, the second being $options
> > > > (passed through from connect()); it's used just as it used
to be
> in
> > > > connect().
> > >
> > > DB::factory() was nice for me to test parseDSN() ... but appart of
it,
> why
> > > would DB need to provide factory()?
> >
> > well, that's not for me to judge as I don't know all the ways
people
> > use PEAR::DB. but the code is there, and it should be either
> > maintained or removed. letting it bitrot is not a good idea.
>
> There's grown such a need since then: a team I am a member of uses
> subclasses of the DB class, and some of its drivers. The DB
subclass
> basically just redefines the DB::connect() method, and the gist of
> the change is that first looks for the driver in a custom
directory
> before falling back on the default driver implementation. ~10
lines
> added, ~40 copied. The code duplication could have been reduced
> hadn't the factory method been left to bitrot.
Please open a bug report.
And if Tomas finds the time he will attend to the issues and make a
decision.
Regards,
Lukas