X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/c988f1f4faa9f679f79beddf3c14676c5dcb8e28..0a49a7a4f1090b6f1ce1d0f9d969804c9226b53e:/src/src/lookups/mysql.c diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c index a6fd5965b..240d1d95b 100644 --- a/src/src/lookups/mysql.c +++ b/src/src/lookups/mysql.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.2 2005/01/04 10:00:44 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.6 2009/11/16 19:50:38 nm4 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2009 */ /* See the file NOTICE for conditions of use and distribution. */ /* Thanks to Paul Kelly for contributing the original code for these @@ -338,32 +338,16 @@ else *************************************************/ /* See local README for interface description. The handle and filename -arguments are not used. Loop through a list of servers while the query is -deferred with a retryable error. */ +arguments are not used. The code to loop through a list of servers while the +query is deferred with a retryable error is now in a separate function that is +shared with other SQL lookups. */ int mysql_find(void *handle, uschar *filename, uschar *query, int length, uschar **result, uschar **errmsg, BOOL *do_cache) { -int sep = 0; -uschar *server; -uschar *list = mysql_servers; -uschar buffer[512]; - -DEBUG(D_lookup) debug_printf("MYSQL query: %s\n", query); - -while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL) - { - BOOL defer_break = FALSE; - int rc = perform_mysql_search(query, server, result, errmsg, &defer_break, - do_cache); - if (rc != DEFER || defer_break) return rc; - } - -if (mysql_servers == NULL) - *errmsg = US"no MYSQL servers defined (mysql_servers option)"; - -return DEFER; +return lf_sqlperform(US"MySQL", US"mysql_servers", mysql_servers, query, + result, errmsg, do_cache, perform_mysql_search); }