File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change 11
11
<para>
12
12
All calls to functions that are written in a language other than
13
13
the current <quote>version 1</quote> interface for compiled
14
- languages (this includes functions in user-defined procedural languages,
15
- functions written in SQL, and functions using the version 0 compiled
16
- language interface) go through a <firstterm>call handler</firstterm>
14
+ languages (this includes functions in user-defined procedural languages
15
+ and functions written in SQL) go through a <firstterm>call handler</firstterm>
17
16
function for the specific language. It is the responsibility of
18
17
the call handler to execute the function in a meaningful way, such
19
18
as by interpreting the supplied source text. This chapter outlines
Original file line number Diff line number Diff line change @@ -4355,17 +4355,19 @@ INSERT INTO a SELECT * FROM a;
4355
4355
PG_MODULE_MAGIC;
4356
4356
#endif
4357
4357
4358
- int64 execq(text *sql, int cnt );
4358
+ PG_FUNCTION_INFO_V1(execq );
4359
4359
4360
- int64
4361
- execq(text *sql, int cnt )
4360
+ Datum
4361
+ execq(PG_FUNCTION_ARGS )
4362
4362
{
4363
4363
char *command;
4364
+ int cnt;
4364
4365
int ret;
4365
4366
uint64 proc;
4366
4367
4367
4368
/* Convert given text object to a C string */
4368
- command = text_to_cstring(sql);
4369
+ command = text_to_cstring(PG_GETARG_TEXT_PP(1));
4370
+ cnt = PG_GETARG_INT32(2);
4369
4371
4370
4372
SPI_connect();
4371
4373
@@ -4398,16 +4400,10 @@ execq(text *sql, int cnt)
4398
4400
SPI_finish();
4399
4401
pfree(command);
4400
4402
4401
- return (proc);
4403
+ PG_RETURN_INT64 (proc);
4402
4404
}
4403
4405
</programlisting>
4404
4406
4405
- <para>
4406
- (This function uses call convention version 0, to make the example
4407
- easier to understand. In real applications you should use the new
4408
- version 1 interface.)
4409
- </para>
4410
-
4411
4407
<para>
4412
4408
This is how you declare the function after having compiled it into
4413
4409
a shared library (details are in <xref linkend="dfunc">.):
You can’t perform that action at this time.
0 commit comments