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





------- Additional Comments From [EMAIL PROTECTED]  2004-03-17 08:05 -------
Subject: Re:  Changes to Configuration and Functionality

On Wed, Mar 17, 2004 at 12:47:36AM -0800, [EMAIL PROTECTED] wrote:
> 
> ------- Additional Comments From [EMAIL PROTECTED]  2004-03-17 00:47 -------
> Sorry guys, but how much cleaner do you want this?  It means no additional 
> SQl 
> parameters, just a different way of reading them in from the local.cf (or any 
> other).  Having not been privy to the "new custom SQL code" I doubt that it 
> could get any easier than this.  But I am willing to be wrong.  Probably 
> makes 
> everything you can do with the new SQl code possible with a single line in 
> the 
> local.cf as well.

We no longer have code in Conf.pm that supports setting the table and
column names for the user prefs SQL config.  You can do so via the
user_scores_sql_custom_query config.  Here is the documentation
snippet for that feature, I think you will find it flexible and useful
enough for what you are trying to achieve:

=item user_scores_sql_custom_query query

This option gives you the ability to create a custom SQL query to
retrieve user scores and preferences.  In order to work correctly your
query should return two values, the preference name and value, in that
order.  In addition, there are several "variables" that you can use
as part of your query, these variables will be substituted for the
current values right before the query is run.  The current allowed
variables are:

=over 4

=item _TABLE_

The name of the table where user scores and preferences are stored, default
is userpref.

=item _USERNAME_

The current user's username.

=item _MAILBOX_

The portion before the @ as derived from the current user's username.

=item _DOMAIN_

The portion after the @ as derived from the current user's username, this
value may be null.

=back

The query must be one one continuous line in order to parse correctly.

Here are several example queries, please note that these are broken up
for easy reading, in your config it should be one continuous line.

=item Current default query:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' ORDER BY username ASC

=item Use global and then domain level defaults:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' OR username = '@~'||_DOMAIN_ ORDER BY username ASC

=item Maybe global prefs should override user prefs:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' ORDER BY username DESC

=cut


You can then fairly easily write the optimal query for however you
have your preference data stored in the database.

Michael





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

Reply via email to