-/* $Cambridge: exim/src/src/lookups/mysql.c,v 1.7 2010/03/05 15:59:29 nm4 Exp $ */
-
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
#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 <mysql.h> /* The system header */
/* See local README for interface description. */
-void *
+static void *
mysql_open(uschar *filename, uschar **errmsg)
{
return (void *)(1); /* Just return something non-null */
/* See local README for interface description. */
-void
+static void
mysql_tidy(void)
{
mysql_connection *cn;
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)
{
Returns: the processed string or NULL for a bad option
*/
-uschar *
+static uschar *
mysql_quote(uschar *s, uschar *opt)
{
register int c;
}
-#endif /* MYSQL_LOOKUP */
+/*************************************************
+* Version reporting entry point *
+*************************************************/
+
+/* See local README for interface description. */
+
+#include "../version.h"
+
+void
+mysql_version_report(FILE *f)
+{
+fprintf(f, "Library version: MySQL: Compile: %s [%s]\n"
+ " Runtime: %s\n",
+ MYSQL_SERVER_VERSION, MYSQL_COMPILATION_COMMENT,
+ mysql_get_client_info());
+#ifdef DYNLOOKUP
+fprintf(f, " Exim version %s\n", EXIM_VERSION_STR);
+#endif
+}
+
+/* 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 */
+ mysql_version_report /* version reporting */
+};
+
+#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 */