1 diff -urN dspam-3.6.3.org/src/mysql_drv.c dspam-3.6.3/src/mysql_drv.c
2 --- dspam-3.6.3.org/src/mysql_drv.c 2006-01-18 17:48:53.000000000 +0100
3 +++ dspam-3.6.3/src/mysql_drv.c 2006-02-01 21:46:52.000000000 +0100
5 #include "config_shared.h"
8 +static int use_mysql40 = 0;
10 int test(MYSQL *, char *);
12 int test(MYSQL *dbh, char *query) {
15 dspam_init_driver (DRIVER_CTX *DTX)
18 #if defined(MYSQL4_INITIALIZATION) && MYSQL_VERSION_ID >= 40001
19 const char *server_default_groups[]=
20 { "server", "embedded", "mysql_SERVER", 0 };
26 +#if defined(MYSQL4_INITIALIZATION) && MYSQL_VERSION_ID >= 40001
27 + if (_ds_match_attribute(DTX->CTX->config->attributes, "MySQLVersion40", "on"))
31 if (mysql_server_init(0, NULL, (char**) server_default_groups)) {
32 LOGDEBUG("dspam_init_driver() failed");
37 #if defined(MYSQL4_INITIALIZATION) && MYSQL_VERSION_ID >= 40001
45 #if MYSQL_VERSION_ID >= 40100
47 insert = buffer_create(NULL);
51 LOG (LOG_CRIT, ERR_MEM_ALLOC);
57 ds_diction_getstat(diction, s->control_token, &control);
59 buffer_cat (query, scratch);
61 #if MYSQL_VERSION_ID >= 40100
63 buffer_copy (insert, "insert into dspam_token_data(uid, token, spam_hits, "
64 "innocent_hits, last_hit) values");
69 #if MYSQL_VERSION_ID >= 40100
71 snprintf (ins, sizeof (ins),
72 "%s(%d, '%llu', %d, %d, current_date())",
73 (insert_any) ? ", " : "",
77 buffer_cat(insert, ins);
81 snprintf(ins, sizeof (ins),
82 "insert into dspam_token_data(uid, token, spam_hits, "
83 "innocent_hits, last_hit) values(%d, '%llu', %d, %d, "
86 if (MYSQL_RUN_QUERY (s->dbh, ins))
87 stat.status |= TST_DISK;
88 +#if MYSQL_VERSION_ID >= 40100
96 #if MYSQL_VERSION_ID >= 40100
100 snprintf (scratch, sizeof (scratch),
104 buffer_destroy(insert);
108 buffer_destroy (query);
109 @@ -2701,6 +2723,9 @@
111 int port = 3306, i = 0, real_connect_flag = 0;
113 + if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion40", "on"))
116 /* Read storage attributes */
117 if (_ds_read_attribute(CTX->config->attributes, "MySQLServer")) {