How to use PQfn() in libpq library?

Started by Bruce YUANalmost 17 years ago5 messagesgeneral
Jump to latest
#1Bruce YUAN
suanic@gmail.com

Hi All,

How to use PQfn() in libpq library?

#include <libpq-fe.h>
PGresult *PQfn(PGconn* conn,
int fnid,
int *result_buf,
int *result_len,
int result_is_int,
const PQArgBlock *args,
int nargs);
Who can share a detailed example source code? Which server functions can be
executed from client?
Many thanks!

Bruce

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce YUAN (#1)
Re: How to use PQfn() in libpq library?

Bruce YUAN <suanic@gmail.com> writes:

How to use PQfn() in libpq library?

Look into src/interfaces/libpq/fe-lobj.c for several examples.
However, please note the comment in the documentation:

This interface is somewhat obsolete, as one can achieve similar
performance and greater functionality by setting up a prepared
statement to define the function call. Then, executing the statement
with binary transmission of parameters and results substitutes for a
fast-path function call.

Which server functions can be
executed from client?

Anything you could call normally can be called this way too.

regards, tom lane

#3Bruce YUAN
suanic@gmail.com
In reply to: Tom Lane (#2)
Re: How to use PQfn() in libpq library?

Hi Tom,

Which interface will replace this? And where can get it's reference?
Best regards,
Bruce
2009/6/19 Tom Lane <tgl@sss.pgh.pa.us>

Show quoted text

Bruce YUAN <suanic@gmail.com> writes:

How to use PQfn() in libpq library?

Look into src/interfaces/libpq/fe-lobj.c for several examples.
However, please note the comment in the documentation:

This interface is somewhat obsolete, as one can achieve similar
performance and greater functionality by setting up a prepared
statement to define the function call. Then, executing the statement
with binary transmission of parameters and results substitutes for a
fast-path function call.

Which server functions can be
executed from client?

Anything you could call normally can be called this way too.

regards, tom lane

#4Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Bruce YUAN (#3)
Re: How to use PQfn() in libpq library?

Bruce YUAN escribi�:

Hi Tom,

Which interface will replace this? And where can get it's reference?

Try reading beyond the comma in the quoted paragraph:

This interface is somewhat obsolete, as one can achieve similar
performance and greater functionality by setting up a prepared
statement to define the function call. Then, executing the statement
with binary transmission of parameters and results substitutes for a
fast-path function call.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#5Bruce YUAN
suanic@gmail.com
In reply to: Alvaro Herrera (#4)
Re: How to use PQfn() in libpq library?

Oh. Many thanks!
Bruce
2009/6/20 Alvaro Herrera <alvherre@commandprompt.com>

Show quoted text

Bruce YUAN escribió:

Hi Tom,

Which interface will replace this? And where can get it's reference?

Try reading beyond the comma in the quoted paragraph:

This interface is somewhat obsolete, as one can achieve similar
performance and greater functionality by setting up a prepared
statement to define the function call. Then, executing the

statement

with binary transmission of parameters and results substitutes for a
fast-path function call.

--
Alvaro Herrera
http://www.CommandPrompt.com/ <http://www.commandprompt.com/&gt;
PostgreSQL Replication, Consulting, Custom Development, 24x7 support