http://bugzilla.spamassassin.org/show_bug.cgi?id=2037





------- Additional Comments From [EMAIL PROTECTED]  2004-05-17 09:55 -------
I noticed in the new 3.0.0 version, there are two 'SQL conf' files, namely:
http://spamassassin.rediris.es/full/3.0.x/dist/lib/Mail/SpamAssassin/ConfSourceSQL.pm
and
http://spamassassin.rediris.es/full/3.0.x/dist/lib/Mail/SpamAssassin/Conf/SQL.pm

What I find interesting is neither stores the DB handle in something like
$self->{dbh}, and then later checks to see if its 'active'.

Whereas, the SQL support for the bayesan stuff here:
http://spamassassin.rediris.es/full/3.0.x/dist/lib/Mail/SpamAssassin/BayesStore/SQL.pm
seems to do precisely that.

All it would conceivably take would be to replace:
my $dbh = DBI->connect($dsn, $dbuser, $dbpass, {'PrintError' => 0});

with:
if (!defined($self->{dbh}))
{
  $self->{dbh} = DBI->connect($dsn, $dbuser, $dbpass, {'PrintError' => 0});
}

And then replace any reference to $dbh with $self->{dbh}.

And of course removing the disconnect.  Even better would be to decouple the DB
connection and disconnection routines alltogether (as is done in the bayesan
stuff).  Even better STILL would be to have all DB functions in the same
'pre-forked process' use the same DB handle (regardless of whether its for
bayesan, configuration, or other purposes).  ie. put the dbh in the 'main'
section (which is where the SQL config stuff is read from anyway).

But the bare minimum of stopping the continual re-connects would be a huge
benefit anyway.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to