From 976246cc7e4d8b673fc62fe6daa61c76d94af1af Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 24 Aug 2002 15:00:47 +0000 Subject: The cstring datatype can now be copied, passed around, etc. The typlen value '-2' is used to indicate a variable-width type whose width is computed as strlen(datum)+1. Everything that looks at typlen is updated except for array support, which Joe Conway is working on; at the moment it wouldn't work to try to create an array of cstring. --- src/interfaces/libpq/fe-exec.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/interfaces/libpq/fe-exec.c') diff --git a/src/interfaces/libpq/fe-exec.c b/src/interfaces/libpq/fe-exec.c index 3ff32daaeb1..0d1b7ad05ba 100644 --- a/src/interfaces/libpq/fe-exec.c +++ b/src/interfaces/libpq/fe-exec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.120 2002/06/20 20:29:53 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.121 2002/08/24 15:00:47 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1138,14 +1138,10 @@ getRowDescriptions(PGconn *conn) /* * Since pqGetInt treats 2-byte integers as unsigned, we need to - * coerce the special value "-1" to signed form. (-1 is sent for - * variable-length fields.) Formerly, libpq effectively did a - * sign-extension on the 2-byte value by storing it in a signed - * short. Now we only coerce the single value 65535 == -1; values - * 32768..65534 are taken as valid field lengths. + * coerce the result to signed form. */ - if (typlen == 0xFFFF) - typlen = -1; + typlen = (int) ((int16) typlen); + result->attDescs[i].name = pqResultStrdup(result, conn->workBuffer.data); result->attDescs[i].typid = typid; -- cgit v1.2.3