Skip to Content.
Sympa Menu

devel - [sympa-dev] Patch to support SQL Named filters, like LDAP Named filters

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: Sylvain Amrani <address@concealed>
  • To: address@concealed, sympa-authors <address@concealed>
  • Subject: [sympa-dev] Patch to support SQL Named filters, like LDAP Named filters
  • Date: Tue, 12 Sep 2006 21:07:46 +0200

Hi,

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.

Regards,
Sylvain.



-- 
Sylvain Amrani
Direction Générale de la Gendarmerie Nationale
DGGN/SPM/SDTI/BSA
Section Architecture des Systèmes
01.56.28.86.47



Archive powered by MHonArc 2.6.19+.

Top of Page