1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
2003-11-09 22:30:38 +01:00
|
|
|
* scankey.c
|
|
|
|
* scan key support code
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2003-08-04 04:40:20 +02:00
|
|
|
* Portions Copyright (c) 1996-2003, 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
|
2003-11-09 22:30:38 +01:00
|
|
|
* $Header: /cvsroot/pgsql/src/backend/access/common/scankey.c,v 1.23 2003/11/09 21:30:35 tgl Exp $
|
1996-07-09 08:22:35 +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
|
|
|
* ScanKeyEntryInitialize
|
2003-11-09 22:30:38 +01:00
|
|
|
* Initializes a scan key entry given all the field values.
|
|
|
|
* The target procedure is specified by OID.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2003-11-09 22:30:38 +01:00
|
|
|
* 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.
|
1996-07-09 08:22:35 +02:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ScanKeyEntryInitialize(ScanKey entry,
|
2003-11-09 22:30:38 +01:00
|
|
|
int flags,
|
1997-09-07 07:04:48 +02:00
|
|
|
AttrNumber attributeNumber,
|
2003-11-09 22:30:38 +01:00
|
|
|
StrategyNumber strategy,
|
1997-09-07 07:04:48 +02:00
|
|
|
RegProcedure procedure,
|
2003-11-09 22:30:38 +01:00
|
|
|
Datum argument,
|
|
|
|
Oid argtype)
|
1996-07-09 08:22:35 +02:00
|
|
|
{
|
1997-09-07 07:04:48 +02:00
|
|
|
entry->sk_flags = flags;
|
|
|
|
entry->sk_attno = attributeNumber;
|
2003-11-09 22:30:38 +01:00
|
|
|
entry->sk_strategy = strategy;
|
1997-09-07 07:04:48 +02:00
|
|
|
entry->sk_argument = argument;
|
2003-11-09 22:30:38 +01:00
|
|
|
entry->sk_argtype = argtype;
|
1998-01-15 20:46:37 +01:00
|
|
|
fmgr_info(procedure, &entry->sk_func);
|
1996-07-09 08:22:35 +02:00
|
|
|
}
|
2001-10-07 01:21:45 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ScanKeyEntryInitializeWithInfo
|
|
|
|
* Initializes a scan key entry using an already-completed FmgrInfo
|
|
|
|
* function lookup record.
|
|
|
|
*
|
2003-11-09 22:30:38 +01:00
|
|
|
* 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.
|
2001-10-07 01:21:45 +02:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
ScanKeyEntryInitializeWithInfo(ScanKey entry,
|
2003-11-09 22:30:38 +01:00
|
|
|
int flags,
|
2001-10-07 01:21:45 +02:00
|
|
|
AttrNumber attributeNumber,
|
2003-11-09 22:30:38 +01:00
|
|
|
StrategyNumber strategy,
|
2001-10-07 01:21:45 +02:00
|
|
|
FmgrInfo *finfo,
|
2003-11-09 22:30:38 +01:00
|
|
|
Datum argument,
|
|
|
|
Oid argtype)
|
2001-10-07 01:21:45 +02:00
|
|
|
{
|
|
|
|
entry->sk_flags = flags;
|
|
|
|
entry->sk_attno = attributeNumber;
|
2003-11-09 22:30:38 +01:00
|
|
|
entry->sk_strategy = strategy;
|
2001-10-07 01:21:45 +02:00
|
|
|
entry->sk_argument = argument;
|
2003-11-09 22:30:38 +01:00
|
|
|
entry->sk_argtype = argtype;
|
|
|
|
fmgr_info_copy(&entry->sk_func, finfo, CurrentMemoryContext);
|
2001-10-07 01:21:45 +02:00
|
|
|
}
|