File tree 2 files changed +9
-14
lines changed
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 @@ -4583,17 +4583,19 @@ INSERT INTO a SELECT * FROM a;
4583
4583
4584
4584
PG_MODULE_MAGIC;
4585
4585
4586
- int64 execq(text *sql, int cnt );
4586
+ PG_FUNCTION_INFO_V1(execq );
4587
4587
4588
- int64
4589
- execq(text *sql, int cnt )
4588
+ Datum
4589
+ execq(PG_FUNCTION_ARGS )
4590
4590
{
4591
4591
char *command;
4592
+ int cnt;
4592
4593
int ret;
4593
4594
uint64 proc;
4594
4595
4595
4596
/* Convert given text object to a C string */
4596
- command = text_to_cstring(sql);
4597
+ command = text_to_cstring(PG_GETARG_TEXT_PP(1));
4598
+ cnt = PG_GETARG_INT32(2);
4597
4599
4598
4600
SPI_connect();
4599
4601
@@ -4626,16 +4628,10 @@ execq(text *sql, int cnt)
4626
4628
SPI_finish();
4627
4629
pfree(command);
4628
4630
4629
- return proc;
4631
+ PG_RETURN_INT64( proc) ;
4630
4632
}
4631
4633
</programlisting>
4632
4634
4633
- <para>
4634
- (This function uses call convention version 0, to make the example
4635
- easier to understand. In real applications you should use the new
4636
- version 1 interface.)
4637
- </para>
4638
-
4639
4635
<para>
4640
4636
This is how you declare the function after having compiled it into
4641
4637
a shared library (details are in <xref linkend="dfunc"/>.):
You can’t perform that action at this time.
0 commit comments