Fix for length in libpq from Tom Lane.

This commit is contained in:
Bruce Momjian 1998-09-10 15:18:06 +00:00
parent 3a9c626a86
commit d9d8169858
3 changed files with 21 additions and 6 deletions

View File

@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.67 1998/09/04 05:03:02 momjian Exp $ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.68 1998/09/10 15:18:02 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -541,6 +541,16 @@ getRowDescriptions(PGconn *conn)
PQclear(result); PQclear(result);
return EOF; return EOF;
} }
/*
* 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.
*/
if (typlen == 0xFFFF)
typlen = -1;
result->attDescs[i].name = strdup(typName); result->attDescs[i].name = strdup(typName);
result->attDescs[i].typid = typid; result->attDescs[i].typid = typid;
result->attDescs[i].typlen = typlen; result->attDescs[i].typlen = typlen;
@ -1488,7 +1498,7 @@ PQoidStatus(PGresult *res)
if (strncmp(res->cmdStatus, "INSERT ", 7) != 0) if (strncmp(res->cmdStatus, "INSERT ", 7) != 0)
return ""; return "";
/* /*----------
* The cmdStatus string looks like * The cmdStatus string looks like
* INSERT oid count\0 * INSERT oid count\0
* In order to be able to return an ordinary C string without * In order to be able to return an ordinary C string without
@ -1498,6 +1508,7 @@ PQoidStatus(PGresult *res)
* INSERT oid count\0oid\0 * INSERT oid count\0oid\0
* ^ our return value points here * ^ our return value points here
* Pretty klugy eh? This routine should've just returned an Oid value. * Pretty klugy eh? This routine should've just returned an Oid value.
*----------
*/ */
slen = strlen(res->cmdStatus); slen = strlen(res->cmdStatus);

View File

@ -1,7 +1,11 @@
#FIG 3.1 #FIG 3.2
Landscape Landscape
Center Center
Inches Inches
Letter
100.00
Single
-2
1200 2 1200 2
2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2 2 1 0 2 29 7 0 0 -1 0.000 0 0 -1 1 1 2
0 0 2.00 150.00 180.00 0 0 2.00 150.00 180.00
@ -95,16 +99,16 @@ Inches
0 0 2.00 150.00 150.00 0 0 2.00 150.00 150.00
1350 9375 1050 9375 825 9000 825 4425 1050 4050 1500 3975 1350 9375 1050 9375 825 9000 825 4425 1050 4050 1500 3975
2250 3975 2400 4275 2250 3975 2400 4275
0.000 1.000 1.000 1.000 1.000 1.000 1.000 0.000
3 0 0 2 8 7 0 0 -1 0.000 0 1 0 7 3 0 0 2 8 7 0 0 -1 0.000 0 1 0 7
0 0 2.00 150.00 150.00 0 0 2.00 150.00 150.00
7650 5775 8250 5475 8250 4575 7725 3975 3525 3975 2850 3975 7650 5775 8250 5475 8250 4575 7725 3975 3525 3975 2850 3975
2700 4275 2700 4275
0.000 1.000 1.000 1.000 1.000 1.000 0.000
3 2 2 2 20 7 0 0 -1 6.000 1 1 0 5 3 2 2 2 20 7 0 0 -1 6.000 1 1 0 5
0 0 2.00 150.00 180.00 0 0 2.00 150.00 180.00
2550 2175 3225 2475 5400 2550 6225 2625 6450 2775 2550 2175 3225 2475 5400 2550 6225 2625 6450 2775
0.00 0.00 2927.81 2370.42 3096.56 2445.42 3729.54 2591.19 0.000 -1.000 -1.000 -1.000 0.000
4904.72 2518.98 5588.53 2561.81 6033.83 2557.52 6271.80 2641.52
6328.05 2679.02 0.00 0.00
4 1 -1 0 0 16 18 0.0000 4 210 900 1560 11190 Utilities\001 4 1 -1 0 0 16 18 0.0000 4 210 900 1560 11190 Utilities\001
4 1 -1 0 0 16 18 0.0000 4 270 2265 7965 11190 Storage Managers\001 4 1 -1 0 0 16 18 0.0000 4 270 2265 7965 11190 Storage Managers\001
4 1 -1 0 0 16 18 0.0000 4 270 960 4725 11175 Catalog\001 4 1 -1 0 0 16 18 0.0000 4 270 960 4725 11175 Catalog\001

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 61 KiB