In order to provide support for SPL, the EnterpriseDB libpq
interface library has provided the following functions in the libpq Application Programming
Interface (API):
PQprepareOut() is used for preparing a callable statement whereas for preparing a prepared
statement, the method PQprepare() is used.
extern PGresult *PQprepareOut(PGconn *conn,
const char *stmtName,
const char *query,
int nParams,
const Oid *paramTypes,
const int *paramDirection);
The following method is used for executing a callable statement.
extern int PQsendQueryPreparedOut(PGconn *conn,
const char *stmtName,
int nParams,
const char *const * paramValues,
const int *paramLengths,
const int *paramFormats,
int resultFormat);
This method is used for fetching cursors from PGresult(resultset).
extern int PQCursorResult(PGconn *conn,PGresult *res);
This method is used for returning the number of cursors that were fetched from PGresult(resultset).
extern int PQnCursor(const PGresult *res);
PQgetOutResult() is used for retrieving PGresult which contains the values of
IN/OUT/INOUT parameters. The values of these IN/OUT/IN OUT parameters can then be
retrieved by passing PGresult to PQgetvalue() method.
extern PGresult *PQgetOutResult(PGconn *conn);
PQgetCursorResult() is used for fetching cursor record(PGresult) residing on a specific index where
tupe_num is a row in a recordset and field_num is a column in the recordset table.
extern PGresult *PQgetCursorResult(const PGresult *res, int tup_num, int field_num);