Search Postgresql Archives

PL/Perl: Is there a way to use spi_prepare/spi_exec_prepared with a list as second argument?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

I'd like to dynamically prepare and execute a certain statement in
PL/perl, i.e. I don't know at the time of calling my trigger function
how many arguments I need to pass for this queries and which types they
have. The command string is assembled dynamically, as is the list of
type-identifiers and arguments.

So what i'd like to do is something like this:

my $_sQueryString = 'INSERT INTO foo VALUES ($1,$2,$3)';
my @_lColumnTypes = =('int4','int4','text');
my $_pColumnInsert = spi_prepare($_sQueryString, @_lColumnTypes);  

... and a similar thing for the actual spi_exec_prepared().

So far my experiments were not successful, but that may be because I am
everything but a Perl monk :) The docs don't say anything about the
actual type of the second arguments, so I hoped that passing lists would
be somehow possible, thereby allowing for more dynamic declarations.

If this doesn't work, which would be the best way to proceed? I cannot
think of anything other than eval as a last resort.

Kind regards

   Markus


Computec Media AG
Sitz der Gesellschaft und Registergericht: Furth (HRB 8818)
Vorstandsmitglieder: Albrecht Hengstenberg (Vorsitzender) und Rainer Rosenbusch
Vorsitzender des Aufsichtsrates: Jurg Marquard 
Umsatzsteuer-Identifikationsnummer: DE 812 575 276



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux