]> git.pld-linux.org Git - packages/dspam.git/blame - dspam-mysql-runtime.patch
- choose mysql version from config
[packages/dspam.git] / dspam-mysql-runtime.patch
CommitLineData
c2a52a53
AM
1diff -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:09:20.000000000 +0100
4@@ -84,6 +84,7 @@
5 const char *server_default_groups[]=
6 { "server", "embedded", "mysql_SERVER", 0 };
7
8+ if (_ds_match_attribute(DTX->CTX->config->attributes, "MySQLVersion4", "on"))
9 if (mysql_server_init(0, NULL, (char**) server_default_groups)) {
10 LOGDEBUG("dspam_init_driver() failed");
11 return EFAILURE;
12@@ -148,6 +149,7 @@
13 }
14
15 #if defined(MYSQL4_INITIALIZATION) && MYSQL_VERSION_ID >= 40001
16+ if (_ds_match_attribute(DTX->CTX->config->attributes, "MySQLVersion4", "on"))
17 mysql_server_end();
18 #endif
19 return 0;
20@@ -610,6 +612,7 @@
21 }
22
23 #if MYSQL_VERSION_ID >= 40100
24+ if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on")) {
25 insert = buffer_create(NULL);
26 if (insert == NULL)
27 {
28@@ -617,6 +620,7 @@
29 LOG (LOG_CRIT, ERR_MEM_ALLOC);
30 return EUNKNOWN;
31 }
32+ }
33 #endif
34
35 ds_diction_getstat(diction, s->control_token, &control);
36@@ -633,6 +637,7 @@
37 buffer_cat (query, scratch);
38
39 #if MYSQL_VERSION_ID >= 40100
40+ if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on"))
41 buffer_copy (insert, "insert into dspam_token_data(uid, token, spam_hits, "
42 "innocent_hits, last_hit) values");
43 #endif
44@@ -679,6 +684,7 @@
45 {
46 char ins[1024];
47 #if MYSQL_VERSION_ID >= 40100
48+ if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on")) {
49 snprintf (ins, sizeof (ins),
50 "%s(%d, '%llu', %d, %d, current_date())",
51 (insert_any) ? ", " : "",
52@@ -689,6 +695,7 @@
53
54 insert_any = 1;
55 buffer_cat(insert, ins);
56+ } else {
57 #else
58 snprintf(ins, sizeof (ins),
59 "insert into dspam_token_data(uid, token, spam_hits, "
60@@ -702,6 +709,9 @@
61 if (MYSQL_RUN_QUERY (s->dbh, ins))
62 stat.status |= TST_DISK;
63 #endif
64+#if MYSQL_VERSION_ID >= 40100
65+ }
66+#endif
67 }
68
69 if (stat.status & TST_DISK) {
70@@ -749,6 +759,7 @@
71 }
72
73 #if MYSQL_VERSION_ID >= 40100
74+ if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on"))
75 if (insert_any)
76 {
77 snprintf (scratch, sizeof (scratch),
This page took 0.097102 seconds and 4 git commands to generate.