postgresql/src/backend/access/common/scankey.c

71 lines
2.0 KiB
C
Raw Normal View History

/*-------------------------------------------------------------------------
*
* scankey.c
* scan key support code
*
2003-08-04 04:40:20 +02:00
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.23 2003/11/09 21:30:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "access/skey.h"
/*
1999-05-25 18:15:34 +02:00
* ScanKeyEntryInitialize
* Initializes a scan key entry given all the field values.
* The target procedure is specified by OID.
*
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
* itself, because that's what will be used for any subsidiary info attached
* to the ScanKey's FmgrInfo record.
*/
void
ScanKeyEntryInitialize(ScanKey entry,
int flags,
AttrNumber attributeNumber,
StrategyNumber strategy,
RegProcedure procedure,
Datum argument,
Oid argtype)
{
entry->sk_flags = flags;
entry->sk_attno = attributeNumber;
entry->sk_strategy = strategy;
entry->sk_argument = argument;
entry->sk_argtype = argtype;
fmgr_info(procedure, &entry->sk_func);
}
/*
* ScanKeyEntryInitializeWithInfo
* Initializes a scan key entry using an already-completed FmgrInfo
* function lookup record.
*
* Note: CurrentMemoryContext at call should be as long-lived as the ScanKey
* itself, because that's what will be used for any subsidiary info attached
* to the ScanKey's FmgrInfo record.
*/
void
ScanKeyEntryInitializeWithInfo(ScanKey entry,
int flags,
AttrNumber attributeNumber,
StrategyNumber strategy,
FmgrInfo *finfo,
Datum argument,
Oid argtype)
{
entry->sk_flags = flags;
entry->sk_attno = attributeNumber;
entry->sk_strategy = strategy;
entry->sk_argument = argument;
entry->sk_argtype = argtype;
fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext);
}