pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Sending a libpq C function variables through function call
2+ messages / 2 participants
[nested] [flat]

* Sending a libpq C function variables through function call
@ 2003-12-02 21:54  Kris Kiger <kris@musicrebellion.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kris Kiger @ 2003-12-02 21:54 UTC (permalink / raw)
  To: pgsql-admin

Hi all,

    I've got a function in PG set up, the libpq C call goes like this:

    PERFORM funcName(''t1'', ''t2'', ''t3'', ''t4'', NEW.someInteger, 
NEW.someBoolean)

    funcName looks like this:

    create function funcName(text, text, text, text, int, boolean) 
returns int as '/var/lib/postgres/CfileName.so', 'CfunctionName' 
language 'C';

    the C function header accepts each of these arguments as 
CfunctionName(char* name1, char* name2, char* name3, char* name4, int 
variable1, bool variable2).  When I try to grab a value, say from name1, 
I get nothing.  So, for some reason parameters are not being passed. 
 I'm not sure if there is a good way to pass parameters through libpq, 
or will I have to use something like SPI to grab them?  Use of libpq is 
preferable, but not absolute.  I appreciate the input!

Kris




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Sending a libpq C function variables through function
@ 2003-12-03 06:11  Peter Eisentraut <peter_e@gmx.net>
  parent: Kris Kiger <kris@musicrebellion.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2003-12-03 06:11 UTC (permalink / raw)
  To: Kris Kiger <kris@musicrebellion.com>; +Cc: pgsql-admin

Kris Kiger writes:

>  I'm not sure if there is a good way to pass parameters through libpq,
> or will I have to use something like SPI to grab them?  Use of libpq is
> preferable, but not absolute.  I appreciate the input!

There is no choice: libpq connects to a remote database as a client; SPI
performs database actions from within a server-side function.

-- 
Peter Eisentraut   peter_e@gmx.net




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-12-03 06:11 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-12-02 21:54 Sending a libpq C function variables through function call Kris Kiger <kris@musicrebellion.com>
2003-12-03 06:11 ` Re: Sending a libpq C function variables through function Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox