OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Lookups via MySQL tables

From: Joshua J. Kugler (joshuaeeinternet.com)
Date: Tue Jun 06 2006 - 20:15:34 CDT


I've read through the docs and the source of dict_mysql.c (specifically the
function *dict_mysql_lookup(DICT *dict, const char *name) and I'm still not
100% sure of my answer.

With the text-based files, such as /etc/postfix/virtual, the format of the
file is:

namedomain.com user1domain2.com,user2domain.com, etc...

Using MySQL, you have a query like so:
SELECT [select_field]
           FROM [table]
           WHERE [where_field] = '%s'
                 [additional_conditions]

Is that expecting a one row result with comma separated values in
[select_field], or will it accept several several rows and use all the values
that it finds in [select_field] from all the rows?

Also, I assume you can use joins (to normalize things) as long as the query
looks mostly like the above. Is that correct?

Thanks!

j

--
Joshua Kugler
Lead System Admin -- Senior Programmer
http://www.eeinternet.com
PGP Key: http://pgp.mit.edu/ ID 0xDB26D7CE
PO Box 80086 -- Fairbanks, AK 99708 -- Ph: 907-456-5581 Fax: 907-456-3111