Re: Calling a PostgreSQL function via DBI




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


$result = $dbh->prepare ( "SELECT neues_suchprofil ( $cookieValue::numeric,
'$suchprofil_name::text' ) " ) or die "Vorbereitung nicht durchfuehrbar!\n";

You are mixing up your syntaxes: double-colons in Perl are not the same as double
colons in Postgres. Perl is treating $cookieValue::numeric as the variable
"numeric" in the package "cookieValue". What you need to do is either:

SELECT neues_suchprofil ( ${cookieValue}::numeric

or use placeholders:

SELECT neues_suchprofil ( ?::numeric

You might also want to make a single variable to pass to prepare, as it can
help in debugging:

my $COM = "SELECT neues_suchprofil ( $cookieValue::numeric, '$suchprofil_name::text' )";
$result = $dbh->prepare ($COM)
or die "Vorbereitung nicht durchfuehrbar! ($COM)\n";

Not only does it make the code easier to read, but your error message would have
shown you that those variables were not getting set as you thought they were.

- --
Greg Sabino Mullane greg@xxxxxxxxxxxx
PGP Key: 0x14964AC8 200602220909
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iD8DBQFD/HFEvJuQZxSWSsgRAkG7AKDoqzOxjg6OSpcDp/x9DYUwMVCNMgCfRwsD
flkczHWCUXi5If3sWW8Ee3I=
=LIPT
-----END PGP SIGNATURE-----


.



Relevant Pages

  • Re: Die Milchmaedchenrechnung / Sozialsysteme
    ... Riecht nach Postgres, ... GnuPG und einem Dutzend Seiten Perl. ...
    (de.soc.wirtschaft)
  • Re: Learning Perl with shells operations
    ... That won't work very well if you have names with embeded spaces. ... option would be to assign the back-quote results to an array. ... The barewords 'su' and 'postgres' are being interpreted by perl as the method ...
    (perl.beginners)
  • Re: How to write multiuser application?
    ... > How can i write application the concurrently access the database ... Postgres, like all modern database management systems, allows ... Please post general perl questions to comp.lang.perl.misc in the ...
    (comp.lang.perl)
  • Re: I want to scanf, dammit!
    ... I can't find any mention of Inline in my Perl docs... ... The double colons indicate it is a perl module. ... If you download the perl sources, you will get a bunch of core modules ...
    (comp.lang.perl.misc)