
Pg.pir - OO interface to libpq

.local pmc pg, con, res
pg = get_class 'Pg'
con = pg.'connectdb'('dbname = db')
res = con.'exec'('SELECT * from tab')
n = res.'ntuples'()
m = res.'nfields'()
...
val = res.'getvalue'(i, j)

The Pg library provides an OO interface to libpq functions - the C interface to PostgreSQL.
See "Chapter 28. libpq - C Library" for details or the tests in t/library/pg.t.

Leopold "leo" Toetsch <lt(at)toetsch.at>

Pg.pir is a thin wrapper around postgres.pir - the NCI functions of the libpq library. It's roughly divided into 3 parts, represented by 'Pg', 'Pg;Conn', and 'Pg;Result' classes.
A class method that returns a new connection object.
Object initializer. Takes a PGconn structure.
Return the raw PGconn structure. You probably don't need this function except for calling PQ* code directly.
Return the connection status.
Finish the connection. The connection attribute is set to .undef thereafter and inaccessible then.
Execute the SQL command and return a Pg;Result object.
Execute the SQL command and return a Pg;Result object. All values are considered being text - there's no provision to use binary data.
Prepare a query for execution with execPrepared
Execute a prepared query.
Install a notice receiver callback. The callback will be called as
.sub 'notice'
.param pmc arg
.param pmc res
Object finalizer. Calls self.'clear'().
Return the raw PGresult structure. You probably don't need this function except for calling PQ* code directly.
Return the status of the result.
Clear the result structure. You don't have to explicitly call this method. If a result object is no longer alive, the GC will call __finalize(), which wil clear the object.
Return the amount of tuples in the result.
Return the amount of fields in the result.
Return the name of the c-th field in the result.
Return the number of the field or -1.
Return result value from row r and column c.
Return true if the result value at (r,c) is NULL.