From: | Harald Fuchs <use_reply_to(at)protecting(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: plPerl subroutine |
Date: | 2005-03-16 15:37:47 |
Message-ID: | pud5tz61pw.fsf@srv.protecting.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
In article <1904E3EB39448246A7ECB76DF34A70B00143B48A(at)TOCOMEXC03>,
"FERREIRA William (COFRAMI)" <william(dot)ferreira(at)airbus(dot)com> writes:
> CREATE OR REPLACE FUNCTION adoc.CREATE_XML_FILE(docId int4, eleId int4, evo
> int4, fileName text, fileRelativeDir text)
> RETURNS int4 AS
> $BODY$
> my $theClob='';
>
> my $params = 'select
> adoc.GET_XML_FRAG('.$_[0].','.$_[1].','.$_[2].',\''.$theClob.'\','.0;
> $params = $params.')';
>
> $theClob = spi_exec_query($params);
> elog NOTICE, $theClob;
>
> return 4;
> $BODY$
> LANGUAGE 'plperl' VOLATILE;
>
> CREATE OR REPLACE FUNCTION adoc.GET_XML_FRAG(docId int4, eleId int4, evo int4,
> clob text, indx int4)
> RETURNS text AS
> $BODY$
> my $t_clob = $_[3].'totototototototototot';
>
> return $t_clob;
> $BODY$
> LANGUAGE 'plperl' VOLATILE;
> but the CREATE_XML_FILE doesn't display 'totototototototototot' but
> HASH(0xf03fa4)....
... and rightly so. As documented in The Fine Manual, spi_exec_query
returns a hash reference. Probably you want something like
my $rv = spi_exec_query($params);
$theClob = $rv-.{rows}[0]->{get_xml_frag};
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-03-16 15:44:22 | Re: New user: Windows, Postgresql, Python |
Previous Message | Tom Lane | 2005-03-16 15:33:57 | Re: plPerl subroutine |