From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Chris Bitmead <chris(at)bitmead(dot)com> |
Cc: | Postgres Hackers List <hackers(at)postgresql(dot)org> |
Subject: | Re: libpq / SQL3 |
Date: | 2000-07-09 21:29:35 |
Message-ID: | Pine.LNX.4.21.0007091825340.10288-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Chris Bitmead writes:
> Can anybody (i.e Peter :) provide any insight on how the SQL99 API
> handles variable length datatypes where you don't know the length in a
> particular tuple in advance?
Clause 5.9 "Character string retrieval" might provide some insight,
although it's probably not what you had hoped for.
T = target (where you want to store it)
L = length of value
V = the value
b) Otherwise, let NB be the length in octets of a null
terminator in the character set of T.
Case:
i) If L is not greater than (TL-NB), then the first (L+NB)
octets of T are set to V concatenated with a single
implementation-defined null character that terminates a
C character string. The values of the remaining characters
of T are implementation-dependent.
ii) Otherwise, T is set to the first (TL-NB) octets of V
concatenated with a single implementation-defined null
character that terminates a C character string and a
-=> completion condition is raised: warning - string data,
-=> right truncation.
So highly robust applications would have to call DescribeCol before any
GetData or similar call in order to allocate a sufficiently sized buffer.
Which is a problem if DescribeCol doesn't know about user-defined data
types.
But remember that SQL does not provide any variable-without-limit length
types, so there is theoretically never any uncertainty about what kind of
buffer to allocate if you know the query.
--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden
From | Date | Subject | |
---|---|---|---|
Next Message | Oliver Teuber | 2000-07-09 23:02:52 | mailing list archive dead again! |
Previous Message | Louis Bertrand | 2000-07-09 20:29:52 | PostgreSQL vs. MySQL |