X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f6efe9ce58f5c88c63f21527255552f27a12498d..e6d225ae6e6811d3c88dc201642a2127ff6c11bd:/src/src/lookups/mysql.c diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c index f2e9a1565..97b9c1139 100644 --- a/src/src/lookups/mysql.c +++ b/src/src/lookups/mysql.c @@ -13,22 +13,6 @@ functions. */ #include "../exim.h" #include "lf_functions.h" -#include "mysql.h" /* The local header */ - - -/* We can't just compile this code and allow the library mechanism to omit the -functions if they are not wanted, because we need to have the MYSQL header -available for compiling. Therefore, compile these functions only if -LOOKUP_MYSQL is defined. However, some compilers don't like compiling empty -modules, so keep them happy with a dummy when skipping the rest. Make it -reference itself to stop picky compilers complaining that it is unused, and put -in a dummy argument to stop even pickier compilers complaining about infinite -loops. */ - -#ifndef LOOKUP_MYSQL -static void dummy(int x) { dummy(x-1); } -#else - #include /* The system header */ @@ -51,7 +35,7 @@ static mysql_connection *mysql_connections = NULL; /* See local README for interface description. */ -void * +static void * mysql_open(uschar *filename, uschar **errmsg) { return (void *)(1); /* Just return something non-null */ @@ -65,7 +49,7 @@ return (void *)(1); /* Just return something non-null */ /* See local README for interface description. */ -void +static void mysql_tidy(void) { mysql_connection *cn; @@ -357,7 +341,7 @@ 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 +static int mysql_find(void *handle, uschar *filename, uschar *query, int length, uschar **result, uschar **errmsg, BOOL *do_cache) { @@ -387,7 +371,7 @@ Arguments: Returns: the processed string or NULL for a bad option */ -uschar * +static uschar * mysql_quote(uschar *s, uschar *opt) { register int c; @@ -429,7 +413,24 @@ while ((c = *s++) != 0) return quoted; } - -#endif /* MYSQL_LOOKUP */ +/* These are the lookup_info blocks for this driver */ + +static lookup_info mysql_lookup_info = { + US"mysql", /* lookup name */ + lookup_querystyle, /* query-style lookup */ + mysql_open, /* open function */ + NULL, /* no check function */ + mysql_find, /* find function */ + NULL, /* no close function */ + mysql_tidy, /* tidy function */ + mysql_quote /* quoting function */ +}; + +#ifdef DYNLOOKUP +#define mysql_lookup_module_info _lookup_module_info +#endif + +static lookup_info *_lookup_list[] = { &mysql_lookup_info }; +lookup_module_info mysql_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 }; /* End of lookups/mysql.c */