You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Craig Raw <cr...@quirk.co.za> on 2006/03/14 15:55:36 UTC
Wildcard SQL for JDBCVirtualUserTable
Hi,
Here at Quirk we've put together a new SQL query for the JDBCVirtualUserTable. It allows you to use
wildcards in the domain column, so
+------+-----------+----------------+
| user | domain | target_address |
+------+-----------+----------------+
| blue | abc.net | red |
| blue | abc.* | green |
| blue | abc.co.* | blue |
+------+-----------+----------------+
are all possible. Most exact matches are chosen first. Essentially, you just need to add the
sqlquery init parameter as below:
<mailet match="All" class="JDBCVirtualUserTable">
<table>db://maildb/VirtualUserTable</table>
<sqlquery>select target_address from VirtualUserTable where user = ? and ? like
replace(domain, '*', '%') and ? is not null order by length(domain) desc limit 1</sqlquery>
</mailet>
It may be MySQL specific. I hope it is of use to someone.
Craig
www.quirk.biz
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org