/**********************************************************************
* plperl.c - perl as a procedural language for PostgreSQL
*
- * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.157 2009/12/31 19:41:37 tgl Exp $
+ * $PostgreSQL: pgsql/src/pl/plperl/plperl.c,v 1.158 2010/01/04 20:29:59 adunstan Exp $
*
**********************************************************************/
errmsg("Perl hash contains nonexistent column \"%s\"",
key)));
if (SvOK(val))
- values[attn - 1] = SvPV(val, PL_na);
+ {
+ char * aval;
+
+ aval = SvPV_nolen(val);
+ pg_verifymbstr(aval, strlen(aval), false);
+ values[attn - 1] = aval;
+ }
}
hv_iterinit(perlhash);
atttypmod = tupdesc->attrs[attn - 1]->atttypmod;
if (SvOK(val))
{
+ char * aval;
+
+ aval = SvPV_nolen(val);
+ pg_verifymbstr(aval,strlen(aval), false);
modvalues[slotsused] = InputFunctionCall(&finfo,
- SvPV(val, PL_na),
+ aval,
typioparam,
atttypmod);
modnulls[slotsused] = ' ';
LEAVE;
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("%s", strip_trailing_ws(SvPV(ERRSV, PL_na)))));
+ errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV)))));
}
/*
LEAVE;
/* XXX need to find a way to assign an errcode here */
ereport(ERROR,
- (errmsg("%s", strip_trailing_ws(SvPV(ERRSV, PL_na)))));
+ (errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV)))));
}
retval = newSVsv(POPs);
LEAVE;
/* XXX need to find a way to assign an errcode here */
ereport(ERROR,
- (errmsg("%s", strip_trailing_ws(SvPV(ERRSV, PL_na)))));
+ (errmsg("%s", strip_trailing_ws(SvPV_nolen(ERRSV)))));
}
retval = newSVsv(POPs);
perlret = array_ret;
}
- val = SvPV(perlret, PL_na);
-
+ val = SvPV_nolen(perlret);
+ pg_verifymbstr(val, strlen(val), false);
retval = InputFunctionCall(&prodesc->result_in_func, val,
prodesc->result_typioparam, -1);
}
HeapTuple trv;
char *tmp;
- tmp = SvPV(perlret, PL_na);
+ tmp = SvPV_nolen(perlret);
if (pg_strcasecmp(tmp, "SKIP") == 0)
trv = NULL;
sv = plperl_convert_to_pg_array(sv);
}
- val = SvPV(sv, PL_na);
-
+ val = SvPV_nolen(sv);
+ pg_verifymbstr(val, strlen(val), false);
ret = InputFunctionCall(&prodesc->result_in_func, val,
prodesc->result_typioparam, -1);
isNull = false;
typIOParam;
int32 typmod;
- parseTypeString(SvPV(argv[i], PL_na), &typId, &typmod);
+ parseTypeString(SvPV_nolen(argv[i]), &typId, &typmod);
getTypeInputInfo(typId, &typInput, &typIOParam);
{
if (SvOK(argv[i]))
{
+ char *val;
+
+ val = SvPV_nolen(argv[i]);
+ pg_verifymbstr(val, strlen(val), false);
argvalues[i] = InputFunctionCall(&qdesc->arginfuncs[i],
- SvPV(argv[i], PL_na),
+ val,
qdesc->argtypioparams[i],
-1);
nulls[i] = ' ';
{
if (SvOK(argv[i]))
{
+ char *val;
+
+ val = SvPV_nolen(argv[i]);
+ pg_verifymbstr(val, strlen(val), false);
argvalues[i] = InputFunctionCall(&qdesc->arginfuncs[i],
- SvPV(argv[i], PL_na),
+ val,
qdesc->argtypioparams[i],
-1);
nulls[i] = ' ';