aboutsummaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plperl/plperl.c55
-rw-r--r--src/pl/plpgsql/src/pl_exec.c25
-rw-r--r--src/pl/tcl/pltcl.c55
3 files changed, 60 insertions, 75 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index ed8d1672db9..e51c950ef67 100644
--- a/src/pl/plperl/plperl.c
+++ b/src/pl/plperl/plperl.c
@@ -33,7 +33,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.9 2000/05/29 21:25:06 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.10 2000/05/30 04:24:57 tgl Exp $
*
**********************************************************************/
@@ -427,10 +427,10 @@ plperl_call_perl_func(plperl_proc_desc * desc, FunctionCallInfo fcinfo)
{
char *tmp;
- tmp = (*fmgr_faddr(&(desc->arg_out_func[i])))
- (fcinfo->arg[i],
- desc->arg_out_elem[i],
- desc->arg_out_len[i]);
+ tmp = DatumGetCString(FunctionCall3(&(desc->arg_out_func[i]),
+ fcinfo->arg[i],
+ ObjectIdGetDatum(desc->arg_out_elem[i]),
+ Int32GetDatum(desc->arg_out_len[i])));
XPUSHs(sv_2mortal(newSVpv(tmp, 0)));
pfree(tmp);
}
@@ -1081,13 +1081,11 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
************************************************************/
modnulls[attnum - 1] = ' ';
fmgr_info(typinput, &finfo);
- modvalues[attnum - 1] = (Datum) (*fmgr_faddr(&finfo))
- (ret_values[i++],
- typelem,
- (!VARLENA_FIXED_SIZE(tupdesc->attrs[attnum - 1]))
- ? tupdesc->attrs[attnum - 1]->attlen
- : tupdesc->attrs[attnum - 1]->atttypmod
- );
+ modvalues[attnum - 1] =
+ FunctionCall3(&finfo,
+ CStringGetDatum(ret_values[i++]),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
}
@@ -1825,10 +1823,11 @@ plperl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
************************************************************/
for (j = 0; j < callnargs; j++)
{
- qdesc->argvalues[j] = (Datum) (*fmgr_faddr(&qdesc->arginfuncs[j]))
- (callargs[j],
- qdesc->argtypelems[j],
- qdesc->arglen[j]);
+ qdesc->argvalues[j] =
+ FunctionCall3(&qdesc->arginfuncs[j],
+ CStringGetDatum(callargs[j]),
+ ObjectIdGetDatum(qdesc->argtypelems[j]),
+ Int32GetDatum(qdesc->arglen[j]));
}
/************************************************************
@@ -2103,14 +2102,10 @@ plperl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
pfree(outputstr);
}
@@ -2176,14 +2171,10 @@ plperl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc)
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
sv_catpvf(output, "'%s' => '%s',", attname, outputstr);
pfree(outputstr);
}
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index e587aecba60..77370801c9c 100644
--- a/src/pl/plpgsql/src/pl_exec.c
+++ b/src/pl/plpgsql/src/pl_exec.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.22 2000/05/28 17:56:28 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.23 2000/05/30 04:24:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -1566,10 +1566,10 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output))
- (var->value,
- typeStruct->typelem,
- var->datatype->atttypmod);
+ extval = DatumGetCString(FunctionCall3(&finfo_output,
+ var->value,
+ ObjectIdGetDatum(typeStruct->typelem),
+ Int32GetDatum(var->datatype->atttypmod)));
}
plpgsql_dstring_append(&ds, extval);
break;
@@ -2414,13 +2414,14 @@ exec_cast_value(Datum value, Oid valtype,
typeStruct = (Form_pg_type) GETSTRUCT(typetup);
fmgr_info(typeStruct->typoutput, &finfo_output);
- extval = (char *) (*fmgr_faddr(&finfo_output))
- (value,
- typeStruct->typelem,
- -1);
- value = (Datum) (*fmgr_faddr(reqinput)) (extval,
- reqtypelem,
- reqtypmod);
+ extval = DatumGetCString(FunctionCall3(&finfo_output,
+ value,
+ ObjectIdGetDatum(typeStruct->typelem),
+ Int32GetDatum(-1)));
+ value = FunctionCall3(reqinput,
+ CStringGetDatum(extval),
+ ObjectIdGetDatum(reqtypelem),
+ Int32GetDatum(reqtypmod));
pfree(extval);
}
}
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 201bbdf092d..b2bceb92184 100644
--- a/src/pl/tcl/pltcl.c
+++ b/src/pl/tcl/pltcl.c
@@ -31,7 +31,7 @@
* ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.24 2000/05/29 01:59:15 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.25 2000/05/30 04:24:59 tgl Exp $
*
**********************************************************************/
@@ -655,10 +655,10 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
{
char *tmp;
- tmp = (*fmgr_faddr(&(prodesc->arg_out_func[i])))
- (fcinfo->arg[i],
- prodesc->arg_out_elem[i],
- prodesc->arg_out_len[i]);
+ tmp = DatumGetCString(FunctionCall3(&prodesc->arg_out_func[i],
+ fcinfo->arg[i],
+ ObjectIdGetDatum(prodesc->arg_out_elem[i]),
+ Int32GetDatum(prodesc->arg_out_len[i])));
Tcl_DStringAppendElement(&tcl_cmd, tmp);
pfree(tmp);
}
@@ -696,7 +696,7 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
/************************************************************
* Convert the result value from the safe interpreter
* into its PostgreSQL data format and return it.
- * Again, the call to fmgr() could fire an elog and we
+ * Again, the function call could fire an elog and we
* have to count for the current interpreter level we are
* on. The save_restart from above is still good.
************************************************************/
@@ -1129,13 +1129,13 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
************************************************************/
modnulls[attnum - 1] = ' ';
fmgr_info(typinput, &finfo);
- modvalues[attnum - 1] = (Datum) (*fmgr_faddr(&finfo))
- (ret_values[i++],
- typelem,
- tupdesc->attrs[attnum - 1]->atttypmod);
+ modvalues[attnum - 1] =
+ FunctionCall3(&finfo,
+ CStringGetDatum(ret_values[i++]),
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[attnum-1]->atttypmod));
}
-
rettup = SPI_modifytuple(trigdata->tg_relation, rettup, tupdesc->natts,
modattrs, modvalues, modnulls);
@@ -1870,10 +1870,11 @@ pltcl_SPI_execp(ClientData cdata, Tcl_Interp *interp,
************************************************************/
for (j = 0; j < callnargs; j++)
{
- qdesc->argvalues[j] = (Datum) (*fmgr_faddr(&qdesc->arginfuncs[j]))
- (callargs[j],
- qdesc->argtypelems[j],
- qdesc->arglen[j]);
+ qdesc->argvalues[j] =
+ FunctionCall3(&qdesc->arginfuncs[j],
+ CStringGetDatum(callargs[j]),
+ ObjectIdGetDatum(qdesc->argtypelems[j]),
+ Int32GetDatum(qdesc->arglen[j]));
}
/************************************************************
@@ -2148,14 +2149,10 @@ pltcl_set_tuple_values(Tcl_Interp *interp, char *arrayname,
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_SetVar2(interp, *arrptr, *nameptr, outputstr, 0);
pfree(outputstr);
}
@@ -2221,14 +2218,10 @@ pltcl_build_tuple_argument(HeapTuple tuple, TupleDesc tupdesc,
************************************************************/
if (!isnull && OidIsValid(typoutput))
{
- FmgrInfo finfo;
-
- fmgr_info(typoutput, &finfo);
-
- outputstr = (*fmgr_faddr(&finfo))
- (attr, typelem,
- tupdesc->attrs[i]->attlen);
-
+ outputstr = DatumGetCString(OidFunctionCall3(typoutput,
+ attr,
+ ObjectIdGetDatum(typelem),
+ Int32GetDatum(tupdesc->attrs[i]->attlen)));
Tcl_DStringAppendElement(retval, attname);
Tcl_DStringAppendElement(retval, outputstr);
pfree(outputstr);