mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Cleanup the usage of ScanDirection: use the symbolic names for the
possible ScanDirection alternatives rather than magic numbers (-1, 0, 1). Also, use the ScanDirection macros in a few places rather than directly checking whether `dir == ForwardScanDirection' and the like. Per patch from James William Pye. His patch also changed ScanDirection to be a "char" rather than an enum, which I haven't applied.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.98 2005/11/22 18:17:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.99 2006/02/21 23:01:54 neilc Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -795,7 +795,7 @@ PortalRunSelect(Portal portal,
|
||||
nprocessed = queryDesc->estate->es_processed;
|
||||
}
|
||||
|
||||
if (direction != NoMovementScanDirection)
|
||||
if (!ScanDirectionIsNoMovement(direction))
|
||||
{
|
||||
long oldPos;
|
||||
|
||||
@ -837,7 +837,7 @@ PortalRunSelect(Portal portal,
|
||||
nprocessed = queryDesc->estate->es_processed;
|
||||
}
|
||||
|
||||
if (direction != NoMovementScanDirection)
|
||||
if (!ScanDirectionIsNoMovement(direction))
|
||||
{
|
||||
if (nprocessed > 0 && portal->atEnd)
|
||||
{
|
||||
@ -890,13 +890,13 @@ RunFromStore(Portal portal, ScanDirection direction, long count,
|
||||
|
||||
(*dest->rStartup) (dest, CMD_SELECT, portal->tupDesc);
|
||||
|
||||
if (direction == NoMovementScanDirection)
|
||||
if (ScanDirectionIsNoMovement(direction))
|
||||
{
|
||||
/* do nothing except start/stop the destination */
|
||||
}
|
||||
else
|
||||
{
|
||||
bool forward = (direction == ForwardScanDirection);
|
||||
bool forward = ScanDirectionIsForward(direction);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
Reference in New Issue
Block a user