diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-04-26 20:23:00 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-04-26 20:23:00 +0000 |
| commit | 4db9689d1a0a97b8b6060bf8bacac53a0d47825d (patch) | |
| tree | 0e754b59deaba85b54484962131a3b8c658193ed /src/include/access/xact.h | |
| parent | 2b1e36c7c0f294c70595bddaae0caecbcf8b50c6 (diff) | |
| download | postgresql-4db9689d1a0a97b8b6060bf8bacac53a0d47825d.tar.gz | |
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.)
Diffstat (limited to 'src/include/access/xact.h')
| -rw-r--r-- | src/include/access/xact.h | 55 |
1 files changed, 33 insertions, 22 deletions
diff --git a/src/include/access/xact.h b/src/include/access/xact.h index b3938c869e..5525ce7445 100644 --- a/src/include/access/xact.h +++ b/src/include/access/xact.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: xact.h,v 1.49 2003/01/10 22:03:30 petere Exp $ + * $Id: xact.h,v 1.50 2003/04/26 20:22:59 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,9 +29,35 @@ extern int DefaultXactIsoLevel; extern int XactIsoLevel; + +/* Xact read-only state */ extern bool DefaultXactReadOnly; extern bool XactReadOnly; +/* + * transaction states - transaction state from server perspective + */ +typedef enum TransState +{ + TRANS_DEFAULT, + TRANS_START, + TRANS_INPROGRESS, + TRANS_COMMIT, + TRANS_ABORT +} TransState; + +/* + * transaction block states - transaction state of client queries + */ +typedef enum TBlockState +{ + TBLOCK_DEFAULT, + TBLOCK_BEGIN, + TBLOCK_INPROGRESS, + TBLOCK_END, + TBLOCK_ABORT, + TBLOCK_ENDABORT +} TBlockState; /* ---------------- * transaction state structure @@ -43,33 +69,17 @@ typedef struct TransactionStateData CommandId commandId; AbsoluteTime startTime; int startTimeUsec; - int state; - int blockState; + TransState state; + TBlockState blockState; } TransactionStateData; typedef TransactionStateData *TransactionState; -/* - * transaction states - transaction state from server perspective - * - * Syntax error could cause transaction to abort, but client code thinks - * it is still in a transaction, so we have to wait for COMMIT/ROLLBACK. - */ -#define TRANS_DEFAULT 0 -#define TRANS_START 1 -#define TRANS_INPROGRESS 2 -#define TRANS_COMMIT 3 -#define TRANS_ABORT 4 -/* - * transaction block states - transaction state of client queries +/* ---------------- + * transaction-related XLOG entries + * ---------------- */ -#define TBLOCK_DEFAULT 0 -#define TBLOCK_BEGIN 1 -#define TBLOCK_INPROGRESS 2 -#define TBLOCK_END 3 -#define TBLOCK_ABORT 4 -#define TBLOCK_ENDABORT 5 /* * XLOG allows to store some information in high 4 bits of log @@ -115,6 +125,7 @@ extern void AbortCurrentTransaction(void); extern void BeginTransactionBlock(void); extern void EndTransactionBlock(void); extern bool IsTransactionBlock(void); +extern char TransactionBlockStatusCode(void); extern void UserAbortTransactionBlock(void); extern void AbortOutOfAnyTransaction(void); extern void PreventTransactionChain(void *stmtNode, const char *stmtType); |
