Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit389e336

Browse files
committed
From: wieck@sapserv.debis.de
Hi, counting the empty dummy queries in libpq isn't everything. If the backend sends an error, the I returns from the dummies still come. So we must eat them up in any case, not just returning on the occurence of an E reply.Until later, Jan
1 parent16293d0 commit389e336

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

‎src/interfaces/libpq/fe-exec.c

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.26 1996/12/31 07:29:15 bryanh Exp $
10+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.27 1997/01/08 23:25:32 scrappy Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -380,6 +380,10 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug,
380380
responses, less the number of corresponding responses we have
381381
received.
382382
*/
383+
interrors;
384+
/* If an error is received, we must still drain out the empty
385+
queries sent. So we need another flag.
386+
*/
383387
charcmdStatus[MAX_MESSAGE_LEN];
384388
charpname[MAX_MESSAGE_LEN];/* portal name */
385389

@@ -388,6 +392,7 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug,
388392
*/
389393

390394
emptiesSent=0;/* No empty queries sent yet */
395+
errors=0;/* No errors received yet */
391396
pname[0]='\0';
392397

393398
done= false;/* initial value */
@@ -444,7 +449,10 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug,
444449
"but attempt to read the error message failed.");
445450
}
446451
*result_p= (PGresult*)NULL;
447-
done= true;
452+
errors++;
453+
if (emptiesSent==0) {
454+
done= true;
455+
}
448456
break;
449457
case'I': {/* empty query */
450458
/* read and throw away the closing '\0' */
@@ -458,13 +466,21 @@ process_response_from_backend(FILE *pfin, FILE *pfout, FILE *pfdebug,
458466
* If this is the result of a portal query command set the
459467
* command status and message accordingly. DZ - 31-8-1996
460468
*/
461-
*result_p=makeEmptyPGresult(conn,PGRES_COMMAND_OK);
462-
strncpy((*result_p)->cmdStatus,cmdStatus,CMDSTATUS_LEN-1);
469+
if (!errors) {
470+
*result_p=makeEmptyPGresult(conn,PGRES_COMMAND_OK);
471+
strncpy((*result_p)->cmdStatus,cmdStatus,CMDSTATUS_LEN-1);
472+
}else {
473+
*result_p= (PGresult*)NULL;
474+
}
463475
done= true;
464476
}
465477
}
466478
else {
467-
*result_p=makeEmptyPGresult(conn,PGRES_EMPTY_QUERY);
479+
if (!errors) {
480+
*result_p=makeEmptyPGresult(conn,PGRES_EMPTY_QUERY);
481+
}else {
482+
*result_p= (PGresult*)NULL;
483+
}
468484
done= true;
469485
}
470486
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp