On Sat, Jun 03, 2000 at 02:49:47AM +0300, Stas Bekman wrote:
> On Fri, 2 Jun 2000, Perrin Harkins wrote:
> 
> > On Sat, 3 Jun 2000, Stas Bekman wrote:
> > > * install_driver  (2):
> > >   DBI->install_driver("mysql");
> > 
> > I've never seen that before, 
> 
> There is always a first time :)
> 
> > and it isn't in the DBI perldoc.  
> 
> Where do you think I've found it :) It is mentioned in DBI manpage:
> 
>            DBI->connect automatically installs the driver if it
>            has not been installed yet. Driver installation always
>            returns a valid driver handle or it dies with an error
>            message which includes the string 'install_driver' and
>            the underlying problem. So, DBI->connect will die on a
>            driver installation failure and will only return undef
>            on a connect failure, for which $DBI::errstr will hold
>            the error.

I've been meaning to document it properly for the last couple of
years, since I knew people were using it for mod_perl.

> but actualy it's the DBD:: method.

Nope. A DBI->method.

> > Is it safer than "use DBD::mysql;"? 
> 
> "safer" is the wrong question. It's always used by DBI, but when you call
> it at the server startup you get a few more K shared, compared with only
> preloading of DBD::mysql.

Yes, and the semantics of install_driver are that it'll die if the driver
can't be installed, just like 'use'.

>  Apache::DBI->connect_on_init('DBI:mysql:test::localhost', [...]
>  or DBI->disconnect("Cannot connect to database: $DBI::errstr\n");       

There's no such method as DBI->disconnect.

Tim.

Reply via email to