7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.67 1998/09/04 05:03 :02 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-exec.c,v 1.68 1998/09/10 15:18 :02 momjian Exp $
11
11
*
12
12
*-------------------------------------------------------------------------
13
13
*/
@@ -541,6 +541,16 @@ getRowDescriptions(PGconn *conn)
541
541
PQclear (result );
542
542
return EOF ;
543
543
}
544
+ /*
545
+ * Since pqGetInt treats 2-byte integers as unsigned, we need to
546
+ * coerce the special value "-1" to signed form. (-1 is sent for
547
+ * variable-length fields.) Formerly, libpq effectively did a
548
+ * sign-extension on the 2-byte value by storing it in a signed short.
549
+ * Now we only coerce the single value 65535 == -1; values
550
+ * 32768..65534 are taken as valid field lengths.
551
+ */
552
+ if (typlen == 0xFFFF )
553
+ typlen = -1 ;
544
554
result -> attDescs [i ].name = strdup (typName );
545
555
result -> attDescs [i ].typid = typid ;
546
556
result -> attDescs [i ].typlen = typlen ;
@@ -1488,7 +1498,7 @@ PQoidStatus(PGresult *res)
1488
1498
if (strncmp (res -> cmdStatus , "INSERT " , 7 ) != 0 )
1489
1499
return "" ;
1490
1500
1491
- /*
1501
+ /*----------
1492
1502
* The cmdStatus string looks like
1493
1503
* INSERT oid count\0
1494
1504
* In order to be able to return an ordinary C string without
@@ -1498,6 +1508,7 @@ PQoidStatus(PGresult *res)
1498
1508
* INSERT oid count\0oid\0
1499
1509
* ^ our return value points here
1500
1510
* Pretty klugy eh? This routine should've just returned an Oid value.
1511
+ *----------
1501
1512
*/
1502
1513
1503
1514
slen = strlen (res -> cmdStatus );
0 commit comments