mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Add transaction status field to ReadyForQuery messages, and make room
for tableID/columnID in RowDescription. (The latter isn't really implemented yet though --- the backend always sends zeroes, and libpq just throws away the data.)
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.145 2003/03/27 16:51:27 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.146 2003/04/26 20:22:59 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction aborts can now occur two ways:
|
||||
@ -1705,17 +1705,44 @@ AbortOutOfAnyTransaction(void)
|
||||
s->blockState = TBLOCK_DEFAULT;
|
||||
}
|
||||
|
||||
/*
|
||||
* IsTransactionBlock --- are we within a transaction block?
|
||||
*/
|
||||
bool
|
||||
IsTransactionBlock(void)
|
||||
{
|
||||
TransactionState s = CurrentTransactionState;
|
||||
|
||||
if (s->blockState == TBLOCK_INPROGRESS
|
||||
|| s->blockState == TBLOCK_ABORT
|
||||
|| s->blockState == TBLOCK_ENDABORT)
|
||||
return true;
|
||||
if (s->blockState == TBLOCK_DEFAULT)
|
||||
return false;
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* TransactionBlockStatusCode - return status code to send in ReadyForQuery
|
||||
*/
|
||||
char
|
||||
TransactionBlockStatusCode(void)
|
||||
{
|
||||
TransactionState s = CurrentTransactionState;
|
||||
|
||||
switch (s->blockState)
|
||||
{
|
||||
case TBLOCK_DEFAULT:
|
||||
return 'I'; /* idle --- not in transaction */
|
||||
case TBLOCK_BEGIN:
|
||||
case TBLOCK_INPROGRESS:
|
||||
case TBLOCK_END:
|
||||
return 'T'; /* in transaction */
|
||||
case TBLOCK_ABORT:
|
||||
case TBLOCK_ENDABORT:
|
||||
return 'E'; /* in failed transaction */
|
||||
}
|
||||
|
||||
/* should never get here */
|
||||
elog(ERROR, "bogus transaction block state");
|
||||
return 0; /* keep compiler quiet */
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user