summaryrefslogtreecommitdiff
path: root/src/pl
diff options
context:
space:
mode:
authorTom Lane2000-07-05 23:12:09 +0000
committerTom Lane2000-07-05 23:12:09 +0000
commit40f64064ff56c3118d156ba83df72b1779415a8a (patch)
treed318bf6c8e6e85a15d2cd6e997ee02bf233dd181 /src/pl
parent282713a836d5dfe3dcefeaa6a6cedf5f000bdb09 (diff)
Update textin() and textout() to new fmgr style. This is just phase
one of updating the whole text datatype, but there are so dang many calls of these two routines that it seems worth a separate commit.
Diffstat (limited to 'src/pl')
-rw-r--r--src/pl/plperl/plperl.c9
-rw-r--r--src/pl/plpgsql/src/pl_comp.c5
-rw-r--r--src/pl/plpgsql/src/pl_exec.c28
-rw-r--r--src/pl/tcl/pltcl.c8
4 files changed, 28 insertions, 22 deletions
diff --git a/src/pl/plperl/plperl.c b/src/pl/plperl/plperl.c
index 66ae44373d0..687612a64c1 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.11 2000/06/05 07:29:11 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plperl/plperl.c,v 1.12 2000/07/05 23:11:55 tgl Exp $
*
**********************************************************************/
@@ -594,8 +594,8 @@ plperl_func_handler(PG_FUNCTION_ARGS)
* through the reference.
*
************************************************************/
- proc_source = textout(&(procStruct->prosrc));
-
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
/************************************************************
* Create the procedure in the interpreter
@@ -789,7 +789,8 @@ plperl_trigger_handler(PG_FUNCTION_ARGS)
"}\n"
"unset i v\n\n", -1);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,
diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c
index c03d9398d13..f18caa84644 100644
--- a/src/pl/plpgsql/src/pl_comp.c
+++ b/src/pl/plpgsql/src/pl_comp.c
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.20 2000/05/11 04:00:00 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.21 2000/07/05 23:11:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -142,7 +142,8 @@ plpgsql_compile(Oid fn_oid, int functype)
* ----------
*/
procStruct = (Form_pg_proc) GETSTRUCT(procTup);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
plpgsql_setinput(proc_source, functype);
plpgsql_error_funcname = nameout(&(procStruct->proname));
plpgsql_error_lineno = 0;
diff --git a/src/pl/plpgsql/src/pl_exec.c b/src/pl/plpgsql/src/pl_exec.c
index 77370801c9c..5b8c6d773f4 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.23 2000/05/30 04:24:58 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.24 2000/07/05 23:11:58 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -606,7 +606,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
rec_new->tupdesc = trigdata->tg_relation->rd_att;
rec_old->tup = NULL;
rec_old->tupdesc = NULL;
- var->value = (Datum) textin("INSERT");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("INSERT"));
}
else if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
{
@@ -614,7 +614,7 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
rec_new->tupdesc = trigdata->tg_relation->rd_att;
rec_old->tup = trigdata->tg_trigtuple;
rec_old->tupdesc = trigdata->tg_relation->rd_att;
- var->value = (Datum) textin("UPDATE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UPDATE"));
}
else if (TRIGGER_FIRED_BY_DELETE(trigdata->tg_event))
{
@@ -622,13 +622,13 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
rec_new->tupdesc = NULL;
rec_old->tup = trigdata->tg_trigtuple;
rec_old->tupdesc = trigdata->tg_relation->rd_att;
- var->value = (Datum) textin("DELETE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("DELETE"));
}
else
{
rec_new->tup = NULL;
rec_new->tupdesc = NULL;
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
}
/* ----------
@@ -642,20 +642,20 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
var = (PLpgSQL_var *) (estate.datums[func->tg_when_varno]);
var->isnull = false;
if (TRIGGER_FIRED_BEFORE(trigdata->tg_event))
- var->value = (Datum) textin("BEFORE");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("BEFORE"));
else if (TRIGGER_FIRED_AFTER(trigdata->tg_event))
- var->value = (Datum) textin("AFTER");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("AFTER"));
else
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
var = (PLpgSQL_var *) (estate.datums[func->tg_level_varno]);
var->isnull = false;
if (TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))
- var->value = (Datum) textin("ROW");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("ROW"));
else if (TRIGGER_FIRED_FOR_STATEMENT(trigdata->tg_event))
- var->value = (Datum) textin("STATEMENT");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("STATEMENT"));
else
- var->value = (Datum) textin("UNKNOWN");
+ var->value = DirectFunctionCall1(textin, CStringGetDatum("UNKNOWN"));
var = (PLpgSQL_var *) (estate.datums[func->tg_relid_varno]);
var->isnull = false;
@@ -682,7 +682,8 @@ plpgsql_exec_trigger(PLpgSQL_function * func,
{
estate.trig_argv = palloc(sizeof(Datum) * estate.trig_nargs);
for (i = 0; i < trigdata->tg_trigger->tgnargs; i++)
- estate.trig_argv[i] = (Datum) textin(trigdata->tg_trigger->tgargs[i]);
+ estate.trig_argv[i] = DirectFunctionCall1(textin,
+ CStringGetDatum(trigdata->tg_trigger->tgargs[i]));
}
/* ----------
@@ -1611,7 +1612,8 @@ exec_stmt_raise(PLpgSQL_execstate * estate, PLpgSQL_stmt_raise * stmt)
if (value < 0 || value >= estate->trig_nargs)
extval = "<OUT_OF_RANGE>";
else
- extval = textout((text *) (estate->trig_argv[value]));
+ extval = DatumGetCString(DirectFunctionCall1(textout,
+ estate->trig_argv[value]));
}
plpgsql_dstring_append(&ds, extval);
}
diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c
index 37b413da2df..6bdeec9be81 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.26 2000/06/05 07:29:13 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.27 2000/07/05 23:12:03 tgl Exp $
*
**********************************************************************/
@@ -561,7 +561,8 @@ pltcl_func_handler(PG_FUNCTION_ARGS)
sprintf(buf, "array set %d $__PLTcl_Tup_%d\n", i + 1, i + 1);
Tcl_DStringAppend(&proc_internal_body, buf, -1);
}
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,
@@ -836,7 +837,8 @@ pltcl_trigger_handler(PG_FUNCTION_ARGS)
"}\n"
"unset i v\n\n", -1);
- proc_source = textout(&(procStruct->prosrc));
+ proc_source = DatumGetCString(DirectFunctionCall1(textout,
+ PointerGetDatum(&procStruct->prosrc)));
Tcl_DStringAppend(&proc_internal_body, proc_source, -1);
pfree(proc_source);
Tcl_DStringAppendElement(&proc_internal_def,