On Sat, Jun 03, 2000 at 03:54:37AM +0300, Stas Bekman wrote:
> Here is a complete version. comments are very welcome before it enters the
> guide:
>
> The first example is the C<DBI> module. As you know C<DBI> works with
> many database drivers falling into the C<DBD::> category,
> e.g. C<DBD::mysql>. It's not enough to preload C<DBI>, you should
> initialize C<DBI> with driver(s) that you are going to use (usually a
> single driver is used).
... if you want to minimize memory use after forking.
I'd rather not create the impression that people "should" initialize
drivers in other circumstances.
> You probably know already that under mod_perl you should use the
> C<Apache::DBI> module to get the connection persistence, unless you
> open a separate connection for each user--in this case you should not
> use this module. C<Apache::DBI> automatically loads C<DBI> and
> overrides all it's methods, so you should continue coding like there
> is only a C<DBI> module.
s/all it's methods/some of its methods/.
> =item option 4
>
> Tell Apache::DBI to connect to the database when the child process
> starts (ChildInitHandler), no driver is preload before the child gets
> spawned!
>
> Apache::DBI->connect_on_init('DBI:mysql:test::localhost',
> "",
> "",
> {
> PrintError => 1, # warn() on errors
> RaiseError => 0, # don't die on error
> AutoCommit => 1, # commit executes
> # immediately
> }
> )
> or DBI->disconnect("Cannot connect to database: $DBI::errstr\n");
There's no DBI->disconnect method. Just die().
Thanks for doing all this work Stas. Much appreciated.
Tim.