Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
0e20c485
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0e20c485
编写于
9月 03, 2006
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert FETCH/MOVE int64 patch. Was using incorrect checks for
fetch/move in scan.l.
上级
d387a070
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
51 addition
and
115 deletion
+51
-115
src/backend/commands/portalcmds.c
src/backend/commands/portalcmds.c
+3
-3
src/backend/executor/spi.c
src/backend/executor/spi.c
+6
-6
src/backend/parser/gram.y
src/backend/parser/gram.y
+1
-42
src/backend/parser/scan.l
src/backend/parser/scan.l
+1
-17
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+4
-4
src/backend/tcop/pquery.c
src/backend/tcop/pquery.c
+25
-25
src/include/executor/spi.h
src/include/executor/spi.h
+3
-3
src/include/nodes/parsenodes.h
src/include/nodes/parsenodes.h
+2
-9
src/include/tcop/pquery.h
src/include/tcop/pquery.h
+4
-4
src/include/utils/portal.h
src/include/utils/portal.h
+2
-2
未找到文件。
src/backend/commands/portalcmds.c
浏览文件 @
0e20c485
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.5
2 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.5
3 2006/09/03 03:19:44
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -177,7 +177,7 @@ PerformPortalFetch(FetchStmt *stmt,
...
@@ -177,7 +177,7 @@ PerformPortalFetch(FetchStmt *stmt,
char
*
completionTag
)
char
*
completionTag
)
{
{
Portal
portal
;
Portal
portal
;
int64
nprocessed
;
long
nprocessed
;
/*
/*
* Disallow empty-string cursor name (conflicts with protocol-level
* Disallow empty-string cursor name (conflicts with protocol-level
...
@@ -210,7 +210,7 @@ PerformPortalFetch(FetchStmt *stmt,
...
@@ -210,7 +210,7 @@ PerformPortalFetch(FetchStmt *stmt,
/* Return command status if wanted */
/* Return command status if wanted */
if
(
completionTag
)
if
(
completionTag
)
snprintf
(
completionTag
,
COMPLETION_TAG_BUFSIZE
,
"%s
"
INT64_FORMAT
,
snprintf
(
completionTag
,
COMPLETION_TAG_BUFSIZE
,
"%s
%ld"
,
stmt
->
ismove
?
"MOVE"
:
"FETCH"
,
stmt
->
ismove
?
"MOVE"
:
"FETCH"
,
nprocessed
);
nprocessed
);
}
}
...
...
src/backend/executor/spi.c
浏览文件 @
0e20c485
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.16
0 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.16
1 2006/09/03 03:19:44
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -45,7 +45,7 @@ static int _SPI_pquery(QueryDesc *queryDesc, long tcount);
...
@@ -45,7 +45,7 @@ static int _SPI_pquery(QueryDesc *queryDesc, long tcount);
static
void
_SPI_error_callback
(
void
*
arg
);
static
void
_SPI_error_callback
(
void
*
arg
);
static
void
_SPI_cursor_operation
(
Portal
portal
,
bool
forward
,
int64
count
,
static
void
_SPI_cursor_operation
(
Portal
portal
,
bool
forward
,
long
count
,
DestReceiver
*
dest
);
DestReceiver
*
dest
);
static
_SPI_plan
*
_SPI_copy_plan
(
_SPI_plan
*
plan
,
int
location
);
static
_SPI_plan
*
_SPI_copy_plan
(
_SPI_plan
*
plan
,
int
location
);
...
@@ -980,7 +980,7 @@ SPI_cursor_find(const char *name)
...
@@ -980,7 +980,7 @@ SPI_cursor_find(const char *name)
* Fetch rows in a cursor
* Fetch rows in a cursor
*/
*/
void
void
SPI_cursor_fetch
(
Portal
portal
,
bool
forward
,
int64
count
)
SPI_cursor_fetch
(
Portal
portal
,
bool
forward
,
long
count
)
{
{
_SPI_cursor_operation
(
portal
,
forward
,
count
,
_SPI_cursor_operation
(
portal
,
forward
,
count
,
CreateDestReceiver
(
DestSPI
,
NULL
));
CreateDestReceiver
(
DestSPI
,
NULL
));
...
@@ -994,7 +994,7 @@ SPI_cursor_fetch(Portal portal, bool forward, int64 count)
...
@@ -994,7 +994,7 @@ SPI_cursor_fetch(Portal portal, bool forward, int64 count)
* Move in a cursor
* Move in a cursor
*/
*/
void
void
SPI_cursor_move
(
Portal
portal
,
bool
forward
,
int64
count
)
SPI_cursor_move
(
Portal
portal
,
bool
forward
,
long
count
)
{
{
_SPI_cursor_operation
(
portal
,
forward
,
count
,
None_Receiver
);
_SPI_cursor_operation
(
portal
,
forward
,
count
,
None_Receiver
);
}
}
...
@@ -1639,10 +1639,10 @@ _SPI_error_callback(void *arg)
...
@@ -1639,10 +1639,10 @@ _SPI_error_callback(void *arg)
* Do a FETCH or MOVE in a cursor
* Do a FETCH or MOVE in a cursor
*/
*/
static
void
static
void
_SPI_cursor_operation
(
Portal
portal
,
bool
forward
,
int64
count
,
_SPI_cursor_operation
(
Portal
portal
,
bool
forward
,
long
count
,
DestReceiver
*
dest
)
DestReceiver
*
dest
)
{
{
int64
nfetched
;
long
nfetched
;
/* Check that the portal is valid */
/* Check that the portal is valid */
if
(
!
PortalIsValid
(
portal
))
if
(
!
PortalIsValid
(
portal
))
...
...
src/backend/parser/gram.y
浏览文件 @
0e20c485
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.56
3 2006/09/03 00:46:41
momjian Exp $
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.56
4 2006/09/03 03:19:44
momjian Exp $
*
*
* HISTORY
* HISTORY
* AUTHOR DATE MAJOR EVENT
* AUTHOR DATE MAJOR EVENT
...
@@ -116,7 +116,6 @@ static void doNegateFloat(Value *v);
...
@@ -116,7 +116,6 @@ static void doNegateFloat(Value *v);
%union
%union
{
{
int ival;
int ival;
int64 i64val;
char chr;
char chr;
char *str;
char *str;
const char *keyword;
const char *keyword;
...
@@ -325,7 +324,6 @@ static void doNegateFloat(Value *v);
...
@@ -325,7 +324,6 @@ static void doNegateFloat(Value *v);
%type <boolean> opt_varying opt_timezone
%type <boolean> opt_varying opt_timezone
%type <ival> Iconst SignedIconst
%type <ival> Iconst SignedIconst
%type <i64val> SignedI64const
%type <str> Sconst comment_text
%type <str> Sconst comment_text
%type <str> RoleId opt_granted_by opt_boolean ColId_or_Sconst
%type <str> RoleId opt_granted_by opt_boolean ColId_or_Sconst
%type <list> var_list var_list_or_default
%type <list> var_list var_list_or_default
...
@@ -450,7 +448,6 @@ static void doNegateFloat(Value *v);
...
@@ -450,7 +448,6 @@ static void doNegateFloat(Value *v);
/* Special token types, not actually keywords - see the "lex" file */
/* Special token types, not actually keywords - see the "lex" file */
%token <str> IDENT FCONST SCONST BCONST XCONST Op
%token <str> IDENT FCONST SCONST BCONST XCONST Op
%token <ival> ICONST PARAM
%token <ival> ICONST PARAM
%token <i64val> I64CONST
/* precedence: lowest to highest */
/* precedence: lowest to highest */
%nonassoc SET /* see relation_expr_opt_alias */
%nonassoc SET /* see relation_expr_opt_alias */
...
@@ -3359,27 +3356,6 @@ fetch_direction:
...
@@ -3359,27 +3356,6 @@ fetch_direction:
n->howMany = $1;
n->howMany = $1;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| ABSOLUTE_P SignedI64const
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FETCH_ABSOLUTE;
n->howMany = $2;
$$ = (Node *)n;
}
| RELATIVE_P SignedI64const
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FETCH_RELATIVE;
n->howMany = $2;
$$ = (Node *)n;
}
| SignedI64const
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FETCH_FORWARD;
n->howMany = $1;
$$ = (Node *)n;
}
| ALL
| ALL
{
{
FetchStmt *n = makeNode(FetchStmt);
FetchStmt *n = makeNode(FetchStmt);
...
@@ -3401,13 +3377,6 @@ fetch_direction:
...
@@ -3401,13 +3377,6 @@ fetch_direction:
n->howMany = $2;
n->howMany = $2;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| FORWARD SignedI64const
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FETCH_FORWARD;
n->howMany = $2;
$$ = (Node *)n;
}
| FORWARD ALL
| FORWARD ALL
{
{
FetchStmt *n = makeNode(FetchStmt);
FetchStmt *n = makeNode(FetchStmt);
...
@@ -3429,13 +3398,6 @@ fetch_direction:
...
@@ -3429,13 +3398,6 @@ fetch_direction:
n->howMany = $2;
n->howMany = $2;
$$ = (Node *)n;
$$ = (Node *)n;
}
}
| BACKWARD SignedI64const
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FETCH_BACKWARD;
n->howMany = $2;
$$ = (Node *)n;
}
| BACKWARD ALL
| BACKWARD ALL
{
{
FetchStmt *n = makeNode(FetchStmt);
FetchStmt *n = makeNode(FetchStmt);
...
@@ -8540,9 +8502,6 @@ RoleId: ColId { $$ = $1; };
...
@@ -8540,9 +8502,6 @@ RoleId: ColId { $$ = $1; };
SignedIconst: ICONST { $$ = $1; }
SignedIconst: ICONST { $$ = $1; }
| '-' ICONST { $$ = - $2; }
| '-' ICONST { $$ = - $2; }
;
;
SignedI64const: I64CONST { $$ = $1; }
| '-' I64CONST { $$ = - $2; }
;
/*
/*
* Name classification hierarchy.
* Name classification hierarchy.
...
...
src/backend/parser/scan.l
浏览文件 @
0e20c485
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.13
6 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/backend/parser/scan.l,v 1.13
7 2006/09/03 03:19:44
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -666,22 +666,6 @@ other .
...
@@ -666,22 +666,6 @@ other .
#endif
#endif
)
)
{
{
/* For Fetch/Move stmt, convert the string into int64 value */
if((strcmp(yylval.keyword, "fetch")==0) || (strcmp(yylval.keyword, "move")==0))
{
int64 int64Val;
errno = 0;
int64Val = strtoll(yytext, &endptr, 10);
if (*endptr != '\0' || errno == ERANGE)
{
yylval.str = pstrdup(yytext);
return FCONST;
}
yylval.i64val = int64Val;
return I64CONST;
}
/* integer too large, treat it as a float */
/* integer too large, treat it as a float */
yylval.str = pstrdup(yytext);
yylval.str = pstrdup(yytext);
return FCONST;
return FCONST;
...
...
src/backend/tcop/postgres.c
浏览文件 @
0e20c485
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.50
4 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.50
5 2006/09/03 03:19:44
momjian Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -1687,7 +1687,7 @@ exec_bind_message(StringInfo input_message)
...
@@ -1687,7 +1687,7 @@ exec_bind_message(StringInfo input_message)
* Process an "Execute" message for a portal
* Process an "Execute" message for a portal
*/
*/
static
void
static
void
exec_execute_message
(
const
char
*
portal_name
,
int64
max_rows
)
exec_execute_message
(
const
char
*
portal_name
,
long
max_rows
)
{
{
CommandDest
dest
;
CommandDest
dest
;
DestReceiver
*
receiver
;
DestReceiver
*
receiver
;
...
@@ -3308,13 +3308,13 @@ PostgresMain(int argc, char *argv[], const char *username)
...
@@ -3308,13 +3308,13 @@ PostgresMain(int argc, char *argv[], const char *username)
case
'E'
:
/* execute */
case
'E'
:
/* execute */
{
{
const
char
*
portal_name
;
const
char
*
portal_name
;
int
64
max_rows
;
int
max_rows
;
/* Set statement_timestamp() */
/* Set statement_timestamp() */
SetCurrentStatementStartTimestamp
();
SetCurrentStatementStartTimestamp
();
portal_name
=
pq_getmsgstring
(
&
input_message
);
portal_name
=
pq_getmsgstring
(
&
input_message
);
max_rows
=
pq_getmsgint
64
(
&
input_message
);
max_rows
=
pq_getmsgint
(
&
input_message
,
4
);
pq_getmsgend
(
&
input_message
);
pq_getmsgend
(
&
input_message
);
exec_execute_message
(
portal_name
,
max_rows
);
exec_execute_message
(
portal_name
,
max_rows
);
...
...
src/backend/tcop/pquery.c
浏览文件 @
0e20c485
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.1
09 2006/09/03 01:15:40
momjian Exp $
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.1
10 2006/09/03 03:19:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -38,18 +38,18 @@ static void ProcessQuery(Query *parsetree,
...
@@ -38,18 +38,18 @@ static void ProcessQuery(Query *parsetree,
DestReceiver
*
dest
,
DestReceiver
*
dest
,
char
*
completionTag
);
char
*
completionTag
);
static
void
FillPortalStore
(
Portal
portal
);
static
void
FillPortalStore
(
Portal
portal
);
static
uint
64
RunFromStore
(
Portal
portal
,
ScanDirection
direction
,
int64
count
,
static
uint
32
RunFromStore
(
Portal
portal
,
ScanDirection
direction
,
long
count
,
DestReceiver
*
dest
);
DestReceiver
*
dest
);
static
int64
PortalRunSelect
(
Portal
portal
,
bool
forward
,
int64
count
,
static
long
PortalRunSelect
(
Portal
portal
,
bool
forward
,
long
count
,
DestReceiver
*
dest
);
DestReceiver
*
dest
);
static
void
PortalRunUtility
(
Portal
portal
,
Query
*
query
,
static
void
PortalRunUtility
(
Portal
portal
,
Query
*
query
,
DestReceiver
*
dest
,
char
*
completionTag
);
DestReceiver
*
dest
,
char
*
completionTag
);
static
void
PortalRunMulti
(
Portal
portal
,
static
void
PortalRunMulti
(
Portal
portal
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
char
*
completionTag
);
char
*
completionTag
);
static
int64
DoPortalRunFetch
(
Portal
portal
,
static
long
DoPortalRunFetch
(
Portal
portal
,
FetchDirection
fdirection
,
FetchDirection
fdirection
,
int64
count
,
long
count
,
DestReceiver
*
dest
);
DestReceiver
*
dest
);
static
void
DoPortalRewind
(
Portal
portal
);
static
void
DoPortalRewind
(
Portal
portal
);
...
@@ -581,7 +581,7 @@ PortalSetResultFormat(Portal portal, int nFormats, int16 *formats)
...
@@ -581,7 +581,7 @@ PortalSetResultFormat(Portal portal, int nFormats, int16 *formats)
* suspended due to exhaustion of the count parameter.
* suspended due to exhaustion of the count parameter.
*/
*/
bool
bool
PortalRun
(
Portal
portal
,
int64
count
,
PortalRun
(
Portal
portal
,
long
count
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
char
*
completionTag
)
char
*
completionTag
)
{
{
...
@@ -773,15 +773,15 @@ PortalRun(Portal portal, int64 count,
...
@@ -773,15 +773,15 @@ PortalRun(Portal portal, int64 count,
*
*
* Returns number of rows processed (suitable for use in result tag)
* Returns number of rows processed (suitable for use in result tag)
*/
*/
static
int64
static
long
PortalRunSelect
(
Portal
portal
,
PortalRunSelect
(
Portal
portal
,
bool
forward
,
bool
forward
,
int64
count
,
long
count
,
DestReceiver
*
dest
)
DestReceiver
*
dest
)
{
{
QueryDesc
*
queryDesc
;
QueryDesc
*
queryDesc
;
ScanDirection
direction
;
ScanDirection
direction
;
uint
64
nprocessed
;
uint
32
nprocessed
;
/*
/*
* NB: queryDesc will be NULL if we are fetching from a held cursor or a
* NB: queryDesc will be NULL if we are fetching from a held cursor or a
...
@@ -834,12 +834,12 @@ PortalRunSelect(Portal portal,
...
@@ -834,12 +834,12 @@ PortalRunSelect(Portal portal,
if
(
!
ScanDirectionIsNoMovement
(
direction
))
if
(
!
ScanDirectionIsNoMovement
(
direction
))
{
{
int64
oldPos
;
long
oldPos
;
if
(
nprocessed
>
0
)
if
(
nprocessed
>
0
)
portal
->
atStart
=
false
;
/* OK to go backward now */
portal
->
atStart
=
false
;
/* OK to go backward now */
if
(
count
==
0
||
if
(
count
==
0
||
(
u
int64
)
nprocessed
<
(
uint64
)
count
)
(
u
nsigned
long
)
nprocessed
<
(
unsigned
long
)
count
)
portal
->
atEnd
=
true
;
/* we retrieved 'em all */
portal
->
atEnd
=
true
;
/* we retrieved 'em all */
oldPos
=
portal
->
portalPos
;
oldPos
=
portal
->
portalPos
;
portal
->
portalPos
+=
nprocessed
;
portal
->
portalPos
+=
nprocessed
;
...
@@ -882,7 +882,7 @@ PortalRunSelect(Portal portal,
...
@@ -882,7 +882,7 @@ PortalRunSelect(Portal portal,
portal
->
portalPos
++
;
/* adjust for endpoint case */
portal
->
portalPos
++
;
/* adjust for endpoint case */
}
}
if
(
count
==
0
||
if
(
count
==
0
||
(
u
int64
)
nprocessed
<
(
uint64
)
count
)
(
u
nsigned
long
)
nprocessed
<
(
unsigned
long
)
count
)
{
{
portal
->
atStart
=
true
;
/* we retrieved 'em all */
portal
->
atStart
=
true
;
/* we retrieved 'em all */
portal
->
portalPos
=
0
;
portal
->
portalPos
=
0
;
...
@@ -890,7 +890,7 @@ PortalRunSelect(Portal portal,
...
@@ -890,7 +890,7 @@ PortalRunSelect(Portal portal,
}
}
else
else
{
{
int64
oldPos
;
long
oldPos
;
oldPos
=
portal
->
portalPos
;
oldPos
=
portal
->
portalPos
;
portal
->
portalPos
-=
nprocessed
;
portal
->
portalPos
-=
nprocessed
;
...
@@ -958,11 +958,11 @@ FillPortalStore(Portal portal)
...
@@ -958,11 +958,11 @@ FillPortalStore(Portal portal)
* are run in the caller's memory context (since we have no estate). Watch
* are run in the caller's memory context (since we have no estate). Watch
* out for memory leaks.
* out for memory leaks.
*/
*/
static
uint
64
static
uint
32
RunFromStore
(
Portal
portal
,
ScanDirection
direction
,
int64
count
,
RunFromStore
(
Portal
portal
,
ScanDirection
direction
,
long
count
,
DestReceiver
*
dest
)
DestReceiver
*
dest
)
{
{
int64
current_tuple_count
=
0
;
long
current_tuple_count
=
0
;
TupleTableSlot
*
slot
;
TupleTableSlot
*
slot
;
slot
=
MakeSingleTupleTableSlot
(
portal
->
tupDesc
);
slot
=
MakeSingleTupleTableSlot
(
portal
->
tupDesc
);
...
@@ -1010,7 +1010,7 @@ RunFromStore(Portal portal, ScanDirection direction, int64 count,
...
@@ -1010,7 +1010,7 @@ RunFromStore(Portal portal, ScanDirection direction, int64 count,
ExecDropSingleTupleTableSlot
(
slot
);
ExecDropSingleTupleTableSlot
(
slot
);
return
(
uint
64
)
current_tuple_count
;
return
(
uint
32
)
current_tuple_count
;
}
}
/*
/*
...
@@ -1200,13 +1200,13 @@ PortalRunMulti(Portal portal,
...
@@ -1200,13 +1200,13 @@ PortalRunMulti(Portal portal,
*
*
* Returns number of rows processed (suitable for use in result tag)
* Returns number of rows processed (suitable for use in result tag)
*/
*/
int64
long
PortalRunFetch
(
Portal
portal
,
PortalRunFetch
(
Portal
portal
,
FetchDirection
fdirection
,
FetchDirection
fdirection
,
int64
count
,
long
count
,
DestReceiver
*
dest
)
DestReceiver
*
dest
)
{
{
int64
result
;
long
result
;
Portal
saveActivePortal
;
Portal
saveActivePortal
;
Snapshot
saveActiveSnapshot
;
Snapshot
saveActiveSnapshot
;
ResourceOwner
saveResourceOwner
;
ResourceOwner
saveResourceOwner
;
...
@@ -1307,10 +1307,10 @@ PortalRunFetch(Portal portal,
...
@@ -1307,10 +1307,10 @@ PortalRunFetch(Portal portal,
*
*
* Returns number of rows processed (suitable for use in result tag)
* Returns number of rows processed (suitable for use in result tag)
*/
*/
static
int64
static
long
DoPortalRunFetch
(
Portal
portal
,
DoPortalRunFetch
(
Portal
portal
,
FetchDirection
fdirection
,
FetchDirection
fdirection
,
int64
count
,
long
count
,
DestReceiver
*
dest
)
DestReceiver
*
dest
)
{
{
bool
forward
;
bool
forward
;
...
@@ -1347,7 +1347,7 @@ DoPortalRunFetch(Portal portal,
...
@@ -1347,7 +1347,7 @@ DoPortalRunFetch(Portal portal,
* we are. In any case, we arrange to fetch the target row
* we are. In any case, we arrange to fetch the target row
* going forwards.
* going forwards.
*/
*/
if
(
portal
->
posOverflow
||
portal
->
portalPos
==
FETCH_ALL
||
if
(
portal
->
posOverflow
||
portal
->
portalPos
==
LONG_MAX
||
count
-
1
<=
portal
->
portalPos
/
2
)
count
-
1
<=
portal
->
portalPos
/
2
)
{
{
DoPortalRewind
(
portal
);
DoPortalRewind
(
portal
);
...
@@ -1357,7 +1357,7 @@ DoPortalRunFetch(Portal portal,
...
@@ -1357,7 +1357,7 @@ DoPortalRunFetch(Portal portal,
}
}
else
else
{
{
int64
pos
=
portal
->
portalPos
;
long
pos
=
portal
->
portalPos
;
if
(
portal
->
atEnd
)
if
(
portal
->
atEnd
)
pos
++
;
/* need one extra fetch if off end */
pos
++
;
/* need one extra fetch if off end */
...
@@ -1469,7 +1469,7 @@ DoPortalRunFetch(Portal portal,
...
@@ -1469,7 +1469,7 @@ DoPortalRunFetch(Portal portal,
*/
*/
if
(
!
forward
&&
count
==
FETCH_ALL
&&
dest
->
mydest
==
DestNone
)
if
(
!
forward
&&
count
==
FETCH_ALL
&&
dest
->
mydest
==
DestNone
)
{
{
int64
result
=
portal
->
portalPos
;
long
result
=
portal
->
portalPos
;
if
(
result
>
0
&&
!
portal
->
atEnd
)
if
(
result
>
0
&&
!
portal
->
atEnd
)
result
--
;
result
--
;
...
...
src/include/executor/spi.h
浏览文件 @
0e20c485
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
*
*
* spi.h
* spi.h
*
*
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.5
6 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/include/executor/spi.h,v 1.5
7 2006/09/03 03:19:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -126,8 +126,8 @@ extern void SPI_freetuptable(SPITupleTable *tuptable);
...
@@ -126,8 +126,8 @@ extern void SPI_freetuptable(SPITupleTable *tuptable);
extern
Portal
SPI_cursor_open
(
const
char
*
name
,
void
*
plan
,
extern
Portal
SPI_cursor_open
(
const
char
*
name
,
void
*
plan
,
Datum
*
Values
,
const
char
*
Nulls
,
bool
read_only
);
Datum
*
Values
,
const
char
*
Nulls
,
bool
read_only
);
extern
Portal
SPI_cursor_find
(
const
char
*
name
);
extern
Portal
SPI_cursor_find
(
const
char
*
name
);
extern
void
SPI_cursor_fetch
(
Portal
portal
,
bool
forward
,
int64
count
);
extern
void
SPI_cursor_fetch
(
Portal
portal
,
bool
forward
,
long
count
);
extern
void
SPI_cursor_move
(
Portal
portal
,
bool
forward
,
int64
count
);
extern
void
SPI_cursor_move
(
Portal
portal
,
bool
forward
,
long
count
);
extern
void
SPI_cursor_close
(
Portal
portal
);
extern
void
SPI_cursor_close
(
Portal
portal
);
extern
void
AtEOXact_SPI
(
bool
isCommit
);
extern
void
AtEOXact_SPI
(
bool
isCommit
);
...
...
src/include/nodes/parsenodes.h
浏览文件 @
0e20c485
...
@@ -7,15 +7,13 @@
...
@@ -7,15 +7,13 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.32
8 2006/09/03 01:15:40
momjian Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.32
9 2006/09/03 03:19:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
#ifndef PARSENODES_H
#ifndef PARSENODES_H
#define PARSENODES_H
#define PARSENODES_H
#include "limits.h"
#include "nodes/primnodes.h"
#include "nodes/primnodes.h"
#include "nodes/value.h"
#include "nodes/value.h"
...
@@ -1441,18 +1439,13 @@ typedef enum FetchDirection
...
@@ -1441,18 +1439,13 @@ typedef enum FetchDirection
FETCH_RELATIVE
FETCH_RELATIVE
}
FetchDirection
;
}
FetchDirection
;
#ifdef HAVE_INT64
#define FETCH_ALL LLONG_MAX
#else
#define FETCH_ALL LONG_MAX
#define FETCH_ALL LONG_MAX
#endif
typedef
struct
FetchStmt
typedef
struct
FetchStmt
{
{
NodeTag
type
;
NodeTag
type
;
FetchDirection
direction
;
/* see above */
FetchDirection
direction
;
/* see above */
int64
howMany
;
/* number of rows, or position argument */
long
howMany
;
/* number of rows, or position argument */
char
*
portalname
;
/* name of portal (cursor) */
char
*
portalname
;
/* name of portal (cursor) */
bool
ismove
;
/* TRUE if MOVE */
bool
ismove
;
/* TRUE if MOVE */
}
FetchStmt
;
}
FetchStmt
;
...
...
src/include/tcop/pquery.h
浏览文件 @
0e20c485
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/tcop/pquery.h,v 1.3
8 2006/09/02 18:17:17
momjian Exp $
* $PostgreSQL: pgsql/src/include/tcop/pquery.h,v 1.3
9 2006/09/03 03:19:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -30,13 +30,13 @@ extern void PortalStart(Portal portal, ParamListInfo params,
...
@@ -30,13 +30,13 @@ extern void PortalStart(Portal portal, ParamListInfo params,
extern
void
PortalSetResultFormat
(
Portal
portal
,
int
nFormats
,
extern
void
PortalSetResultFormat
(
Portal
portal
,
int
nFormats
,
int16
*
formats
);
int16
*
formats
);
extern
bool
PortalRun
(
Portal
portal
,
int64
count
,
extern
bool
PortalRun
(
Portal
portal
,
long
count
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
DestReceiver
*
dest
,
DestReceiver
*
altdest
,
char
*
completionTag
);
char
*
completionTag
);
extern
int64
PortalRunFetch
(
Portal
portal
,
extern
long
PortalRunFetch
(
Portal
portal
,
FetchDirection
fdirection
,
FetchDirection
fdirection
,
int64
count
,
long
count
,
DestReceiver
*
dest
);
DestReceiver
*
dest
);
#endif
/* PQUERY_H */
#endif
/* PQUERY_H */
src/include/utils/portal.h
浏览文件 @
0e20c485
...
@@ -39,7 +39,7 @@
...
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.6
8 2006/09/02 18:17:18
momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/portal.h,v 1.6
9 2006/09/03 03:19:45
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -173,7 +173,7 @@ typedef struct PortalData
...
@@ -173,7 +173,7 @@ typedef struct PortalData
bool
atStart
;
bool
atStart
;
bool
atEnd
;
bool
atEnd
;
bool
posOverflow
;
bool
posOverflow
;
int64
portalPos
;
long
portalPos
;
/* Presentation data, primarily used by the pg_cursors system view */
/* Presentation data, primarily used by the pg_cursors system view */
TimestampTz
creation_time
;
/* time at which this portal was defined */
TimestampTz
creation_time
;
/* time at which this portal was defined */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录