Re: Portable interfaces ... - Mailing list pgsql-interfaces

From Peter Eisentraut
Subject Re: Portable interfaces ...
Date
Msg-id 200403261122.43740.peter_e@gmx.net
Whole thread Raw
In response to Re: Portable interfaces ...  ("Preston A. Elder" <prez@neuromancy.net>)
Responses Re: Portable interfaces ...  ("Preston A. Elder" <prez@neuromancy.net>)
List pgsql-interfaces
Preston A. Elder wrote:
> Does postgres have an API review team or anything?

No.

> I mean, not trying to offend anyone here, but I don't see how any API
> where you cannot find out details about a table and its columns (such
> as character encoding schemes in effect, data type for the column
> (even if only for pre-defined data types), field lengths (for
> strings/etc), etc) could be considered anything but deficient.

http://www.postgresql.org/docs/7.4/static/information-schema.html

> Add to this the "support" for unicode - I mean, its almost like it
> was added as an afterthought,

Indeed.

> since the API won't help you, without
> using non-portable facilities (ie. headers/etc that may or may not
> exist on a system).

I don't understand what the API has to do with Unicode.  Either your 
strings are in Unicode or they are not.  This is set by your 
application.

> For now, I am (grudgingly) copying the OID codes, and going to use
> system-based multibyte/unicode functions (and hope to heck that they
> are compatible with postgres, but I get the feeling they are not
> fully compatible after browsing pg_wchar.h)

They should be.

> is, right now, I have no verification on things like string lengths
> because theres no real way to find out the maximum length of a field
> (encoding-specific - ie. for UTF-8, a length of 20 means 20 chars,
> for UTF-16, a length of 20 means 20 wchar_t's (40 bytes)).

The libpq API gives you a way to determine the binary length of a 
returned datum.  You need to allocate that dynamically.

> What are the plans for the Postgres API - as I said, I
> find it hard to believe I am the first to raise this issue, so are
> there plans to have function calls to retrieve 'column properties'
> and the like?

The plans are more or less that if you don't like it, try using a 
different one, such as ODBC, or if a different programming language 
than C.



pgsql-interfaces by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Portable interfaces ...
Next
From: Jürgen Cappel
Date:
Subject: ECPG segfault