Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
fd3ad7d7
Commit
fd3ad7d7
authored
27 years ago
by
Vadim B. Mikheev
Browse files
Options
Downloads
Patches
Plain Diff
Allow to call utility funcs without SPI_connect.
parent
7f97e05b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/executor/spi.c
+5
-47
5 additions, 47 deletions
src/backend/executor/spi.c
with
5 additions
and
47 deletions
src/backend/executor/spi.c
+
5
−
47
View file @
fd3ad7d7
...
@@ -48,7 +48,7 @@ static void _SPI_fetch(FetchStmt * stmt);
...
@@ -48,7 +48,7 @@ static void _SPI_fetch(FetchStmt * stmt);
#endif
#endif
static
int
static
int
_SPI_execute_plan
(
_SPI_plan
*
plan
,
_SPI_execute_plan
(
_SPI_plan
*
plan
,
char
*
*
Values
,
char
*
Nulls
,
int
tcount
);
Datum
*
Values
,
char
*
Nulls
,
int
tcount
);
#define _SPI_CPLAN_CURCXT 0
#define _SPI_CPLAN_CURCXT 0
#define _SPI_CPLAN_PROCXT 1
#define _SPI_CPLAN_PROCXT 1
...
@@ -199,7 +199,7 @@ SPI_exec(char *src, int tcount)
...
@@ -199,7 +199,7 @@ SPI_exec(char *src, int tcount)
}
}
int
int
SPI_execp
(
void
*
plan
,
char
*
*
Values
,
char
*
Nulls
,
int
tcount
)
SPI_execp
(
void
*
plan
,
Datum
*
Values
,
char
*
Nulls
,
int
tcount
)
{
{
int
res
;
int
res
;
...
@@ -282,10 +282,7 @@ int
...
@@ -282,10 +282,7 @@ int
SPI_fnumber
(
TupleDesc
tupdesc
,
char
*
fname
)
SPI_fnumber
(
TupleDesc
tupdesc
,
char
*
fname
)
{
{
int
res
;
int
res
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
return
(
SPI_ERROR_UNCONNECTED
);
for
(
res
=
0
;
res
<
tupdesc
->
natts
;
res
++
)
for
(
res
=
0
;
res
<
tupdesc
->
natts
;
res
++
)
{
{
if
(
strcasecmp
(
tupdesc
->
attrs
[
res
]
->
attname
.
data
,
fname
)
==
0
)
if
(
strcasecmp
(
tupdesc
->
attrs
[
res
]
->
attname
.
data
,
fname
)
==
0
)
...
@@ -300,12 +297,6 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
...
@@ -300,12 +297,6 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
{
{
SPI_result
=
0
;
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
NULL
);
}
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
{
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
...
@@ -313,7 +304,6 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
...
@@ -313,7 +304,6 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
}
}
return
(
nameout
(
&
(
tupdesc
->
attrs
[
fnumber
-
1
]
->
attname
)));
return
(
nameout
(
&
(
tupdesc
->
attrs
[
fnumber
-
1
]
->
attname
)));
}
}
char
*
char
*
...
@@ -324,12 +314,6 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
...
@@ -324,12 +314,6 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
Oid
foutoid
;
Oid
foutoid
;
SPI_result
=
0
;
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
NULL
);
}
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
return
(
NULL
);
return
(
NULL
);
...
@@ -353,12 +337,6 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
...
@@ -353,12 +337,6 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
*
isnull
=
true
;
*
isnull
=
true
;
SPI_result
=
0
;
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
NULL
);
}
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
if
(
tuple
->
t_natts
<
fnumber
||
fnumber
<=
0
)
return
(
NULL
);
return
(
NULL
);
...
@@ -373,12 +351,6 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
...
@@ -373,12 +351,6 @@ SPI_gettype(TupleDesc tupdesc, int fnumber)
HeapTuple
typeTuple
;
HeapTuple
typeTuple
;
SPI_result
=
0
;
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
NULL
);
}
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
{
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
...
@@ -403,12 +375,6 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
...
@@ -403,12 +375,6 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
{
{
SPI_result
=
0
;
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
InvalidOid
);
}
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
if
(
tupdesc
->
natts
<
fnumber
||
fnumber
<=
0
)
{
{
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
SPI_result
=
SPI_ERROR_NOATTRIBUTE
;
...
@@ -421,14 +387,6 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
...
@@ -421,14 +387,6 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
char
*
char
*
SPI_getrelname
(
Relation
rel
)
SPI_getrelname
(
Relation
rel
)
{
{
SPI_result
=
0
;
if
(
_SPI_curid
+
1
!=
_SPI_connected
)
{
SPI_result
=
SPI_ERROR_UNCONNECTED
;
return
(
NULL
);
}
return
(
pstrdup
(
rel
->
rd_rel
->
relname
.
data
));
return
(
pstrdup
(
rel
->
rd_rel
->
relname
.
data
));
}
}
...
@@ -581,7 +539,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
...
@@ -581,7 +539,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
}
}
static
int
static
int
_SPI_execute_plan
(
_SPI_plan
*
plan
,
char
*
*
Values
,
char
*
Nulls
,
int
tcount
)
_SPI_execute_plan
(
_SPI_plan
*
plan
,
Datum
*
Values
,
char
*
Nulls
,
int
tcount
)
{
{
QueryTreeList
*
queryTree_list
=
plan
->
qtlist
;
QueryTreeList
*
queryTree_list
=
plan
->
qtlist
;
List
*
planTree_list
=
plan
->
ptlist
;
List
*
planTree_list
=
plan
->
ptlist
;
...
@@ -634,7 +592,7 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
...
@@ -634,7 +592,7 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
paramLI
->
kind
=
PARAM_NUM
;
paramLI
->
kind
=
PARAM_NUM
;
paramLI
->
id
=
k
+
1
;
paramLI
->
id
=
k
+
1
;
paramLI
->
isnull
=
(
Nulls
!=
NULL
&&
Nulls
[
k
]
!=
'n'
);
paramLI
->
isnull
=
(
Nulls
!=
NULL
&&
Nulls
[
k
]
!=
'n'
);
paramLI
->
value
=
(
Datum
)
Values
[
k
];
paramLI
->
value
=
Values
[
k
];
}
}
paramLI
->
kind
=
PARAM_INVALID
;
paramLI
->
kind
=
PARAM_INVALID
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment