dovecot-2.0: mysql: Fixed compiling with older libraries that di...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Mar 22 16:13:01 EET 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/9aa107613324
changeset: 10973:9aa107613324
user: Timo Sirainen <tss at iki.fi>
date: Mon Mar 22 16:12:58 2010 +0200
description:
mysql: Fixed compiling with older libraries that didn't support CLIENT_MULTI_RESULTS.
diffstat:
src/lib-sql/driver-mysql.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diffs (43 lines):
diff -r 9202254c8499 -r 9aa107613324 src/lib-sql/driver-mysql.c
--- a/src/lib-sql/driver-mysql.c Mon Mar 22 15:27:07 2010 +0200
+++ b/src/lib-sql/driver-mysql.c Mon Mar 22 16:12:58 2010 +0200
@@ -88,6 +88,7 @@
{
struct mysql_db *db = conn->db;
const char *unix_socket, *host;
+ unsigned long client_flags = db->client_flags;
time_t now;
bool failed;
@@ -132,11 +133,13 @@
}
alarm(MYSQL_CONNECT_FAILURE_TIMEOUT);
+#ifdef CLIENT_MULTI_RESULTS
+ client_flags |= CLIENT_MULTI_RESULTS;
+#endif
/* CLIENT_MULTI_RESULTS allows the use of stored procedures */
failed = mysql_real_connect(conn->mysql, host, db->user, db->password,
db->dbname, db->port, unix_socket,
- db->client_flags |
- CLIENT_MULTI_RESULTS) == NULL;
+ client_flags) == NULL;
alarm(0);
if (failed) {
if (conn->connect_failure_count > 0) {
@@ -441,11 +444,14 @@
case 1:
/* query ok */
result->result = mysql_store_result(conn->mysql);
-
+#ifdef CLIENT_MULTI_RESULTS
/* Because we've enabled CLIENT_MULTI_RESULTS, we need to read
(ignore) extra results - there should not be any.
ret is: -1 = done, >0 = error, 0 = more results. */
while ((ret = mysql_next_result(conn->mysql)) == 0) ;
+#else
+ ret = -1;
+#endif
if (ret < 0 &&
(result->result != NULL || mysql_errno(conn->mysql) == 0))
More information about the dovecot-cvs
mailing list