From: | Andrew Chernow <ac(at)esilo(dot)com> |
---|---|
To: | josh(at)agliodbs(dot)com |
Cc: | Merlin Moncure <mmoncure(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Commitfest patches mostly assigned ... status |
Date: | 2008-09-11 23:30:03 |
Message-ID: | 48C9A9FB.9090500@esilo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Josh Berkus wrote:
>> Josh is probably basing that on the long history of
>> discussion/revision cycles.
>
> Yep, and that *I* don't understand what the patch does, so I'm not going to
> turn a newbie reviewer loose on it.
>
Here is a quick overview, there are two parts to the patch:
1. event system
This allows one to register "PQregisterEventProc" a per-conn callback function
with libpq that gets called when particular events occur. Currently, the events
tell you when a conn or result is created, reset, destroyed and copied. It is
generic enough to add more events in the future.
By receiving events about libpq objects, you can properly allocate and free
userland memory (PQfinish, PQexec, PQclear, etc... trigger events) and associate
it with the libpq object: thus PQsetInstanceData(conn...) or
PQsetResultInstanceData(res....). This is basically adding members to the
opaque PGconn or PGresult during runtime. This "instance data" can be retreived
via PQinstanceData and PQresultInstanceData. To shine a different light on it,
apps normally wrap a PGconn or PGresult within their own structures, but now you
can wrap the app structures inside a PGconn or PGresult.
This may help, its the libpqtypes PGEventProc implementation.
http://libpqtypes.esilo.com/browse_source.html?file=events.c
Also check out the patches sgml docs if you get a chance.
2. result management
There are also four functions that provide more control over PGresult. If you
need to create a result from scratch, expands on the PQmakeEmptyPGResult idea.
PQcopyResult - copy a given source result, flags argument determines what
portions of the result are copied.
PQsetResultAttrs - sets the attributes of the reuslt (its columns).
PQsetvalue - sets a tuple value in a result
PQresultAlloc - thin wrapper around the internal pqResultAlloc. Uses the
result's block allocater, which allows PQclear to properly free all memory
assocaited with a PGresult.
--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-09-11 23:39:27 | Re: Proposed patch: make SQL interval-literal syntax work per spec |
Previous Message | Ron Mayer | 2008-09-11 23:22:54 | Re: Proposed patch: make SQL interval-literal syntax work per spec |