freebsd-ports/mail/dbmail21/files/patch-2.1.7_007_385
Edwin Groothuis f45d770362 New port: mail/dbmail21 -current branch of DBMail
Dbmail is the name of a group of programs that enable the possiblilty
	of storing and retrieving mail messages from a database (currently
	MySQL, PostgreSQL or SQLite).

	What are the advantages?

	    * Scalability.
	      Dbmail is as scalable as the database that is used for the
	      mail storage.
	    * Manageability.
	      Dbmail is based upon a database. Dbmail can be managed by
	      changing settings in the database (f.e. using PHP/Perl/SQL).
	    * Speed.
	      Dbmail uses very efficient, database specific queries for
	      retrieving mail information. This is much faster then parsing
	      a filesystem.
	    * Security.
	      Dbmail has got nothing to do with the filesystem or interaction
	      with other programs in the Unix environment which need special
	      permissions.  Dbmail is as secure as the database it's based
	      upon.
	    * Flexibility.
	      Changes on a Dbmail system (adding of users, changing passwords
	      etc.) are effective immediately.

	WWW: http://www.dbmail.org/

PR:		ports/101356
Submitted by:	Mark Starovoytov <mark_sf@kikg.ifmo.ru>
2006-08-05 22:35:33 +00:00

76 lines
2.8 KiB
Text

Index: config.c
===================================================================
--- config.c (revision 2217)
+++ config.c (revision 2218)
@@ -212,9 +212,10 @@
if (config_get_value("serverid", "DBMAIL", serverid_string) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
+ if (config_get_value("encoding", "DBMAIL", db_params->encoding) < 0)
+ trace(TRACE_FATAL, "%s,%s: error getting config!",
+ __FILE__, __func__);
-
-
if (config_get_value("table_prefix", "DBMAIL", db_params->pfx) < 0)
trace(TRACE_FATAL, "%s,%s: error getting config!",
__FILE__, __func__);
Index: modules/dbmysql.c
===================================================================
--- modules/dbmysql.c (revision 2217)
+++ modules/dbmysql.c (revision 2218)
@@ -90,6 +90,16 @@
int collations_match = 0;
int i, j;
+ if (strlen(_db_params.encoding) > 0) {
+ snprintf(the_query, DEF_QUERYSIZE, "SET NAMES %s", _db_params.encoding);
+ if (db_query(the_query) == DM_EQUERY) {
+ trace(TRACE_ERROR,
+ "%s,%s: error setting collation", __FILE__, __func__);
+ return DM_EQUERY;
+ }
+ db_free_result();
+ }
+
snprintf(the_query, DEF_QUERYSIZE,
"SHOW VARIABLES LIKE 'collation_%%'");
if (db_query(the_query) == DM_EQUERY) {
Index: ChangeLog
===================================================================
--- ChangeLog (revision 2217)
+++ ChangeLog (revision 2218)
@@ -5,6 +5,9 @@
InnoDB format (closes bug #386).
* pipe.c:
Attempt to resolve bug #372.
+ * config.c, dbmail.conf, dbmailtypes.h, modules/dbmysql.c:
+ Accepted patch from Maenaka to allow configurable MySQL connection
+ encoding (closes bug #385).
2006-07-27 Aaron Stone <aaron@serendipity.cx>
Index: dbmail.conf
===================================================================
--- dbmail.conf (revision 2217)
+++ dbmail.conf (revision 2218)
@@ -18,6 +18,7 @@
pass= # Database password.
db=dbmail # Database name.
#table_prefix=dbmail_ # Table prefix. Defaults to "dbmail_" if not specified.
+#encoding=latin1 # MySQL connection encoding must match to table encoding.
#postmaster=DBMAIL-MAILER # Postmaster's email address for use in bounce messages.
sendmail=/usr/sbin/sendmail # Sendmail executable for forwards, replies, notifies, vacations.
Index: dbmailtypes.h
===================================================================
--- dbmailtypes.h (revision 2217)
+++ dbmailtypes.h (revision 2218)
@@ -99,6 +99,7 @@
field_t sock; /**< path to local unix socket (local connection) */
field_t pfx; /**< prefix for tables e.g. dbmail_ */
unsigned int serverid; /**< unique id for dbmail instance used in clusters */
+ field_t encoding; /**< character encoding to use */
} db_param_t;
/** configuration items */