Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Hackers > libpq sup****t ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 10 Topic 9496 of 10962
Post > Topic >>

libpq sup****t for arrays and composites

by andrew@[EMAIL PROTECTED] (Andrew Dunstan) Jun 8, 2008 at 07:59 PM

One of the areas where libpq seems to be severely lacking is in handling 
arrays and composites in query results. I'd like to set about rectifying 
that.

Ideally this would mean that drivers using libpq could easily and 
reliably deliver such objects suitably structured in their particular 
languages (e.g. lists and hashes in Perl).

One complicating factor I see is that there is no protocol level sup****t 
for anything other than simple objects - each data value is simply a 
stream of bytes of a known length. We would therefore need some pretty 
robust processing to pick apart structured objects.

We'll need a new API to handle such objects. I'm thinking of something
like:

PQarray * PQgetArray( const PGresult *res, int row_number, int 
column_number);
int PQgetArrayNDims(PQarray * array);
int PQgetArrayLower(PQarray * array, int dim);
int PQgetArrayUpper(PQarray * array, int dim);
int PQgetArrayElementLength(PQarray * array, int dim1, ...);
bool PQgetArrayElementIsNull(PQarray * array, int dim1, ...);
char * PQgetArrayElement(PQarray * array, int dim1, ...);

PQcomposite * PQgetComposite(const PGresult *res, int row_number, int 
column_number);
PQcomposite * PQgetArrayElementComposite(PQarray * array, int dim1, ...);
int PQgetCompositeNFields(PQcomposite * composite);
char * PQgetCompositeFName(PQcomposite * composite, int fnumber);
int PQgetCompositeFNumber(PQcomposite * composite, char * fname);
Oid PQgetCOmpositeFType(PQcomposite * composite, int fnumber);
int PQgetCompositeFieldLength(PQcomposite * , int fnumber);
bool PQgetCompositeFieldIsNull(PQcomposite * composite, int fnumber);
char * PQgetCompositeField(PQcomposite * composite, int fnumber);

Not sure if we need analogs for PQfformat, PQfmod or PQfsize - I suspect 
not, but right now I'm just thinking out loud.

Thoughts? Is this worth doing?

cheers

andrew







-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
 




 10 Posts in Topic:
libpq support for arrays and composites
andrew@[EMAIL PROTECTED]   2008-06-08 19:59:46 
Re: libpq support for arrays and composites
tgl@[EMAIL PROTECTED] (T  2008-06-08 20:10:16 
Re: libpq support for arrays and composites
andrew@[EMAIL PROTECTED]   2008-06-08 20:33:52 
Re: libpq support for arrays and composites
mmoncure@[EMAIL PROTECTED  2008-06-10 10:11:20 
Re: libpq support for arrays and composites
tgl@[EMAIL PROTECTED] (T  2008-06-10 10:23:11 
Re: libpq support for arrays and composites
mmoncure@[EMAIL PROTECTED  2008-06-10 11:29:17 
Re: libpq support for arrays and composites
ac@[EMAIL PROTECTED] (An  2008-06-08 22:36:41 
Re: libpq support for arrays and composites
andrew@[EMAIL PROTECTED]   2008-06-09 00:31:57 
Re: libpq support for arrays and composites
tgl@[EMAIL PROTECTED] (T  2008-06-09 03:00:15 
Re: libpq support for arrays and composites
ac@[EMAIL PROTECTED] (An  2008-06-09 06:02:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 8:04:38 CST 2008.