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
4e911c84
Commit
4e911c84
authored
24 years ago
by
Tom Lane
Browse files
Options
Downloads
Patches
Plain Diff
Fix SPI example to reflect new-style calling convention for textout().
parent
b1065f8f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/spi.sgml
+44
-37
44 additions, 37 deletions
doc/src/sgml/spi.sgml
with
44 additions
and
37 deletions
doc/src/sgml/spi.sgml
+
44
−
37
View file @
4e911c84
...
@@ -2691,7 +2691,7 @@ are invisible to the query scan. For example, in query
...
@@ -2691,7 +2691,7 @@ are invisible to the query scan. For example, in query
INSERT INTO a SELECT * FROM a
INSERT INTO a SELECT * FROM a
tuples inserted are invisible for SELECT' scan. In effect, this
tuples inserted are invisible for SELECT'
s
scan. In effect, this
duplicates the database table within itself (subject to unique index
duplicates the database table within itself (subject to unique index
rules, of course) without recursing.
rules, of course) without recursing.
</Para>
</Para>
...
@@ -2708,7 +2708,7 @@ of Q) or after Q is done.
...
@@ -2708,7 +2708,7 @@ of Q) or after Q is done.
<Para>
<Para>
This example of SPI usage demonstrates the visibility rule.
This example of SPI usage demonstrates the visibility rule.
There are more complex examples in
in
src/test/regress/regress.c and
There are more complex examples in src/test/regress/regress.c and
in contrib/spi.
in contrib/spi.
</Para>
</Para>
...
@@ -2726,12 +2726,17 @@ int execq(text *sql, int cnt);
...
@@ -2726,12 +2726,17 @@ int execq(text *sql, int cnt);
int
int
execq(text *sql, int cnt)
execq(text *sql, int cnt)
{
{
char *query;
int ret;
int ret;
int proc = 0;
int proc;
/* Convert given TEXT object to a C string */
query = DatumGetCString(DirectFunctionCall1(textout,
PointerGetDatum(sql)));
SPI_connect();
SPI_connect();
ret = SPI_exec(
textout(sql)
, cnt);
ret = SPI_exec(
query
, cnt);
proc = SPI_processed;
proc = SPI_processed;
/*
/*
...
@@ -2743,11 +2748,11 @@ execq(text *sql, int cnt)
...
@@ -2743,11 +2748,11 @@ execq(text *sql, int cnt)
TupleDesc tupdesc = SPI_tuptable->tupdesc;
TupleDesc tupdesc = SPI_tuptable->tupdesc;
SPITupleTable *tuptable = SPI_tuptable;
SPITupleTable *tuptable = SPI_tuptable;
char buf[8192];
char buf[8192];
int i;
int i
,j
;
for (
ret
= 0;
ret
< proc;
ret
++)
for (
j
= 0;
j
< proc;
j
++)
{
{
HeapTuple tuple = tuptable->vals[
ret
];
HeapTuple tuple = tuptable->vals[
j
];
for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++)
for (i = 1, buf[0] = 0; i <= tupdesc->natts; i++)
sprintf(buf + strlen (buf), " %s%s",
sprintf(buf + strlen (buf), " %s%s",
...
@@ -2759,6 +2764,8 @@ execq(text *sql, int cnt)
...
@@ -2759,6 +2764,8 @@ execq(text *sql, int cnt)
SPI_finish();
SPI_finish();
pfree(query);
return (proc);
return (proc);
}
}
</ProgramListing>
</ProgramListing>
...
...
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