/*
- * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.19 2002/09/04 20:31:08 momjian Exp $
+ * $Header: /cvsroot/pgsql/contrib/pgbench/pgbench.c,v 1.20 2002/10/07 05:10:02 ishii Exp $
*
* pgbench: a simple TPC-B like benchmark program for PostgreSQL
* written by Tatsuo Ishii
{ /* are we receiver? */
if (debug)
fprintf(stderr, "client %d receiving\n", n);
- while (PQisBusy(st->con) == TRUE)
- {
- if (!PQconsumeInput(st->con))
- { /* there's something wrong */
- fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state);
- remains--; /* I've aborted */
- PQfinish(st->con);
- st->con = NULL;
- return;
- }
+ if (!PQconsumeInput(st->con))
+ { /* there's something wrong */
+ fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state);
+ remains--; /* I've aborted */
+ PQfinish(st->con);
+ st->con = NULL;
+ return;
}
+ if (PQisBusy(st->con))
+ return; /* don't have the whole result yet */
switch (st->state)
{
{ /* are we receiver? */
if (debug)
fprintf(stderr, "client %d receiving\n", n);
- while (PQisBusy(st->con) == TRUE)
- {
- if (!PQconsumeInput(st->con))
- { /* there's something wrong */
- fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state);
- remains--; /* I've aborted */
- PQfinish(st->con);
- st->con = NULL;
- return;
- }
+ if (!PQconsumeInput(st->con))
+ { /* there's something wrong */
+ fprintf(stderr, "Client %d aborted in state %d. Probably the backend died while processing.\n", n, st->state);
+ remains--; /* I've aborted */
+ PQfinish(st->con);
+ st->con = NULL;
+ return;
}
+ if (PQisBusy(st->con))
+ return; /* don't have the whole result yet */
switch (st->state)
{