head     1.6;
branch   ;
access   ;
symbols  Version_2_1:1.6 C_Demo_1:1.4;
locks    cimarron:1.6; strict;
comment  @ * @;


1.6
date     90.09.25.16.13.20;  author kemnitz;  state Exp;
branches ;
next     1.5;

1.5
date     90.04.02.11.09.51;  author hong;  state Exp;
branches ;
next     1.4;

1.4
date     89.09.05.16.56.15;  author mao;  state C_Demo_1;
branches ;
next     1.3;

1.3
date     89.03.22.02.48.24;  author muir;  state Stab;
branches ;
next     1.2;

1.2
date     89.02.28.12.43.42;  author goh;  state Exp;
branches ;
next     1.1;

1.1
date     89.01.17.05.51.58;  author cimarron;  state Exp;
branches ;
next     ;


desc
@@


1.6
log
@Updating from revision 1.5 to revision 1.8
@
text
@/*
 * rel.c --
 *	POSTGRES relation descriptor code.
 */

/* #define RELREFDEBUG	1 */

#include "tmp/postgres.h"
#include "tmp/miscadmin.h"

RcsId("$Header: RCS/rel.c,v 1.8 90/08/18 00:38:47 cimarron Exp $");

#include "access/istrat.h"
#include "access/tupdesc.h"

#include "utils/rel.h"
#include "storage/fd.h"

bool
RelationIsValid(relation)
	Relation	relation;
{
	return ((bool)PointerIsValid(relation));
}

File
RelationGetSystemPort(relation)
	Relation	relation;
{
	return (relation->rd_fd);
}

bool
RelationHasReferenceCountZero(relation)
	Relation	relation;
{
	return ((bool)(relation->rd_refcnt == 0));
}

void
RelationSetReferenceCount(relation, count)
	Relation	relation;
	Count		count;
{
#ifdef	RELREFDEBUG
	elog(-2, "Set(%.16s[%d->%d])", RelationGetRelationName(relation),
                relation->rd_refcnt, count);
#endif

	relation->rd_refcnt = count;
}

void
RelationIncrementReferenceCount(relation)
	Relation	relation;
{
#ifdef	RELREFDEBUG
	elog(-2, "Increment(%.16s[%d->%d])", RelationGetRelationName(relation),
                relation->rd_refcnt, 1 + relation->rd_refcnt);
#endif

	relation->rd_refcnt += 1;
}

void
RelationDecrementReferenceCount(relation)
	Relation	relation;
{
#ifdef	RELREFDEBUG
	elog(-2, "Decrement(%.16s[%d->%d])", RelationGetRelationName(relation),
                relation->rd_refcnt, -1 + relation->rd_refcnt);
#endif

	relation->rd_refcnt -= 1;
}

AccessMethodTupleForm
RelationGetAccessMethodTupleForm(relation)
	Relation	relation;
{
	return (relation->rd_am);
}

RelationTupleForm
RelationGetRelationTupleForm(relation)
	Relation	relation;
{
	return (relation->rd_rel);
}


TupleDescriptor
RelationGetTupleDescriptor(relation)
	Relation	relation;
{
	return (&relation->rd_att);
}

IndexStrategy
RelationGetIndexStrategy(relation)
	Relation	relation;
{
	return ((IndexStrategy) relation->rd_att.data[
		relation->rd_rel->relnatts]);
}

void
RelationSetIndexStrategy(relation, strategy)
	Relation	relation;
	IndexStrategy	strategy;
{
	IndexStrategy	*relationIndexStrategyP;

	Assert(PointerIsValid(relation));
	Assert(IndexStrategyIsValid(strategy));

	relationIndexStrategyP = (IndexStrategy *)
		&relation->rd_att.data[relation->rd_rel->relnatts];

	*relationIndexStrategyP = strategy;
}

ObjectId
RelationGetRelationId(relation)
	Relation	relation;
{
	return(relation->rd_id);
}

Name
RelationGetRelationName(relation)
	Relation	relation;
{
	return(&relation->rd_rel->relname);
}

File
RelationGetFile(relation)
	Relation	relation;
{
	return(relation->rd_fd);
}

AttributeNumber
RelationGetNumberOfAttributes(relation)
	Relation	relation;
{
	return(relation->rd_rel->relnatts);
}

@


1.5
log
@a minor change for striping
@
text
@a0 2


d8 2
a9 1
#include "c.h"
d11 1
a11 1
#include "os.h"
d13 2
a14 3
#include "cat.h"
#include "istrat.h"
#include "tupdesc.h"
d16 2
a17 4
#include "rel.h"
#include "fd.h"

RcsId("$Header: RCS/rel.c,v 1.4 89/09/05 16:56:15 mao C_Demo_1 Locker: hirohama $");
@


1.4
log
@Working version of C-only demo
@
text
@d19 1
d21 1
a21 1
RcsId("$Header: /usr6/postgres/mao/postgres/src/access/genam/RCS/rel.c,v 1.3 89/03/22 02:48:24 muir Stab $");
d30 1
a30 1
SystemPort
@


1.3
log
@copyright delete
@
text
@d20 1
a20 1
RcsId("$Header: rel.c,v 1.2 89/02/28 12:43:42 muir Locked $");
@


1.2
log
@added RelationGetNumberOfAttributes
@
text
@a1 23
/*
 * 
 * POSTGRES Data Base Management System
 * 
 * Copyright (c) 1988 Regents of the University of California
 * 
 * Permission to use, copy, modify, and distribute this software and its
 * documentation for educational, research, and non-profit purposes and
 * without fee is hereby granted, provided that the above copyright
 * notice appear in all copies and that both that copyright notice and
 * this permission notice appear in supporting documentation, and that
 * the name of the University of California not be used in advertising
 * or publicity pertaining to distribution of the software without
 * specific, written prior permission.  Permission to incorporate this
 * software into commercial products can be obtained from the Campus
 * Software Office, 295 Evans Hall, University of California, Berkeley,
 * Ca., 94720 provided only that the the requestor give the University
 * of California a free licence to any derived software for educational
 * and research purposes.  The University of California makes no
 * representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 * 
 */
a2 2


d20 1
a20 1
RcsId("$Header: rel.c,v 1.1 89/01/17 05:51:58 goh Locked $");
@


1.1
log
@Initial revision
@
text
@d45 1
a45 1
RcsId("$Header: rel.c,v 1.1 88/11/11 16:35:35 postgres Exp $");
d171 8
@
