PostgreSQL Source Code
git master
sdir.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* sdir.h
4
* POSTGRES scan direction definitions.
5
*
6
*
7
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
9
*
10
* src/include/access/sdir.h
11
*
12
*-------------------------------------------------------------------------
13
*/
14
#ifndef SDIR_H
15
#define SDIR_H
16
17
18
/*
19
* Defines the direction for scanning a table or an index. Scans are never
20
* invoked using NoMovementScanDirection. For convenience, we use the values
21
* -1 and 1 for backward and forward scans. This allows us to perform a few
22
* mathematical tricks such as what is done in ScanDirectionCombine.
23
*/
24
typedef
enum
ScanDirection
25
{
26
BackwardScanDirection
= -1,
27
NoMovementScanDirection
= 0,
28
ForwardScanDirection
= 1
29
}
ScanDirection
;
30
31
/*
32
* Determine the net effect of two direction specifications.
33
* This relies on having ForwardScanDirection = +1, BackwardScanDirection = -1,
34
* and will probably not do what you want if applied to any other values.
35
*/
36
#define ScanDirectionCombine(a, b) ((a) * (b))
37
38
/*
39
* ScanDirectionIsValid
40
* True iff scan direction is valid.
41
*/
42
#define ScanDirectionIsValid(direction) \
43
((bool) (BackwardScanDirection <= (direction) && \
44
(direction) <= ForwardScanDirection))
45
46
/*
47
* ScanDirectionIsBackward
48
* True iff scan direction is backward.
49
*/
50
#define ScanDirectionIsBackward(direction) \
51
((bool) ((direction) == BackwardScanDirection))
52
53
/*
54
* ScanDirectionIsNoMovement
55
* True iff scan direction indicates no movement.
56
*/
57
#define ScanDirectionIsNoMovement(direction) \
58
((bool) ((direction) == NoMovementScanDirection))
59
60
/*
61
* ScanDirectionIsForward
62
* True iff scan direction is forward.
63
*/
64
#define ScanDirectionIsForward(direction) \
65
((bool) ((direction) == ForwardScanDirection))
66
67
#endif
/* SDIR_H */
ScanDirection
ScanDirection
Definition:
sdir.h:25
NoMovementScanDirection
@ NoMovementScanDirection
Definition:
sdir.h:27
BackwardScanDirection
@ BackwardScanDirection
Definition:
sdir.h:26
ForwardScanDirection
@ ForwardScanDirection
Definition:
sdir.h:28
src
include
access
sdir.h
Generated on Wed Nov 6 2024 18:13:24 for PostgreSQL Source Code by
1.9.1