RE: [Exim] Result of one query in another query *PLEASE HELP…

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Mark McRitchie
Fecha:  
A: 'abaddon@punkass.com'
Cc: Exim Users (E-mail)
Asunto: RE: [Exim] Result of one query in another query *PLEASE HELP*
Hmm...

I know that the current state of play with MySQL means that you can't nest
queries.

You should however use a Join in your circumstance
(http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#JO
IN)

SELECT whatever FROM mysql_authtable INNER JOIN mysql_domain_table ON \
    mysql_authtable.mysql_domain_id = mysql_domain_table.mysql_domain_id
\
    WHERE mysql_authtable.msql_usernamefield =
'${quote_mysql:$local_part}' \
    AND mysql_domain_table.mysql_domain_name = '${quote_mysql:$domain}'
\


(or something like that.) That should get you started.

unless your have the actual domain as a field on the user table in which
case you can just match on that, but as you seem to be using id's for
domains, you'll have to join on the id field.

Regards,
Mark.


-----Original Message-----
From: abaddon [mailto:abaddon@punkass.com]
Sent: 08 June 2002 12:36
To: exim-users@???
Subject: [Exim] Result of one query in another query *PLEASE HELP*


Hello...

MYSQL_DOMAIN_PSA = select MYSQL_DOMAIN_ID from MYSQL_DOMAIN_TABLE \
where MYSQL_DOMAIN_NAME='${quote_mysql:$domain}'


MYSQL_USER = SELECT DISTINCT MYSQL_DOMAIN_ID FROM MYSQL_AUTHTABLE \
WHERE MYSQL_DOMAIN_ID LIKE '$MYSQL_DOMAIN_PSA ?????@#$@#$' AND \
MYSQL_USERNAMEFIELD LIKE '${quote_mysql:$local_part}'


# Check if user is a real user in mysql database
virtual_local_user:
domains = ${lookup mysql {MYSQL_USER}{$value}}
driver = smartuser
transport = virtual_delivery


How can i parse MYSQL_DOMAIN_PSA result to the MYSQL_USER query ?

Should work something like this:

selecet dom_id from domains where mysql_domain_name='${quote_mysql:
$domain}'

Result: dom_id=52

and than:

MYSQL_USER = SELECT DISTINCT MYSQL_DOMAIN_ID FROM MYSQL_AUTHTABLE \
WHERE MYSQL_DOMAIN_ID LIKE '52' AND \
MYSQL_USERNAMEFIELD LIKE '${quote_mysql:$local_part}'


2 - Second

What option to set to refuse "rcpt to" if user dosent exist ?

Thanks

Abaddon



===================================================================
EASY and FREE access to your email anywhere: http://kralweb.com/mail
===================================================================



--

## List details at http://www.exim.org/mailman/listinfo/exim-users Exim
details at http://www.exim.org/ ##


Salamis Group of Companies - WWW.SALAMISGROUP.COM

This communication contains information which is confidential and may
also be privileged. It is for the exclusive use of the intended
recipient(s). If you are not the intended recipient(s) be advised
that any form of distribution, copying or use of this communication
or the information it contains is strictly prohibited and may be
unlawful. We apologise if you have received this communication in
error. Please return it to the sender immediately, delete this
communication from your computer and destroy any copies of it. Any
views/opinions expressed in this email are that of the author and may
not reflect the views of Salamis (M&I)Ltd.