aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xid.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-05-12 23:08:52 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-05-12 23:08:52 +0000
commit30f609484d025bfb7c69f8f6b9610dc981cb5fb8 (patch)
tree479152f5d7605284dfecb779eadaf0e254723815 /src/backend/access/transam/xid.c
parentb02832719ce9926fe5a1c9b7e03cebf3dbf6a653 (diff)
downloadpostgresql-30f609484d025bfb7c69f8f6b9610dc981cb5fb8.tar.gz
postgresql-30f609484d025bfb7c69f8f6b9610dc981cb5fb8.zip
Add binary I/O routines for a bunch more datatypes. Still a few to go,
but that was enough tedium for one day. Along the way, move the few support routines for types xid and cid into a more logical place.
Diffstat (limited to 'src/backend/access/transam/xid.c')
-rw-r--r--src/backend/access/transam/xid.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/src/backend/access/transam/xid.c b/src/backend/access/transam/xid.c
deleted file mode 100644
index 6ab4f8a0d8c..00000000000
--- a/src/backend/access/transam/xid.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * xid.c
- * POSTGRES transaction identifier datatype.
- *
- * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
- * Portions Copyright (c) 1994, Regents of the University of California
- *
- * $Id: xid.c,v 1.35 2002/06/20 20:29:25 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-
-#include "postgres.h"
-
-#include <limits.h>
-
-#include "access/xact.h"
-
-
-#define PG_GETARG_TRANSACTIONID(n) DatumGetTransactionId(PG_GETARG_DATUM(n))
-#define PG_RETURN_TRANSACTIONID(x) return TransactionIdGetDatum(x)
-
-
-Datum
-xidin(PG_FUNCTION_ARGS)
-{
- char *str = PG_GETARG_CSTRING(0);
-
- PG_RETURN_TRANSACTIONID((TransactionId) strtoul(str, NULL, 0));
-}
-
-Datum
-xidout(PG_FUNCTION_ARGS)
-{
- TransactionId transactionId = PG_GETARG_TRANSACTIONID(0);
-
- /* maximum 32 bit unsigned integer representation takes 10 chars */
- char *str = palloc(11);
-
- snprintf(str, 11, "%lu", (unsigned long) transactionId);
-
- PG_RETURN_CSTRING(str);
-}
-
-/*
- * xideq - are two xids equal?
- */
-Datum
-xideq(PG_FUNCTION_ARGS)
-{
- TransactionId xid1 = PG_GETARG_TRANSACTIONID(0);
- TransactionId xid2 = PG_GETARG_TRANSACTIONID(1);
-
- PG_RETURN_BOOL(TransactionIdEquals(xid1, xid2));
-}
-
-/*
- * xid_age - compute age of an XID (relative to current xact)
- */
-Datum
-xid_age(PG_FUNCTION_ARGS)
-{
- TransactionId xid = PG_GETARG_TRANSACTIONID(0);
- TransactionId now = GetCurrentTransactionId();
-
- /* Permanent XIDs are always infinitely old */
- if (!TransactionIdIsNormal(xid))
- PG_RETURN_INT32(INT_MAX);
-
- PG_RETURN_INT32((int32) (now - xid));
-}