dovecot-2.0: pgsql: We didn't read all the SQL packets replies f...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 13 02:35:02 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/d467712aee77
changeset: 9271:d467712aee77
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 12 19:34:54 2009 -0400
description:
pgsql: We didn't read all the SQL packets replies from the server.

diffstat:

1 file changed, 10 insertions(+), 1 deletion(-)
src/lib-sql/driver-pgsql.c |   11 ++++++++++-

diffs (21 lines):

diff -r f9ebd72a73e8 -r d467712aee77 src/lib-sql/driver-pgsql.c
--- a/src/lib-sql/driver-pgsql.c	Tue May 12 19:34:06 2009 -0400
+++ b/src/lib-sql/driver-pgsql.c	Tue May 12 19:34:54 2009 -0400
@@ -696,7 +696,16 @@ static int driver_pgsql_result_next_row(
 
 	if (result->rows != 0) {
 		/* second time we're here */
-		return ++result->rownum < result->rows;
+		if (++result->rownum < result->rows)
+			return 1;
+
+		/* end of this packet. see if there's more. FIXME: this may
+		   block, but the current API doesn't provide a non-blocking
+		   way to do this.. */
+		PQclear(result->pgres);
+		result->pgres = PQgetResult(db->pg);
+		if (result->pgres == NULL)
+			return 0;
 	}
 
 	if (result->pgres == NULL)


More information about the dovecot-cvs mailing list