I sent Phil the first shot at a postgreSQL lookup type yesterday. Further
work this morning leads me to a point where I need some help.
Unlike the existing mysql support, our application has a requirement to
connect to multiple backend DB's for the same message. The scenario being
(a) our config database tells us which domain belongs to which customers (a
passwd style table and domain -> user mapping table) and then (b) we connect
to "their" DB to lookup their own domain information, such as users and
passwords.
I looked at the LDAP query, and I have hacked up this:
CONNECT="host=db-1.server db=config ..."
...
${lookup pgsql{db=CONNECT query="select ..."}{$value}}
Before tidying and submitting this back into the tree, any further
suggestions ? I have to yet get the cache doing more than one connection
(since it is based 80% on the mysql.c file) - but I feel that having a
single 'db' parameter to encapsulate the database details is better that
explicity requiring USER=X PASS=Y etc. Opinions ?
I look forward to a day when we can have an 'sql' lookup, with the backend
being chosen at query time. This could be the next small project, but we
only use PGSQL.
Peter