From 9294d55bcb2489b0ae886a8a4786d6fb7c093658 Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Sat, 22 Apr 2006 12:14:56 +0000 Subject: [PATCH] Fix bug in SimpleForwardToBackend(). consider following case: > Describe(for 'S') < ParameterDescription < RowDescription or NoData > Describe(for 'P') < RowDescription or Nodata --- pool_process_query.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pool_process_query.c b/pool_process_query.c index 8772b1f..30e8ba5 100644 --- a/pool_process_query.c +++ b/pool_process_query.c @@ -2372,8 +2372,8 @@ POOL_STATUS SimpleForwardToFrontend(char kind, POOL_CONNECTION *frontend, POOL_C * so that it accepts next command. * Note that this may be overkill since client may send * it by itself. Moreover we do not need it in non-extend mode. - * At this point we regard it harmfull since error resonse - * will not be sent so frequently. + * At this point we regard it is not harmfull since error resonse + * will not be sent too frequently. */ pool_write(cp, "S", 1); res1 = htonl(4); @@ -2398,6 +2398,7 @@ POOL_STATUS SimpleForwardToFrontend(char kind, POOL_CONNECTION *frontend, POOL_C ret = SimpleForwardToFrontend(k, frontend, backend); if (ret != POOL_CONTINUE) return ret; + pool_flush(frontend); } status = pool_read(MASTER(backend), &res1, sizeof(res1)); @@ -2506,6 +2507,7 @@ POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CO if (kind == 'P' || kind == 'B' || kind == 'D' || kind == 'C') { int i; + int kind1; for (i = 0;i < backend->num;i++) { @@ -2526,13 +2528,25 @@ POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, POOL_CO break; } - kind = pool_read_kind(backend); - if (kind < 0) + if (kind == 'D' && *p == 'S') + { + kind1 = pool_read_kind(backend); + if (kind1 < 0) + { + pool_error("SimpleForwardToBackend: pool_read_kind error"); + return POOL_ERROR; + } + SimpleForwardToFrontend(kind1, frontend, backend); + pool_flush(frontend); + } + + kind1 = pool_read_kind(backend); + if (kind1 < 0) { pool_error("SimpleForwardToBackend: pool_read_kind error"); return POOL_ERROR; } - SimpleForwardToFrontend(kind, frontend, backend); + SimpleForwardToFrontend(kind1, frontend, backend); return pool_flush(frontend); } -- 2.39.5