search for: consume_results

Displaying 2 results from an estimated 2 matches for "consume_results".

2010 Mar 25
2
A questions about consume_results (driver-pgsql.c)
Code -------------- static void consume_results(struct pgsql_db *db) { do { if (!PQconsumeInput(db->pg)) break; if (PQisBusy(db->pg)) return; } while (PQgetResult(db->pg) != NULL); if (PQstatus(db->pg) == CONNECTION_BAD) io_remove_closed(&db->io); else io_remove(&db->io); db->querying = FALSE;...
2010 Mar 26
2
Fix for the consume_results leak
...-0000 1.1.1.2 +++ dovecot/src/lib-sql/driver-pgsql.c 26 Mar 2010 14:13:18 -0000 1.1.1.2.4.1 @@ -247,6 +247,17 @@ return 0; } +static inline int more_results(PGconn *pg) +{ + PGresult *pgres; + + pgres = PQgetResult(pg); + if (!pgres) return 0; + + PQclear(pgres); + return 1; +} + static void consume_results(struct pgsql_db *db) { do { @@ -255,7 +266,7 @@ if (PQisBusy(db->pg)) return; - } while (PQgetResult(db->pg) != NULL); + } while (more_results(db->pg)); if (PQstatus(db->pg) == CONNECTION_BAD) io_remove_closed(&db->io);