SOURCES: dspam-mysql-runtime.patch (NEW) - choose version at run time

arekm arekm at pld-linux.org
Wed Feb 1 21:11:29 CET 2006


Author: arekm                        Date: Wed Feb  1 20:11:28 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- choose version at run time

---- Files affected:
SOURCES:
   dspam-mysql-runtime.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/dspam-mysql-runtime.patch
diff -u /dev/null SOURCES/dspam-mysql-runtime.patch:1.1
--- /dev/null	Wed Feb  1 21:11:28 2006
+++ SOURCES/dspam-mysql-runtime.patch	Wed Feb  1 21:11:23 2006
@@ -0,0 +1,77 @@
+diff -urN dspam-3.6.3.org/src/mysql_drv.c dspam-3.6.3/src/mysql_drv.c
+--- dspam-3.6.3.org/src/mysql_drv.c	2006-01-18 17:48:53.000000000 +0100
++++ dspam-3.6.3/src/mysql_drv.c	2006-02-01 21:09:20.000000000 +0100
+@@ -84,6 +84,7 @@
+   const char *server_default_groups[]=
+   { "server", "embedded", "mysql_SERVER", 0 };
+ 
++  if (_ds_match_attribute(DTX->CTX->config->attributes, "MySQLVersion4", "on"))
+   if (mysql_server_init(0, NULL, (char**) server_default_groups)) {
+     LOGDEBUG("dspam_init_driver() failed");
+     return EFAILURE;
+@@ -148,6 +149,7 @@
+   }
+ 
+ #if defined(MYSQL4_INITIALIZATION) && MYSQL_VERSION_ID >= 40001
++  if (_ds_match_attribute(DTX->CTX->config->attributes, "MySQLVersion4", "on"))
+   mysql_server_end();
+ #endif
+   return 0;
+@@ -610,6 +612,7 @@
+   }
+ 
+ #if MYSQL_VERSION_ID >= 40100
++  if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on")) {
+   insert = buffer_create(NULL);
+   if (insert == NULL)
+   {
+@@ -617,6 +620,7 @@
+     LOG (LOG_CRIT, ERR_MEM_ALLOC);
+     return EUNKNOWN;
+   }
++  }
+ #endif
+ 
+   ds_diction_getstat(diction, s->control_token, &control);
+@@ -633,6 +637,7 @@
+   buffer_cat (query, scratch);
+ 
+ #if MYSQL_VERSION_ID >= 40100
++  if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on"))
+   buffer_copy (insert, "insert into dspam_token_data(uid, token, spam_hits, "
+                        "innocent_hits, last_hit) values");
+ #endif
+@@ -679,6 +684,7 @@
+     {
+       char ins[1024];
+ #if MYSQL_VERSION_ID >= 40100
++      if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on")) {
+       snprintf (ins, sizeof (ins),
+                 "%s(%d, '%llu', %d, %d, current_date())",
+                  (insert_any) ? ", " : "",
+@@ -689,6 +695,7 @@
+ 
+       insert_any = 1;
+       buffer_cat(insert, ins);
++      } else {
+ #else
+       snprintf(ins, sizeof (ins),
+                "insert into dspam_token_data(uid, token, spam_hits, "
+@@ -702,6 +709,9 @@
+       if (MYSQL_RUN_QUERY (s->dbh, ins))
+         stat.status |= TST_DISK;
+ #endif
++#if MYSQL_VERSION_ID >= 40100
++      }
++#endif
+     }
+ 
+     if (stat.status & TST_DISK) {
+@@ -749,6 +759,7 @@
+   }
+ 
+ #if MYSQL_VERSION_ID >= 40100
++  if (_ds_match_attribute(CTX->config->attributes, "MySQLVersion4", "on"))
+   if (insert_any)
+   {
+      snprintf (scratch, sizeof (scratch),
================================================================


More information about the pld-cvs-commit mailing list