|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: Lookups via MySQL tables
From: Victor Duchovni (Victor.Duchovni
MorganStanley.com)
Date: Tue Jun 06 2006 - 20:34:52 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Jun 06, 2006 at 05:15:34PM -0800, Joshua J. Kugler wrote:
> 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:
>
> name
domain.com user1
domain2.com,user2
domain.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?
Either, but good style is one element per database column.
> Also, I assume you can use joins (to normalize things) as long as the query
> looks mostly like the above. Is that correct?
Postfix does not know SQL, the query is a string, the SQL result is a
rectangular array of selected values which are joined together with
comma delimiters to form a single output string. Once this happens
it does not matter what the ingredients where.
--
Viktor.
P.S. Morgan Stanley is looking for a New York City based, Senior Unix
system/email administrator to architect and sustain the Unix email
environment. If you are interested, please drop me a note.
Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.
To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majordomo
postfix.org?body=unsubscribe%20postfix-users>
If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]