X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Flookups%2Fpgsql.c;h=eace0840d73ca9a0d016c4b26e2e161817097fd0;hb=b7670459b9549ad6dcca2398580165e54b09b92d;hp=d151e7854ee1eac9a1f1ef5e9ff11052c26377bd;hpb=91ecef39cad37bb5de008f557bded8dcbc8aa6e3;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c index d151e7854..eace0840d 100644 --- a/src/src/lookups/pgsql.c +++ b/src/src/lookups/pgsql.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.8 2006/09/05 14:05:43 ph10 Exp $ */ +/* $Cambridge: exim/src/src/lookups/pgsql.c,v 1.10 2007/08/23 10:16:51 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2006 */ +/* Copyright (c) University of Cambridge 1995 - 2007 */ /* See the file NOTICE for conditions of use and distribution. */ /* Thanks to Petr Cech for contributing the original code for these @@ -410,33 +410,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 pgsql_find(void *handle, uschar *filename, uschar *query, int length, uschar **result, uschar **errmsg, BOOL *do_cache) { -int sep = 0; -uschar *server; -uschar *list = pgsql_servers; -uschar buffer[512]; - -DEBUG(D_lookup) debug_printf("PGSQL query: %s\n", query); - -while ((server = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) - != NULL) - { - BOOL defer_break = FALSE; - int rc = perform_pgsql_search(query, server, result, errmsg, &defer_break, - do_cache); - if (rc != DEFER || defer_break) return rc; - } - -if (pgsql_servers == NULL) - *errmsg = US"no PGSQL servers defined (pgsql_servers option)"; - -return DEFER; +return lf_sqlperform(US"PostgreSQL", US"pgsql_servers", pgsql_servers, query, + result, errmsg, do_cache, perform_pgsql_search); }