Re: [PATCHES] libpq type system 0.9a

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] libpq type system 0.9a
Date: 2008-04-10 00:54:08
Message-ID: 47FD6530.90700@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>
> Perhaps we could do a partial exposure, where the exported struct
> declaration contains "public" fields and there are some "private" ones
> after that.
>
>

I have another idea. It would remove a boat load of members that would need to
be exposed (may remove them all).

Can we make a variant of PQmakeEmptyPGresult? Maybe something like this:

PGresult *PQdupPGresult( // maybe not the best name?
PGconn *conn,
PGresult *source,
int numAttributes,
int ntups);

This starts off by calling PQmakeEmptyPGresult and then copying the below
members from the provided 'source' result argument.
- ExecStatusType resultStatus;
- char cmdStatus[CMDSTATUS_LEN];
- int binary;
- PGNoticeHooks noticeHooks;
- int client_encoding;

It would then preallocate attDescs and tuples which would also set
numAttributes, ntups & tupArrSize. attdescs and tuples are not duplicated, only
allocated based on the 'numAttributes' and 'ntups' arguments. Now libpqtypes
only needs direct access to attDescs and tuples, for when it loops array
elements or composite fields and copies stuff from the source result.

Any interest in this direction? I am still thinking about how to abstract
attDesc and tuples, I think it would require more API calls as well.

curBlock, curOffset and spaceLeft were never copied (intialized to zero). We
don't touch these.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Chernow 2008-04-10 01:14:31 Re: [PATCHES] libpq type system 0.9a
Previous Message Bruce Momjian 2008-04-10 00:53:30 Re: Commit fest queue

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Chernow 2008-04-10 01:14:31 Re: [PATCHES] libpq type system 0.9a
Previous Message Andrew Dunstan 2008-04-09 23:40:49 Re: Fix for win32 stat() problems