1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* scan.c
|
1997-09-07 07:04:48 +02:00
|
|
|
* scan direction and key code
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* IDENTIFICATION
|
2001-06-01 04:41:36 +02:00
|
|
|
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.19 2001/06/01 02:41:35 tgl Exp $
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
1996-10-19 06:51:44 +02:00
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "postgres.h"
|
1996-10-19 06:51:44 +02:00
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "access/skey.h"
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ScanKeyEntryIsLegal
|
1997-09-07 07:04:48 +02:00
|
|
|
* True iff the scan key entry is legal.
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
|
|
|
#define ScanKeyEntryIsLegal(entry) \
|
1998-06-15 20:40:05 +02:00
|
|
|
( \
|
|
|
|
AssertMacro(PointerIsValid(entry)), \
|
|
|
|
AttributeNumberIsValid((entry)->sk_attno) \
|
|
|
|
)
|
1996-07-09 08:22:35 +02:00
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ScanKeyEntrySetIllegal
|
1997-09-07 07:04:48 +02:00
|
|
|
* Marks a scan key entry as illegal.
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ScanKeyEntrySetIllegal(ScanKey entry)
|
|
|
|
{
|
|
|
|
|
1997-09-07 07:04:48 +02:00
|
|
|
Assert(PointerIsValid(entry));
|
|
|
|
|
|
|
|
entry->sk_flags = 0; /* just in case... */
|
|
|
|
entry->sk_attno = InvalidAttrNumber;
|
|
|
|
entry->sk_procedure = 0; /* should be InvalidRegProcedure */
|
2001-06-01 04:41:36 +02:00
|
|
|
entry->sk_func.fn_oid = InvalidOid;
|
|
|
|
entry->sk_argument = (Datum) 0;
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1999-05-25 18:15:34 +02:00
|
|
|
* ScanKeyEntryInitialize
|
2001-06-01 04:41:36 +02:00
|
|
|
* Initializes a scan key entry.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
* Note:
|
1997-09-07 07:04:48 +02:00
|
|
|
* Assumes the scan key entry is valid.
|
|
|
|
* Assumes the intialized scan key entry will be legal.
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ScanKeyEntryInitialize(ScanKey entry,
|
1997-09-07 07:04:48 +02:00
|
|
|
bits16 flags,
|
|
|
|
AttrNumber attributeNumber,
|
|
|
|
RegProcedure procedure,
|
|
|
|
Datum argument)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
Assert(PointerIsValid(entry));
|
|
|
|
|
|
|
|
entry->sk_flags = flags;
|
|
|
|
entry->sk_attno = attributeNumber;
|
|
|
|
entry->sk_procedure = procedure;
|
|
|
|
entry->sk_argument = argument;
|
1998-01-15 20:46:37 +01:00
|
|
|
fmgr_info(procedure, &entry->sk_func);
|
1997-09-07 07:04:48 +02:00
|
|
|
|
|
|
|
Assert(ScanKeyEntryIsLegal(entry));
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|