Subject:
Developers of Sympa
List archive
- From: Olivier Salaün - CRU <address@concealed>
- To: Sylvain Amrani <address@concealed>
- Cc: address@concealed
- Subject: Re: [sympa-dev] Patch to support SQL Named filters, like LDAP Named filters
- Date: Tue, 26 Sep 2006 12:11:02 +0200
Sylvain,
Thank you for providing this new feature ; it has often been asked by
Sympa users in the past. Thank you for also providing the documentation
along with the code :-)
We've applied the latest version of your patch into the CVS trunk ; it
will be part of next Sympa release (5.3).
Sylvain Amrani wrote:
I submit a small patch on sourcesup to add SQL Named filters
functionality :
http://sourcesup.cru.fr/tracker/index.php?func=detail&aid=997&group_id=23&atid=170
This way, you can write this scenario condition :
search(example.sql, [sender]) smtp,smime,md5 -> do_it
Here is the example.sql named filter :
sql_named_filter_query
db_type mysql
db_name people
db_host dbserver.rennes1.fr
db_user sympa
db_passwd pw_sympa_mysqluser
statement SELECT count(*) as c FROM users WHERE mail=[sender] AND EmployeeType='PROFESSOR' AND department='mathematics'
This patch :
- Use the existing List::db_connect() function to open a
connection
to the database. db_connect() takes a hash as parameter (as well as the
'just_try' existing parameter). If the parameter is a Hash, db_connect
will use the hash as %Conf data to find the db parameter. If not (the
normal way), db_connect will use the global %Conf hash to open a
connection for the main sympa database.
- Use the existing Conf::load_generic_conf_file() to parse the
.sql
conf file for this named filter.
- Add a new Conf::load_sql_filter() function to load the conf
file
and define its format.
- Add a new 'named_filter' type to listowner_notification.tt2, to
warn the list owner if his filter is incorrect
- Add a section to the sympa.tex.tpl doc (but please, double chek
before using it, as my english is very bad !)
We use it in our sympa environment, so we can use corporate data stored
in SQL databases, without having to modify our processes or push so
much data in our LDAP directory.
Hope it can be usefull.
|
Archive powered by MHonArc 2.6.19+.