> To preserve compatibility, an implied initialization is:
>   $sql_clause{'sel_policy'} = \$sql_select_policy;
> so either set the $sql_select_policy (which will be passed on to
> $sql_clause{'sel_policy'} ), or assign to $sql_clause{'sel_policy'}
> directly and ignore $sql_select_policy.
> 
> The code in amavisd only uses values in %sql_clause,
> not $sql_select_policy.
> 
> > that have to return "0" (as for
> > previous solution based on associative array) if the domain is
> internal,
> > and "1" other wise.
> 
> The clause should be a SELECT, which may return any number of records
> but only the first record (if any) is used. The record should
> provide field names (with their values) as expected by amavisd,
> not all are needed, any additional (unrecognized) fields are ignored.
> Missing fields or NULLs fall back to statical lookups for that
setting.
> 
> So for example, a trivial SELECT would provide two constant
> values regardless of a recipient address:
> 
> SELECT 'Y' as virus_lover, 6.3 as spam_kill_level;
> 
>   +-------------+-----------------+
>   | virus_lover | spam_kill_level |
>   +-------------+-----------------+
>   | Y           |             6.3 |
>   +-------------+-----------------+
>   1 row in set (0.01 sec)
> 
> 
> > 2) Which field of the select has to contains the 0,1 values?
> 
> See README.lookups, section 'SQL LOOKUPS'.
> For boolean fields use 0 or 'N' for false, 1 or 'Y' for a true.
> 
> > 3) could you depict this solution with a practical example?
> 
> Perhaps it would be best to start with your schema, i.e. that
> part of it which tells which domains are your local.

So,

$sql_clause{'sel_policy'} = \$sql_select_policy;
$sql_select_policy  = "select policy.virus_lover as virus_lover from
(SELECT 1 as virus_lover, domain FROM domain where active=1 and domain
in (%k)) as policy left join domain on (policy.domain=domain.domain)";

Could be ok?

PS: The query returns:

  +-------------+
  | virus_lover |
  +-------------+
  | 1           |
  +-------------+

If domain is local and

  +-------------+
  | virus_lover |
  +-------------+

Otherwise.

rocsca

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
AMaViS-user mailing list
[email protected] 
https://lists.sourceforge.net/lists/listinfo/amavis-user 
 AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 
 AMaViS-HowTos:http://www.amavis.org/howto/ 

Reply via email to