Ben Winslow wrote:
On Monday 27 March 2006 21:47, Richard Laager wrote:
I'm working on migrating to Dovecot. At the moment, I have a mail path that includes the domain, so I'm using %d to get that. However, if users authenticate without specifying a domain (i.e. using "bob" instead of "bob@wiktel.com"), then %d expands to nothing. I'd like to have that expand to a default domain (wiktel.com) instead. Is that possible?
Thanks, Richard
The best solution to this (afaik) is to let the SQL server to the dirty work for you, e.g.: SELECT [...] CASE WHEN ('%d' = '') THEN 'default.com' ELSE '%d' END AS domain [...]
Depending on your database schema, you may be able to get away without the CASE statement usage with something like this: SELECT ... WHERE (('%d' != '' AND domain='%d') OR ('%d' = '' AND domain='default.com') ...
It's not the greatest of solutions, but it works well enough.
I always wondered if you could do what with SQL. Thanks =) However the OP actually wants to move AWAY From sql so I don't think this will help him in his situation.