dovecot-2.0: lib-sql: Implemented sql_result_get_field_value_bin...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jan 31 00:27:55 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/5a6e44ca5825
changeset: 12583:5a6e44ca5825
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jan 31 00:27:53 2011 +0200
description:
lib-sql: Implemented sql_result_get_field_value_binary() for MySQL.

diffstat:

 src/lib-sql/driver-mysql.c |  16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 816a6e69d4b5 -r 5a6e44ca5825 src/lib-sql/driver-mysql.c
--- a/src/lib-sql/driver-mysql.c	Sun Jan 30 23:57:14 2011 +0200
+++ b/src/lib-sql/driver-mysql.c	Mon Jan 31 00:27:53 2011 +0200
@@ -31,7 +31,7 @@
 	struct sql_result api;
 
 	MYSQL_RES *result;
-        MYSQL_ROW row;
+	MYSQL_ROW row;
 
 	MYSQL_FIELD *fields;
 	unsigned int fields_count;
@@ -406,12 +406,16 @@
 }
 
 static const unsigned char *
-driver_mysql_result_get_field_value_binary(struct sql_result *_result ATTR_UNUSED,
-					   unsigned int idx ATTR_UNUSED,
-					   size_t *size_r ATTR_UNUSED)
+driver_mysql_result_get_field_value_binary(struct sql_result *_result,
+					   unsigned int idx, size_t *size_r)
 {
-	/* FIXME */
-	return NULL;
+	struct mysql_result *result = (struct mysql_result *)_result;
+	unsigned long *lengths;
+
+	lengths = mysql_fetch_lengths(result->result);
+
+	*size_r = lengths[idx];
+	return (const void *)result->row[idx];
 }
 
 static const char *


More information about the dovecot-cvs mailing list